^NyAw^
9th January 2008, 13:08
Hi,
I'm developing an application that uses "QextSerialPort".
I have implemented the RTU Modbus protocol.
What I do is like:
-Start a timer(interval 500ms) that when the SLOT is called, send a request to a Modbus Slave, start another timer to wait for a response
-When the second timer triggers I read from Serial Port. Here always is there data because this timer is long enough. I don't really know why setting the time-out of the RS-232 i.e. 50 milliseconds and then calling directly "read" from it don't get me data(it has no data yet).
-Then I package the data(char*) to a "CModbusResponse" and I emit this response throught a signal because this is the RTU Transport Layer and RTUModbusMaster will be the reciver of the response to do something with the response.
Also I have 2 threads that capture images and process images. The timers are started by the main thread.
If I execute the program without debuggin it, it seems to not work properly: it sends the requests but the second timer that will call the slot to read from RS-232 is not working(or it seems to not).
If I insert debug points, It seems to work well. I'm sure that is working because I'm a Modbus MASTER that sends requsests to a Modbus SLAVE that have some LEDs showing the Digital Outs status(those are what I'm changing with the Modbus request).
I know that is a bit complicated what I'm explaining but your help will be wellcome.
I'm using Qt 4.3.0, QextSerialPort, Visual Studio 2003 .NET, Windows XP SP2
Thanks,
I'm developing an application that uses "QextSerialPort".
I have implemented the RTU Modbus protocol.
What I do is like:
-Start a timer(interval 500ms) that when the SLOT is called, send a request to a Modbus Slave, start another timer to wait for a response
-When the second timer triggers I read from Serial Port. Here always is there data because this timer is long enough. I don't really know why setting the time-out of the RS-232 i.e. 50 milliseconds and then calling directly "read" from it don't get me data(it has no data yet).
-Then I package the data(char*) to a "CModbusResponse" and I emit this response throught a signal because this is the RTU Transport Layer and RTUModbusMaster will be the reciver of the response to do something with the response.
Also I have 2 threads that capture images and process images. The timers are started by the main thread.
If I execute the program without debuggin it, it seems to not work properly: it sends the requests but the second timer that will call the slot to read from RS-232 is not working(or it seems to not).
If I insert debug points, It seems to work well. I'm sure that is working because I'm a Modbus MASTER that sends requsests to a Modbus SLAVE that have some LEDs showing the Digital Outs status(those are what I'm changing with the Modbus request).
I know that is a bit complicated what I'm explaining but your help will be wellcome.
I'm using Qt 4.3.0, QextSerialPort, Visual Studio 2003 .NET, Windows XP SP2
Thanks,