Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Forums > Electronic Projects Design/Ideas/Reviews


Electronic Projects Design/Ideas/Reviews Are you building an electronic project or want to? Maybe you need some assistance? Come and submit your electronic questions here and let our experienced members find a solution.

Reply
 
Tools
Old 9th September 2005, 05:48 AM   #1
Default Parallel port control port: is it Write Only or Read/Write

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
elexhobby is offline  
Old 9th September 2005, 08:23 AM   #2
Default 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]
__________________
Everybody can but not everybody will.
aibelectronics is offline  
Old 9th September 2005, 01:36 PM   #3
Default

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.
elexhobby is offline  
Old 10th September 2005, 12:22 AM   #4
Default

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.
__________________
-=: The best low-priced components to troubleshoot with are the speaker and the LED :=-
mstechca is offline  
Old 10th September 2005, 05:28 PM   #5
Default

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
Dialtone is offline  
Old 12th September 2005, 01:02 PM   #6
Default reply

check out h**p.senet.com - excellent!
__________________
Everybody can but not everybody will.
aibelectronics is offline  
Old 23rd December 2008, 11:18 AM   #7
Default 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();
}
vnambiar is offline  
Reply

Tags
control, parallel, port, read or write, write

Thread Tools
Display Modes




All times are GMT. The time now is 01:54 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker