Re: new libraries to access serial ports
- Posted by jacques_desch Jul 06, 2009
- 3080 views
Sorry oguim for late answer.
Thanks for reporting this problem, I tested CommConfigDialog() and as you report it doesn't work.
I read the following on MSDN http://msdn.microsoft.com/en-us/library/aa363187%28VS.85%29.aspx
Remarks
The CommConfigDialog function requires a dynamic-link library (DLL) provided by the communications hardware vendor.
I didn't pay attention to it before.
You should use SetCommState() instead.
integer hComm procedure init_comm(integer comm_port,sequence comm_params) hComm = serial_open(comm_port) if hComm = -1 then puts(1,"serial_open failed\n") abort(1) end if SetCommState(hComm,comm_params) SetCommTimeouts(hComm,{1000,1000,10,1,1}) PurgeComm(hComm,PURGE_TXCLEAR+PURGE_RXCLEAR) end procedure init_comm(4,"baud:19200;parity:none;stop:1;control:none")
jacques
Thank you for your prompt answer.
Yes, I tried to use comm config dialog, called by a button. It seems to work, cause the dialog opens...it seems to take the changes to the baud rate, bytes, etc...but when I call it again ,the configuration stays as it was before.... I tried to check by the mode com1 on the command line...also shows no changes...
will you please send me a sample of the simplest program that uses the serial port, so I can check if I am doing something stupid?
Thank you.