RS-232 data mixed up

8 years 1 month ago #29527663 by jwj27
RS-232 data mixed up was created by jwj27
I have a few SDC2130 controllers running a MicroBasic script, which is continuously sending encoder position and sensor data over RS-232. The controller is connected to a PC running a C# program, that receives this information and sends commands back to the controller.
The problem here is that the data sent by the script and data sent by the controller itself are sometimes mixed up together. For example when the PC program sends a command like \"!VAR 4 100[CR]\" and the controller echoes this back, and the script sends \"C=123:456[CR]\" at the same time, the PC will receive something like \"!VAC=123:456[CR]R 4 100[CR]\". Now obviously this will make no sense to the parsing function and it will throw errors.

Could this be a bug in the firmware?

Please Log in or Create an account to join the conversation.

8 years 1 month ago #29527665 by roboteq
Replied by roboteq on topic Re:RS-232 data mixed up
The controller will output data on the last port from which data has been received.

In your case, since you have USB connected, the PC is sending periodic queries in order to update the roborun screen. At that point, further data sent from microbasic will go to USB.

If you send data to the controller via serial port, then the microbasic data AND the data that is used to update the Roborun screen is sent on the serial port.

In future versions of the fimware we will create a separation between the two streams but for now there is no way around it.

Please Log in or Create an account to join the conversation.

Moderators: tonysantoni
Time to create page: 0.153 seconds