Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Serial programming in C , in DOS

Tags:

c

dos

serial-port

I need to do some basic serial programming in C, in old 16-bits MS-DOS. I know the basics, i had coded some serial comm. in some microcontroller some decades ago, but that's now ancient knowledge, and it's not so easy to find information. I'm looking for some reliable (not necessarily free or open source) library or code, and general information.

I'm also looking for some instructions/advise about how to test it, assuming I'm developing on a Win7 machine. For example, if it would be possible to emulate a null-modem connection from a console terminal in my Win7 machine to a emulated COM port running my DOS program in a DOSBOX environment, or something like that.

like image 206
leonbloy Avatar asked Jan 05 '11 21:01

leonbloy


People also ask

What is serial coding?

Serial refers to the transfer of data one bit at a time. Serial communications include most network devices, keyboards, mice, MODEMs, and terminals. When doing serial communications each word (i.e. byte or character) of data you send or receive is sent one bit at a time. Each bit is either on or off.

How do I enable serial communication?

To configure the Serial Port for your device, on your computer go to Control Panel - Device Manager, select “High-Speed USB Serial Port (Com X)”, right click and select Properties. Click the Features tab. This tab is used to change the COM port number and configure the port.

How does a serial connection work?

In serial communication, data is sent one bit at a time using one signal line, so in order for the receiving side to accurately receive the data, the sending side must know at what speed it is sending each bit.In RS-232C, synchronous communication and asynchronous communication standards have been defined.


1 Answers

What a coincidence. Just finished a college class on low level hardware using it.

These will guide you (rolling your own, no libs, not hard!):

Course slides on serial port

BeyondLogic tutorial on it

Course lab script on the practical project using the serial port

The last one's in Portuguese, but the code samples/tables are commented and with variable names in english.

Good luck.

About emulating. Virtual PC, for example, allows piping of data through a virtual serial port using a text file. Google it. You can also use Windows 98 with DJGPP for compiling this. Use old command.com (which is a self contained dos emulator, basically). You can also restart in MS-DOS.

like image 174
F. P. Avatar answered Sep 27 '22 17:09

F. P.