ourlibro.com

Our Library about electronic, automation , computer software and hardware

 


Interfacing Parallel Port Interface with PPI 8255 circuit

Dear all hand

Something we want to connect more peripheral module to our computer via parallel port. Traditionally we can multiplex this port with multiplexing IC such of PPI 8255. To establish connection between PPI IC and parallel port we simply use IC buffer, image below show the complete circuit:

You can get this circuit via this link: eagle layout

How to program this PPI 8255 paralel port interface circuit:

1. First, we must send control word to the PPI 8255

To do this job, we can make inisialisation procedure like this:

procedure TForm1.inisialisasi(dt:byte);
begin
smallport1.WriteByte(LPT_data,$F7); // 11110111, no read and no write
smallport1.WriteByte(LPT_kontrol,$00); // 0000 write only in 574 control
smallport1.WriteByte(LPT_kontrol,$08); // 1000
smallport1.WriteByte(LPT_kontrol,$00); // 0000
{ inserting control word in to PPI }
smallport1.WriteByte(LPT_data,dt); // data Control Word/CW
smallport1.WriteByte(LPT_kontrol,$03); // 0011 strobe aktif
smallport1.WriteByte(LPT_kontrol,$02); // 0010 for clock strobe 574 out
smallport1.WriteByte(LPT_data,$F3); // mode write 1111 0011, port CW out
smallport1.WriteByte(LPT_kontrol,$0A);// 1010 activation 574 control
smallport1.WriteByte(LPT_kontrol,$02); //0010
smallport1.WriteByte(LPT_data,$F7); // normal no read or no write
smallport1.WriteByte(LPT_kontrol,$0A);//1010 activation 574 control
smallport1.WriteByte(LPT_kontrol,$02);//0010
end;

2. Before starting program we call this procedure to set PPI8255 operation mode, just like this:

inisialisasi($8B); { control word for A=out, B&C=input }

This Control word make A port as output port and B, C port as input port.

 

3. After sending control word, we can perform write action or read action, to do this we can use an VCL that has been already such of small port. It is will shortening our work.

We must understand that in this circuit, data that being readlnis in nible format, so if we send 8 bit data, we must receive in two step consequencially. Below is example for reading data that being sent via B port:

edit1.text := hexa((InpB shr 4) and $0F) + hexa(InpB and $0F) + ‘ H’;

Data from B port will readln and display it in edit1 component.

And Instruction in program code above is to perform masking operation with $0F

Also in this code, we use a procedure called InpB procedure .InpB procedure performing read action on B port.

Below is program listing for InpB procedure :functionTForm1.InpB:byte;

var tmp : byte;

begin

smallport1.WriteByte(LPT_kontrol,$00);//ready for read 0000, 574 out become -off

smallport1.WriteByte(LPT_data,$E5);//RD = low 1110 0101, read from port B

smallport1.WriteByte(LPT_kontrol,$08);//1000,incoming data fromA to Y 74LS157

smallport1.WriteByte(LPT_kontrol,$00);//0000

tmp := smallport1.ReadByte(LPT_status) xor $80; //xor for inversstrobe

tmp := (tmp shr 4) and $0F;

smallport1.WriteByte(LPT_kontrol,$04); //0100, incoming data fromB to Y

InpB := tmp or ((smallport1.ReadByte(LPT_status)xor $80) and $F0);

end;

4. You can get full tutorial code ( In Delphi) via this link. The program performing read action on B and C port, but it easily to make another function like writing A port .

 

Leave a Reply