Link to home
Start Free TrialLog in
Avatar of hoosang
hoosang

asked on

Need to write a DOS program that sends string to COM port!

I need a sample DOS program written in C to send 3 byte string to COM port1 or 2.

Does anyone have a sample code about this issue?

I need the following functions to

open a port
send 3 byte string to a port and wait for return respond
close the port that has been opened.

ASKER CERTIFIED SOLUTION
Avatar of alexo
alexo
Flag of Antarctica image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of manjucee
manjucee

Hi,
          You can use inport and outport functions defined in dos.h header file.
>> You can use inport and outport functions defined in dos.h header file.
inport() and outport() perform I/O from the *processor* ports, not the serial ports.
Hi alexo,
                      I   think we can use inport and outport for serial ports also by specifying their address or port ID . isn't it.
     
Not really.  Although there are processor ports corresponding to the serial ports, there is a protocol involved.  You cannot just dump/read the data using in/out instructions and expect it to work.