Electronics > Beginners
Interpreting the data from RS232?
(1/2) > >>
SpannersToSparks:
Hi

I have an application where data is being sent over RS-232 to another computer, and I understand that you can get serial monitors and packet sniffers that will display the raw data being sent. However I am quite new to RS-232 and am not clear on a few things.

How do I actually translate that data into something human understandable? In my application the data will be coming from a weigh scale and I want to just extract e.g. 85.3kg. Do I need some kind of translation software to locate the start bit, data field and stop bit, then translate the data field?

EDIT: Ah ok, its using ModBus RTU ascii protocol, so I guess as long as my monitor can translate that, I am good right?

Cheers
Psi:
You can tap into each of the 2 lines quite easy. Connect one of them to an RX pin on a RS232 serial port of your spying PC.
Then run any of the many free terminal software programs to see the data. (Putty will work but there are better ones for this application)
You will have to either measure the band rate or just take a few guesses until you find it.

If you want to monitor both directions at once you will need two serial ports on the spying PC.
If you want the data in each direction to be synced up in time you may need to find some serial port monitoring software which can monitor two ports at once.
However usually the data on something like this is very simply so monitoring them one at a time is enough.

Make sure your spying PC serial port matches the target.  eg +/-12v RS232 vs 5V UART

MosherIV:

--- Quote ---Ah ok, its using ascii protocol, so I guess as long as my monitor can translate that, I am good right?
--- End quote ---
Yes, that is correct, sort of.
Now you have to understand the formating of the ascii message, we call this a message protocol.

If you do not have any published information about the protocol, you can try to work out what it is.
Start with a known condition, eg no weight on the scale.
See if the same message is being sent.
Now add say 100g and see what the message changes to.
Keep doing this until you figure out what the format is.
SpannersToSparks:
Hi guys

Thanks for the responses. It appears the unit actually has a choice of outputs, so RS-485 with Modbus RTU is available. I see there is a C library available that can create RTU instances https://libmodbus.org/docs/v3.1.6/ as well as a lot of free and paid software.

I should be able to find out the exact "flavour" of protocol if needed from the manufacturer. If using the free offerings or the library, would I still need to determine which version of the RTU protocol is being used and inform the software accordingly?

I can also buy a version that has analog outputs which are apparently popular in industry, but I want to avoid having to implement any further electronics to interpret it at the PC end, hence sticking with the serial. What are the benefits to using the analog over serial, if any? The application is hopper weighing.

Thanks for your help, its really appreciated!
Psi:

--- Quote from: SpannersToSparks on August 22, 2019, 08:12:02 am ---Hi guys

Thanks for the responses. It appears the unit actually has a choice of outputs, so RS-485 with Modbus RTU is available. I see there is a C library available that can create RTU instances https://libmodbus.org/docs/v3.1.6/ as well as a lot of free and paid software.

I should be able to find out the exact "flavour" of protocol if needed from the manufacturer. If using the free offerings or the library, would I still need to determine which version of the RTU protocol is being used and inform the software accordingly?

I can also buy a version that has analog outputs which are apparently popular in industry, but I want to avoid having to implement any further electronics to interpret it at the PC end, hence sticking with the serial. What are the benefits to using the analog over serial, if any? The application is hopper weighing.

Thanks for your help, its really appreciated!

--- End quote ---

Analog will be 4-20mA current output which is a standard for industrial signalling.
Very common for inputs on PLC's.

Because the signal is current it's more immune to voltage spikes that you might get in an industrial environment.
Zero is 4mA so you can detect a fault compared to a signal that is just zero.
It's good for long distance wire runs because current doesn't degrade over distance like voltage does.
Navigation
Message Index
Next page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod