Dark Bit Factory & Gravity

PROGRAMMING => Freebasic => Topic started by: stefan63 on March 16, 2007

Title: COMport(RS232) help needed(under Freebasic)
Post by: stefan63 on March 16, 2007
Hello people,
Until now i worked under DOS only (TurboPascal) and for my (RS232) purposes i used
direct port access. Under WinXP and with FreeBasic i want to use standard access
"OPEN COM ....." , but this is too new for me.  What confuses me:
  - how i can check is or not new byte arrived(under DOS i have interrupt)? Or here is another principle?
  - when sending - can i send byte by byte (and how to check is sended or still not  previous byte, under DOS i use interrupt)? Or i must output to "file" whole packed?
  - If "OPEN COM" is for opening , which command is for port closing - "CLOSE filenum" ?
Thank You and regards,
Stefan


 
Title: Re: COMport(RS232) help needed(under Freebasic)
Post by: Jim on March 16, 2007
Under XP you'd use the OpenFile/ReadFile API to do serial comms.  There's no interrupt, you either wait for data to arrive or you use the 'overlapped' structure and poll for data arriving.

MSDN article on serial coms for win32.
http://www.tetraedre.com/advanced/files/msdn_serial.htm (http://www.tetraedre.com/advanced/files/msdn_serial.htm)

Jim