Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Reading data from parallel port

Status
Not open for further replies.

Sputnik

Full Member level 3
Joined
Oct 19, 2004
Messages
150
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,298
Location
South Africa
Activity points
1,667
I have conected to computers (Pentium 1) via the parallel port and have successfully done a direct connection (Win98SE). I've been trying to switch the port from output to input in QBasic, but with no success. Does anyone have a QB4.5 example that may illustrated how to do this.

Thanks,
Sputnik :idea:
 

shafee001

Advanced Member level 4
Joined
May 6, 2004
Messages
114
Helped
16
Reputation
32
Reaction score
4
Trophy points
1,298
Location
Egypt
Activity points
1,078
the data address different from status and control address
data out ->0x378
control input ->0x37a
status input ->0x379

try to read from those address
 

fiquran

Full Member level 1
Joined
Mar 10, 2005
Messages
99
Helped
17
Reputation
34
Reaction score
3
Trophy points
1,288
Activity points
2,087
to send a byte to the printer, simply do an out instruction with dx containing 0x378 and al containing the byte. to get the status byte from the printer, do an in instruction with dx containing 0x379, and then looking in CPU register al for the result. to command the device to change its behavior, for example to "enable interrupts", put the appropriate byte in al and do an out to port 0x37a.
 

Sputnik

Full Member level 3
Joined
Oct 19, 2004
Messages
150
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,298
Location
South Africa
Activity points
1,667
I'm trying to change the Data bits of the parallel port (ECP) from output to inputs and not have to read from Status pins.

Sputnik :idea:
 

shafee001

Advanced Member level 4
Joined
May 6, 2004
Messages
114
Helped
16
Reputation
32
Reaction score
4
Trophy points
1,298
Location
Egypt
Activity points
1,078
i tried to do that, but it was not work;
i think you masy use status port as i told you before..
thanks
 

Cortex

Full Member level 3
Joined
Mar 26, 2005
Messages
182
Helped
12
Reputation
24
Reaction score
4
Trophy points
1,298
Location
Morocco
Activity points
2,733
Maybe look in Setup
Ecp+Epp
or Bi-directional
 

shafee001

Advanced Member level 4
Joined
May 6, 2004
Messages
114
Helped
16
Reputation
32
Reaction score
4
Trophy points
1,298
Location
Egypt
Activity points
1,078
i tried that but it dosen't work;
i think you may start thinking of status register
 

Sputnik

Full Member level 3
Joined
Oct 19, 2004
Messages
150
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,298
Location
South Africa
Activity points
1,667
I've got it working, apart from choosing ECP instead of Normal in BIOS (thanks Cortex), it was also the cable I was using.

I was using a 25 pin male to male parallel cable, which wasn't pin-for-pin, wires were crossed and so wouldnt work for my application of using a computer to send data and use another to receive. So I used another cable (25 pin male to female) connected all the ground pins and after setting bit 5 of Control Register high, I grounded a few data pins and my little program displayed 0 for the grounded pins, the rest were pulled high inside the computer.

My main aim is just to test the capability of receiving data, might be useful for another project, I'm thinking of making a PC oscilloscope. I've seen many posts on this forum.

Sputnik :idea:
 

Jackwang

Full Member level 2
Joined
Nov 12, 2004
Messages
135
Helped
3
Reputation
6
Reaction score
1
Trophy points
1,298
Activity points
1,095
the parallel type of my computer has normal, bi-directional, and ECP.
i should choose which one?
 

Sputnik

Full Member level 3
Joined
Oct 19, 2004
Messages
150
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,298
Location
South Africa
Activity points
1,667
Well, bi-directional is basically the same as ECP, although I think it could mean EPP, in which different handshaking is used. Although I've read that ECP has a more complex handshake if you want to implement it into a microcontroller that interfaces to the parallel port.

Sputnik :idea:
 

Sputnik

Full Member level 3
Joined
Oct 19, 2004
Messages
150
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,298
Location
South Africa
Activity points
1,667
How do I implement handshaking, all I've been doing is writing data to the data port and it sends it through without any handshaking, the same when receiving data. How do I get it so that the computer reads the data when my micro controller has generated the appropiate handshaking and vice versa.

Sputnik :idea:
 

Jackwang

Full Member level 2
Joined
Nov 12, 2004
Messages
135
Helped
3
Reputation
6
Reaction score
1
Trophy points
1,298
Activity points
1,095
i want to understand protocal problem about parallel read and write.
i do my best to read data from parallel, but i find it is not reliable, some datas is always wrong.
can you give me some practical codes?
 

Sputnik

Full Member level 3
Joined
Oct 19, 2004
Messages
150
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,298
Location
South Africa
Activity points
1,667
This is a simple program that I wrote, it isn't finished yet. It can be used to see the bits set and to set bits on the data port of the parallel port and is not very useful but fun, for me at least.

It DOESN'T run on WinXP, unfortunately! So you'll have to use Win9x. The WIN95IO.DLL file must be put into the 'system' directory.

I'm still working on this project, I need to purchase more PICs.

Sputnik :idea:
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top