Communication problem in serial port


Thread Starter



I found some C source for Win DOS here, and I use it, it works, but... The only problem, that when I open the Com port, and try to communicate, it works only if I tested the peripherial with some other Modbus tester before I run my program. So If I use some free tester, and then close it, I can receive message from the Modbus devices, but if I don't do this first, and run my program, it opens the Com port and sends the message, but can't receive anything from the slaves. It's obvious, that I don't do something, what is required.

Please, help me. :)

Curt Wuollet

Sounds as if the port is not being set or reset when you go into dos mode. I don't know if the MODE command works in the DOSBOX but you could try it before you run your code or explicitly set up the port if you have the code to do that. The free tester sets up the port for you and you are fine. Windoze mode must be leaving it set differently or maybe not at all.


In a DOS frame of mind for today.
Your free source code does as advertised. Although it does not set up the port, commuication speed, etc. It seems that the "tester" does just that.