Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi again,
I was told by Elric that using parallel ports are better than serial ports, so I did some research to try to find out how to send data to them. After hours of surfing the internet I used this code to send data to the parallel port.
mov al,00000001
mov dx,378h
out dx,alThe purpose of the program this was included in was to turn an LED on and off. Please help me with any information you have. Source code would be great. Thanks

I forgot to add that I am using Windows XP and that my ports sometimes do not allow access to them without some type of permission. Any help on this would be great too.

G'day,
The parallel port is certainly better suited to what you want to do. However, with WINXP you may have access problems.
Wizard-fred's point about using "real" DOS is valid. I use an old 386 DOS machine purely for this purpose.
You can, however, get around the problem by using kernel drivers, API and MFC methods.
Have a look at this site:
www.lvr.com
It has advice on running both serial and parallel ports in WIN2000 and above.
You might also consider using VB or C++ and a DLL file suited to the task. There is one I know of called io.dll that can be used with both C++ and VB. There is also one on the lvr site.
Good luck,
Elric

HI people,
As so far I've found out,there are two ways to access the parallel port: One is to open the port using CreatFile(),and the other is to call outp()with the help of inpout.dll which is to swich to the Kernel Mode when a 2000 or above OP has been detected.I have tried both,neither of them worked out:when I write one bit to the data register after calling CreatFile(),it hands up the whole program;when I tried the second method,I didn't get the expected signal at the particular pin.Anyone by any chance has any clues?

G'day,
Have you set up the hardware correctly: ie with a current limiting resistor. What port pins are you using on the parallel port?
Not all ports can source enough current (they sink it better): it might be a good idea to put a multimeter in its place (an oscilloscope would be even better) and check that the signals from the port are wrong, and it is not a fault with your hardware.
Try looking at Jan Axelson's (at lvr.com) FAQ at :http://www.lvr.com/jansfaq.htm.
If you have all those in place, post back.
Also, are you restricted to using pure assembly? I've no doubt you have bigger plans for the future, but VB6/ C++/Delphi etc will all accomplish your task easily.
regards and best wishes for Xmas and the New Year.
Elric

Hi,
I have thought about your advice to use Visual Basic or some other language, but I would really prefer using assembly language (TASM). I have found several examples programs that use parallel ports and now know how to do it. My problem however seems to be in the hardware: when I connect the LED to pin 2 and a ground pin, it lights up when no program is running and when I tell it to turn off. It seems that I can't control and it will always be turned on. If someone could tell how to fix this, I believe I would have no more problems.
Thanks.

G'day,
TASM will do the job, if that is what you want to use;but, how have you set up the hardware?
It seems that you have two unkowns here.
Pin2 is data1 out- fine, but at what voltage?
Have you done what I suggested in my last post?
ie remove the LED circuit and put a multimeter in its place.
Does the output change when you write to the port?
When you are happy that this works, you can eliminate the PC/Printer port as the problem and look at the LED circuit in more detail.
Good luck and best wishes,
Elric

It is disturbing that pin2 is active on powerup. Apparently the port is initialized active. In normal operation the port data is valid after the BUSY is driven low and during the STROBE pulse. I feel that the Windows driver is not passing the signal through. I would prefer confirming the signals with logic analyzer or oscilloscope.

The port is not initialized active! The parallel port is never initialised. It is just there, always ready to be used. It is an anceint contraption which (in its basic mode) acts exactly the same as it did on an 8088 in 1981 :)
The strobe signal is only called "strobe" when you are talking to printers otherwise its function is acedemic and can be controlled independantly of every other pin.
To get access to the IO ports eg 0x378-0x37C you need a kernal mode driver. Search google for "UserPort.Zip"
Once this is running you can quickly test your port by using the following:
Start > Run > "Debug"
at the - type
O378,xx (where xx is the byte you wish to write to pins 2 to 9)
and type
q
to quitThen you can write ASM once you have got familiar.
hope this helps
HRF!!

![]() |
Batch file interval timer
|
Batch File to clean folde...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |