• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Serial Comm. OSI Layer 2 question

Status
Not open for further replies.

gar3555

Diamond Member
I am working on a driver for a device at work, and I can't get the serial communication layer to work. The manual is very little help, and I am very rusty at this stuff. Here is what the manual says about the message:

Here is the message representation as seen at the output of the data-link layer :-
(STX)G(VALUE)M(VALUE)(COMMAND)[(COMMAND)...](ETX)(CRC)

1. The message starts with STX (HEX 02) indicating start of message.

2. G and M are identifiers that are contained in every message.

3. (COMMAND) is made up of (IDENTIFIER)(VALUES LIST).
(IDENTIFIER) is one of a series of letter or letter-number combinations detailed in the tables below.
(VALUES LIST) are decimal values, with leading-zero suppression (unless otherwise specified),
separated by comma’s and terminated by the next command or ETX.
Note that more than one (COMMAND) may be sent in a single message.

4. The message ends with ETX (HEX 03) indicating end of message.

I understand the STX, ETX and command parts, but I am a bit hazy on the bolded B and M commands, it just says they are identifiers, but I am not sure of the value to put in them. I have guessed a couple of things, but no go.
 
Most likely it is number of messages and total length of message (That would be my guess).

I would hazard to say the m is number of messages and g is total message length (but could be way off here)
 
Might this be the device ?

http://food-processing-equipment.biz/pdf/fpe_ME07071safelinecontrolManualPowerphasePlus.pdf


page 118

Specification of the serial link.
This is specified in accordance with the ISO ‘Open-Systems-Interconnection’ (OSI) layered model for
communications systems.
Physical layer specification (OSI layer 1)
The physical layer is based on the RS232 voltage levels.
3 wire connection with no hardware flow control.
1 start bit
7 data bits
1 odd parity bit
1 stop bit
Transmission rate 9600 baud
Note.
The maximum recommended RS232 cable length is 15 meters.
Data-link layer specification (OSI layer 2)
Here is the message representation as seen at the output of the data-link layer :-
(STX)G(VALUE)M(VALUE)(COMMAND)[(COMMAND)...](ETX)(CRC)
1. The message starts with STX (HEX 02) indicating start of message.
2. G and M are identifiers that are contained in every message.
3. (COMMAND) is made up of (IDENTIFIER)(VALUES LIST).
(IDENTIFIER) is one of a series of letter or letter-number combinations detailed in the tables below.
(VALUES LIST) are decimal values, with leading-zero suppression (unless otherwise specified),
separated by comma’s and terminated by the next command or ETX.
Note that more than one (COMMAND) may be sent in a single message.
4. The message ends with ETX (HEX 03) indicating end of message.
5. This is followed by a cyclic redundancy code (CRC) of the characters contained between STX and ETX
inclusive.


What cogman writes is correct :
page 122 :

‘G’ n ; in/out Message Length
The number of characters, (or bytes), from after ‘G’n to (but
excluding) ETX in every communications message.
n = A two digit number with leading zeroes, in the range [0..99].
For example, the host transmission of the ‘a?’ command.
The message format, (assuming XXXX = 4 digit message
number), would be :-
(STX)G07MXXXXa?(ETX)(CRC)
where:
G is the message length identifier, and where
n=07 is the total number of characters in the ‘MXXXXa?’ part
of the message.

page 123:

‘M’ n ; in/out Message number.
n = A four digit number, with leading zeroes, in the range
[0..9999].
This number is incremented for each message sent,
(wraparound to zero). The detector will treat consecutive
messages with the same message number as being a repeat
of each other.
 
Status
Not open for further replies.
Back
Top