Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Parallel port control port: is it Write Only or Read/Write

Status
Not open for further replies.

elexhobby

New Member
Hi Friends,
I read the parallel port tutorial on the site www.beyondlogic.org & experimented a bit with my computer.
In the tutorial it is written that the data port (0x378) is generally ‘Write Only’; however I found mine to be bi-directional – great!
The doubt I have is with the Control Port (0x37A). The tutorial says that the control port is Read/Write. So I sent all the control pins to high impedance state (sent F4, since some are hardware inverted). I then tried externally applying a low input (0 V) to certain pins– But it doesn’t read the external value. When I read back the control port, it simply reads the value sent earlier (F4).
Is it the case that not all control ports are bi-directional? I find mine to be ‘Write Only’.
Kindly help.

Thanks in advance.

Elexhobby
 
reply

i'm also into computer interface. could you give us the code and lets see? i also read the tutorial at beyond-logic. REMEMBER pins 1, 14 and 17 are hardware inverted. please post what you did in code form.[/b]
 
Thanks for your interest.
I am attaching the C code herewith.

int a;
clrscr();
outportb(0x37A,0xf4);
getch();
a=inportb(0x37A);
printf("%x",a);
getch();

I have kept in mind that 1, 14, 17 are h/w inverted hence the data sent is F4 (1111 0100).
Thanks again.
 
The actual pinout depends on the mode (SPP/EPP/ECP).

In SPP mode, you have about 13 output pins and 4 input pins (correct me if I am wrong here). 8 of the output pins are specifically data pins and the rest of them are control pins.

Go to Ralf Browns Interrupt Page. He has documentation on port addresses, and it will explain what each address corresponds to.

Because you have about 4 input pins (status registers), use the port that captures the status of these registers, and convert that into 4 bits. You will need to read from the port twice to obtain a full byte (4 bits * 2 = 8 bits = byte)

With EPP and ECP, data transfer with the port is supposed to be easier, but I can't help you further with these modes, because I don't deal with them.
 
I think your problem is that you are confusing the terms bi-directional and read-write to be the same. They are not in this case.
The control port registers are read-write from the computer side, but not bi-directional from the device interface side.
As mentioned earlier, bi-directional capability on the data bits depends on the mode the port is operating under.
Continue reading the beyondlogic.org tutorials on the other modes and you can get a feel for the port functions in these modes.
From a programming standpoint, EPP mode is the easiest to impliment full bi-directional data flow with minimal programming involved.
Dialtone
 
plse help.....reagarding reading pulse from status port....

i want to write high value to data port and switch on my energy meter....
and i want to read the pulse from status port ....
(will add one 100w bulb to energy meter as load)
while reading i want to print the time stamp.....
please help.......
am in SPP......
i am attaching what i did ...
plse chk n help me....

#include<stdio.h>
#include<conio.h>
#include<dos.h>



#define PORT1 0x378 //basic port address, check this setting in bios
#define DataPort PORT1
#define ControlPort PORT1+2
#define StatusPort PORT1+1


#define S7 0x80 /* note: NOT(S7) is on the input */
#define S6 0x40
#define S5 0x20
#define S4 0x10
#define S3 0x08


void main()
{

int b=0;
int z;
int i;
int data;
clrscr();


printf("Enter the Time Constant ");
scanf("%d",&b);

outportb(0x378,1);
for(i=0;i<b;i++);
{
printf("%d",i);
z=inportb(PORT1+1);
delay(10000);
if(z == 127)
printf("\n pin 15: %d",(z & 0x08)/0x08);
delay(10000);
}

getch();
close();
}
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top