Aquarium CB 21MHz Electronics Music Photos ZX Spectrum +2A Cooking Fishing Main page Aquarium CB 27MHz Electronics Music Fotos ZX Spectrum Cooking Fishing
Česká verze

Fast serial interface


All is based on active optocoupler PC900V. The input stage is simple LED. The output transistor has an open collector and is driven by active circuit with hysteresis which must have power supply. On the following picture you can see a schematic of connection to PC. You can get data sheets in PDF and PostScript format.



Schéma zapojení


Signal labels TXD and RXD are related to the periphery. It is necessary to connect theese signals to complementary signals on PC RS232 connector. You can find on pin J3 voltage +10V, J5 voltage -10V and on pin J4 is data output.
The power supply is taken directly from serial port. The output transistor is connected to the port by resistors and such configuration guarantees that if the input LED is inactive the voltage value on the signal TXD is negative (log.1 for RS232) and RS232 port is stand-still. Resistor values are choosed to obtain voltage values on TXD pin +-5V. It means that the optocoupler is changing its power supply value from 15V to 5V when the output transistor is ON. Such working conditions are a bit unusual but it works without problems by velocity 115200 Bd.
I've used this interface to connect PC with eight bit A/D converter which is driven by PIC16C84 processor. The converter sends 10k samples per second. Bacause the converter is isolated it is possible to look at more exotic places like for example telephone line and so on.

A part of PASCAL program for setting and reading serial port:

{ Placing variable COM on vectors of serial ports }
var
  COM                  : array [0..1] of word absolute $0000:$0400;

{ Setting serial port }
procedure SETCOM;
begin
  NUM:=0; {choosing port COM1 (pro COM2 je NUM:=1)
  DATA:=COM[NUM]; {getting adresses of control registres }
  INTE:=COM[NUM]+1;
  INTF:=COM[NUM]+2;
  CONT:=COM[NUM]+3;
  PFC:=COM[NUM]+4;
  PFD:=COM[NUM]+5;
  PFE:=COM[NUM]+6;
  port[PFC]:=$01;
  port[CONT]:=128;
  port[DATA]:=1;  {setting divider}
  port[INTE]:=0;
  port[CONT]:=7;
  HL:=port[PFD];HL:=port[DATA];
  port[INTE]:=0;
end;

{ Reading serial port }
function SEM:byte;
begin
  repeat until (keypressed or ((port[PFD] and 1) = 1));
  SEM:=port[DATA];
end;


All the best and good luck from Petr Simandl
Main page

Last change : 27.5.1999