News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

The use of IN/OUT instructions

Started by seaview, November 14, 2007, 08:30:53 PM

Previous topic - Next topic

seaview

I would like to send the computer a signal from remote location then have to computer output a signal via a port which would activate a relay which in turn could switch on a light or start a motor etc. I think I know how to build the external circuitry but I cannot get the IN / OUT instruction to work in the computer.  If I program 'in al, 8' or 'out 8,al' the computer brings up an error.
     Can anyone give me some advice on how to carry out my task or point me to a tutorial on IN/OUT.
     Many thanks in anticipation.

Mark Jones

Hi Seaview, IN/OUT are not available for use in typical Windows applications nowadays. (They are available in 16-bit DOS applications, however.) If using the MASM assembler as your "programming language", you have basically three options:

1. Code a DOS application with IN and OUT (and ask this question in the DOS subforum here.)
2. Learn Four-F's Kernel-Mode Driver Kit (tutorial, search google) and build a WDM driver to access the port in Windows (2K/XP.) Possibly for Vista, however check their policy on third-party driver digital signing requirements.
3. Use a third-party driver to access the port(s) directly in Windows.

The third option is arguably the easiest, and more can be found out about that method by searching this forum for "WinIO."

Welcome to the board. :U Have you registered here before?
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

seaview

G'day Mark,
                It was very kind of you to take the time to answer my query. I'm just a beginner but am an old bloke and have trouble understanding computer talk.
Thanks once agen

seaview

GregL

Just a note about Vista and WinIO, programs that use WinIO will work but you need Administrator privileges to load WinIO itself.


u

On a similar note, do you know if with drivers you can update the LPT's data much faster than 1 microsecond? With the inpout32.dll  it takes 1us, and even worse - there are hiccups in the data, the LPT's pins sometimes don't get updated. I experienced those hiccups in the following synchronous protocol (x86 app sending data to a uC) : the uC initially sets the ACK pin low, meaning "uC ready for receive". My x86 app then sends 1 byte in parallel and toggles a 9th bit, to show data has been sent. The uC reads the data, sets ACK pin high. Meanwhile the x86 was waiting for this high pin, and now starts waiting for it to go low (to start sending the next byte). In this setup the speed wasn't important, just the correct transmission of a few bytes. Yet, the whole thing was locking up at rare occasions. My code wasn't giving any chance for lock-ups, so I think the SuperIO chip on my motherboard simply ignores commands during task-switching/interrupts. Adding loops to re-upload the same LPT pin-data 2+ times was the only way to make this protocol work. Is there something I'm missing?
Since then I've changed the protocol to be completely one-sided, causing interrupts in the uC, and double-sending output commands to the LPT in my x86 source >_<
Please use a smaller graphic in your signature.

GregL

Ultrano,

If you are asking me, sorry, I don't know.