[Date Prev][Date Next][Thread Prev][Thread Next] - [Date Index][Thread Index][Author Index]

Re: Exercising a serial port

At 02:09 PM 10/20/2003 +0000, Alan P. Biddle wrote:

>Has anybody come across a program which allows you to raise and lower the
>individual lines on a serial port?  I am looking for something to check out
>some lines that are being used for discrete outputs.  Not that hard to
>write, but before I reinvent the wheel, I wanted to see if it had already
>been done.

Hi Alan!

You can do this by using the "DEBUG" command directly
on your PC. Type "debug" at the dos prompt or from
the "Run..." Dialog box under Windows to start it up.
At the debug prompt, use the output command.
The structure is:


where "o" is the letter o, IOADDRESS is the register
address of the uart, and HEXVALUE is your desired value
in hex.

For COM1, the address is 03fc for the modem control leads.
For COM2, the address is 02fc for the modem control leads.

The hex value is the bits that you want to send to the
port. The modem control leads are:

  //***** Modem Control Register *********************
          MODEMCONTROL_CLEAR   = 0x00,     // all leads off
          MODEMCONTROL_OUT2    = 0x08,
          MODEMCONTROL_OUT1    = 0x04,
          MODEMCONTROL_RTS     = 0x02,
          MODEMCONTROL_DTR     = 0x01,

(If you have InstantTune, you can look in uartdrv.hpp for
a complete list.)

So, to set DTR on COM1 to ON, type

o 03fc 01

To turn it off, type:

o 03fc 00

To turn on RTS on COM2 type:

o 2fc 02

to quit, type "q" and return.

Tony AA2TX

Sent via amsat-bb@amsat.org. Opinions expressed are those of the author.
Not an AMSAT member? Join now to support the amateur satellite program!
To unsubscribe, send "unsubscribe amsat-bb" to Majordomo@amsat.org