View Full Version: PARALLEL PORT EXPANSION for more inputs and outputs

booksbybibin >>Computer interfacing >>PARALLEL PORT EXPANSION for more inputs and outputs


yogi- 07-03-2006
PARALLEL PORT EXPANSION for more inputs and outputs
This tutorial is taken from the book MY EXPERIENCE IN PARALLEL PORT INTERFACING. you can download it free from the files section(file:-parallelport(3 files) of yahoo group-booksbybibin http://groups.yahoo.com/group/booksbybibin/ comments about this book on www.booksbybibin.blogspot.com PARALLEL PORT EXPANSION In some cases you want more outputs or more inputs from the parallel port than how many inputs and outputs we have from the output of the parallel port. So you want to expand parallel port. You can use 8255 to expand the parallel port input and output. You can get either 24 output pins or 24 input pins or 8 input and 16 output pins using 8255. But 8255 is costlier. We can get same solution using D flipflops(or u can do using any latch). 24 PIN OUTPUT PORT Here you can see that output of data port is connected to the input of D flip flop and control port pins as the clock of the D flip flop. The clock for 74374 is produced by making the clock pin HIGH from a LOW state of the clock pin. The output should be enabled. First you write the data you want to write to the flip flop into the data register of the parallel port and the clock the flip flop. Suppose if you want to write to flip flop connected to C0, then Write_DataPort(data to be written to flip flop) Clear_ControlPort_bit(0); delay(1); Set_ControlPort_bit(0); 24 PIN INPUT PORT The buffers become active only when a LOW is applied to the control pin of the buffer. So in the starting of the program we have to make all pins HIGH so that two buffers are not selected at a time. Suppose if you want to select the first flip flop connected to C0. Clear_ControlPort_bit(0); a=Read_DataPort(); Set_ControlPort_bit(0); you should make the pin high before you leave the buffer. This way we can get 24 inputs from the parallel port. 12 PIN INPUTS AND 12 PIN OUTPUTS First you should disable the output of the buffers(74244's) in the beginning of the program. Make the clock to the flip flop by making the corresponding control port pin LOW and then HIGH. Buffers input should be made LOW to read the buffer and the data port should be made for input before reading the buffer #include"bparlib.c" void main() { int a,b; printf("Enter the 8-bit value to be send to Flip Flop 1"); scanf("%d",&a); printf("Enter the 8-bit value to be send to Flip Flop 2"); scanf("%d",&b); Clear_ControlPort_bit(0); Clear_ControlPort_bit(1); Set_ControlPort_bit(2); Set_ControlPort_bit(3); // to disable enabling of 74244 /*writing to first flip flop*/ Clear_ControlPort_bit(0); Write_DataPort(a); Set_ControlPort_bit(0); /*writing to second flipflop*/ Clear_ControlPort_bit(1); Write_DataPort(b); Set_ControlPort_bit(1); /*reading first 74ls244*/ Clear_ControlPort_bit(2); printf("Reading of first 74244 is %x",Read_DataPort()); Set_ControlPort_bit(2); //disabling 244 /*reading second 74244*/ Clear_ControlPort_bit(3); printf("Reading of first 74244 is %x",Read_DataPort()); Set_ControlPort_bit(3); //disabling 244 } EXPANDING PARALLEL PORT FOR MORE INPUTS AND OUTPUTS Here I am using decoder at the output of the control port for more inputs and outputs. If you have a 3x8 decoder then you can make 7x8 outputs or 7x8 inputs or (nx8 inputs and (7-n)x8 outputs). If you use a 4x16 decoder then you can expand it further to produce higher number of inputs and higher number of outputs. A decoder has 8 outputs, but we can use only 7 outputs because if we want to output to a flip flop and flip flop want clock transition from 0 to 1 for a flip flop connected to output 4 of the decoder and output 7 is not connected, then first put the data to the data port of the flip flop and write control port to 4 and after some delay write again to control port (7). So when control port gets 4 then clock=0 and when control port is 7 then clock=1 and we get a transition from 0 to 1 and data latched into the flip flop. Suppose if you want to use 8 flip flops then when we select 4 first then we have to select another value to make clock to 1, suppose if you select 7 then clock of the flip flop connected to 7 gets 0 and we next had to write data to 7 otherwise the flip flop data will get corrupted.


Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.