I have inherited an application made in Gambas and I am getting into the world.
this application communicates with various peripherals through RS-485. In PC it has an RS-485 to RS-232 converter (it does not go via USB). Peripherals act as slaves (they only answer questions from the PC). The thing is that between one frame and another, I have a delay of 50ms. If I put traces in the code, I see that in the same millisecond that I receive the response of a frame, the next one is sent, but if I connect the oscilloscope, between the response frame and the next question I have a sleep time of 50ms.
That is, according to traces in the code I have the following times:
000ms: request frame is sent
055ms: the request frame was just sent
110ms: first bytes of response frame begin to be received
150ms: reply frame just received
150ms: question frame 2 is sent
According to the oscilloscope the times are:
000ms: start request frame
040ms: end the request frame
050ms: start of response frame
090ms: reply frame ends
150ms: start question frame
In sending, there is already a difference of 15ms between what it takes to send and the actual transmission time of the frame, but between the end of the response frame and the next question begins, there is a gap of approx. 50ms.
To send I do it like this:
Code: Select all
_serial.Begin()
Write #_serial, s
_serial.Send()
Flush #_serial
The application runs on Debian 9.
Any idea where I may be missing this 50ms and how to correct it?
Thank you.