Windows, multiple serial ports, conflicts

Hi all.
I have a system that uses three serial ports. Currently, for it to work, I can only actually use one at a time. The symptom is that all the serial port activity seems to get routed to whatever port was last opened. The serial port class uses the createfile method.
I'm using a fairly generous timer call back to check for replies, so not (yet) worrying about any waitonevent , or overlapped i/o in general.

Anybody experienced similar? I'm pretty sure it's something silly....



You can safely assume that windows handles the ports correctly. Hence the problem is within your program. Timers are not that trivial.
Thanks, coder 777

yes, the assumption is that the problem is within my program. I had hoped it was a common
mistake, with a clear symptom, that more experienced programmers would recognise right away. The appearance of the behaviour is similar to that that might occur if static items are in the header file.... the handles appear to be not unique. But, as you say, I can safely assume that windows handles the port correctly.
The timers can be considered trivial in this context, the test code is a pretty rigid state machine,
the same timer callback drives the same state machine, all the other functions are behaving correctly, so I am happy to discount that. I can safely assume that windows handle the timers correctly?

Cheers

PB

I can safely assume that windows handle the timers correctly?
Yes, but one problem may occur: It may be called recursively if the function doesn't finish in time (the next period) and windows events are possible (such as a dialog within the timer event).

Global variables are always problematic and state machines are usually not a good idea.
Topic archived. No new replies allowed.