Writing to COM port

Started by
2 comments, last by Sand_Hawk 21 years, 11 months ago
For an schoolassignment we have to control a LED and a button via the COM(RS232) port. The teacher didn't provide any info on how to send data to certain pins of the COM port. We tried to ask our big friend google but he didn't came up with much info either. The pins we would like to send data to are: LED: RTS TxD Button: CTS DSR According to some info others provided these pins can be used for the task. Does anyone knows how to send/read data from these pins? I already have the realtime loop done. [EDIT] Whoops, bad english. Fixed it a bit. [/EDIT] Sand Hawk ---------------- -Earth is 98% full. Please delete anybody you can. [edited by - sand_hawk on June 12, 2002 3:29:27 AM]
----------------(Inspired by Pouya)
Advertisement
On windows you can open the COM ports like files
- HANDLE hCOM1 = CreateFile("COM1"...);
and read and write to them in the same fashion. There''s a bit more involved than that, but hopefully that will renew your google search. Other API''s to note: PurgeComm, SetupComm, ClearCommError, FlushFileBuffers, GetCommState, SetCommState, GetCommTimeouts, SetCommTimeouts.
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
Can you give me some examples on how to write to the pins?

Sand Hawk


----------------
-Earth is 98% full. Please delete anybody you can.
----------------(Inspired by Pouya)
You''re being extremely vague about it, but the Serial-HOWTO might be of interest.

This topic is closed to new replies.

Advertisement