serial communication format

hapetter

Member
Join Date
Feb 2009
Location
Kristiansand
Posts
58
Hi
Im new to serial communication. I try to understand how to reed and write to a serial device from a PLC. I use Beckhoff PLC with RS232 port and serial com library.

In the datasheet of the device they say that output is ASCII and in this format: (This is a distance)
[DD]D.DD<CR><LF>
In this configuration, each sample consists of a string of characters as follows: 4
to 6 distance followed by <CR><LF>. characters (possible values from 0.00 to
999.99 inches in 1/100ths of an inch in English output, or 0 to 99999 mm metric)​
Values enclosed in [] will not appear if they consist only of leading zeros.

  1. So how can this be understand? and how can it be read by a read block? What kind of read block would I use: I have receive byte and receive string available...
  2. I belive i must use string right? How will that string look like after receiving a number? will it include <CR><LF>,? what ecsactly are thouse?
  3. There are several other readings like this one:
ASCII Data format, Low Level Sensor Outputs Only​
[​
RRRRRR]R<TAB>[SSS]S<TAB>[AAA]A<TAB>[TTT]T<CR><LF>
In this configuration, each sample consists of characters as follows: 1 to 7 range
characters (possible values from 0 to 4.19 million, decimal format), SPACE, 1 to
4 signal strength characters (0 to 1023), SPACE, 1 to 4 ******t light level
characters (0 to 1023), SPACE, 1 to 4 sensor temperature characters (0 to 1500 in

0.1
oF per unit), <CR><LF>.

How can I decide witch one is what? like saving in two different strings...

Now I like to send a ASCII code to the sensor: one of its settings are:
Set Sample Interval​
3-8 bytes ASCII Code: S<Interval>
(20 <= Interval <= 9999999)​
Input switch code: 8<Rate Code>

How to do this? just send a string like "S9999999" or S<9999999>
What do they mean by input switch code?


Sorry for this basic questions, but I like to understand this:)


Thanks!

Best regards
Han sPettersson




 
Hi Han,

I am doing the same task. I am trying to read out the temperature through RS 232 communication in Beckhoff PLC.

First of all ,you have to use fast track programme which can exachange
the Input and Output through your terminal(which should define in Twin CAT system manager as priority task).

Second, You need to send string and receive string (Just to understand the formate).

That might be can help.

Be aware, which module you are using and which data types with defalut function blcok you are using to communicate .That's really important.

But i have now problem that I am not able to read out the data correctly.


Hope it can help you.
 
<CR><LF>,? what exactly are those?

<CR>, <LF> and <tab> are control characters

<CR> = carriage return = a control character which sends the typewriter's carriage or printer's print heax or terminal's cursor back to home position, or the left margin = hex D or decimal 13 in ASCII​

<LF> = Line Feed = control character which sends advances the typewriter's or printer's paper feed mechanism or the terminal's cursor to the next line = hex A or decimal 10 in ASCII​

<Tab> = control character = hex 9 or decimal 9 in ASCII​

The greater than/less than brackets that enclose the data are for documentation purposes, but are not part serial data string.

So an ASCII tab character shown in the data string as <Tab> would be a binary 00001001 byte, hex or decimal 09​

For the distance, I suspect that it is formatted for a terminal or printer output.​

The [DD]D.DD<CR><LF> format would, for a distance of 5376 mm, for example, probably be shown on a terminal as​

5367​

_​


with the terminal's cursor waiting on the next line like the underscore <_> shows above.​

So, 5367<CR><LF> appears to your serial receiver as an ASCII hex string: 35 33 36 37 0D 0A​


SPACE, 1 to 4 ******t light level
This forum edits the word a m b i e n t, substituting asterisks ****, because a m b i e n is a pharmaceutical drug.​

[ RRRRRR]R<TAB>[SSS]S<TAB>[AAA]A<TAB>[TTT]T<CR><LF>

The <Tab> character separates the data values into columns for printer or terminal use. It can be used to separate one data value from the next.​


How to do this? just send a string like "S9999999" or S<9999999>
If the sampling interval is 8000, then the serial string is S8000 in ASCII.​

Hex 53 38 30 30 30 30​


What do they mean by input switch code?
This input switch is specific to the device, whatever the input switch does.​
 

Similar Topics

Currently,we are facing the communication go through with 422 tx+ and tx-. Mitsubishi fx5u series is used and using command rs2. But the package...
Replies
0
Views
111
I have wasted a week trying to figure out how to connect an SLC5/03 with my laptop. I do not have and can not Buy the 1747 UIC and PC3 cables. I...
Replies
14
Views
2,570
MELSEC A RS422 (25pin) <> iQR C24 Serial RS232 (9pin) - Simple PLC Communication Communication from a MELSEC-A Series CPU (RS-422 – DB 25 Pin)...
Replies
4
Views
1,053
Hey guys, I have a problem reading weighing data from AND AD4406 with OP-05 RS-232C Relay and Control input using Rockwell PLC Micro820. I already...
Replies
0
Views
949
I have a zebra barcode scanner connected to a ******* device master UP. They are connected by RS232. By checking the serial logs on the device...
Replies
3
Views
1,144
Back
Top Bottom