Writing to COM port
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]
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.
- 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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement