Re: new libraries to access serial ports

new topic     » goto parent     » topic index » view thread      » older message » newer message

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

oguim said...

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.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu