EasyManua.ls Logo

Omega DPF20 Series - Frame Examples; CRC Calculation

Omega DPF20 Series
40 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
33
DPF20
Frequency, rate, total or period counter
Instruction Manual
The ‘frame value’ for the CRC byte is calculated applying a XOR func-
on to the ‘frame value’ (see secon 2.4.5) of all bytes in secons
‘Header’ and ‘Data’, from byte ‘0’ (‘STX’) to the last data byte (‘Dn’).
• if the calculated CRC value is lower than ‘32’, it is normalized by ap-
plying the ‘one’s complement’ funcon .
CRC0=STX ^ ID ^ RSV ^ FROM ^ TO ^ REG ^ RSV ^ LONG ^ D0 ^...^ Dn
• if (CRC0<32) -> CRC=!CRC0 (one’s complement funcon)
• if (CRC0>31) -> CRC=CRC0
//example of CRC calculaon in C language
int8 Calculate_CRC(int8 CRC_Posion)
{
int8 i,CRC=0;
for(i=0;c<CRC_Posion;c++)
{
crc=crc ^ frame[i];
}
if(crc<32) CRC=~CRC;
return(CRC);
}
Header Trail
STX ID RSV FROM TO REG RSV LONG CRC ETX
2 32 32 32 54 32 32 32 52 3
Start Ping --- 0 22 0 --- 0 CRC Stop
Header Trail
STX ID RSV FROM TO REG RSV LONG CRC ETX
2 33 32 54 32 32 32 32 53 3
Start Pong --- 22 0 0 --- 0 CRC Stop
Example - ‘Master(address ‘0’) requests conrmaon of existence to
the ‘Slave’ at addrress ‘22’ (‘PING’ frame) and the ‘Slave’ replies to
the ‘Master’ with a ‘PONG’ frame.
Frames ‘PING’ (32) and ‘PONG’ (33)
2.4.7 Frame examples
Frames ‘RD’ (36) and ‘ANS’ (37)
Example - ‘Master(address ‘0’) requests the value of register ‘0’ (dis-
play value) to the ‘Slave’ at address ‘28’ (‘RD’ frame) and the ‘Slave’
replies to the ‘Masterwith a reply frame (‘ANS’ frame) containing
the requested data (765.43).
Header Trail
STX ID RSV FROM TO REG RSV LONG CRC ETX
2 36 32 32 60 32 32 32 58 3
Start RD --- 0 28 0 --- 0 CRC Stop
Header Data Trail
STX ID RSV FROM TO REG RSV LONG D0 D1 D2 D3 D4 D5 D6 D7 CRC ETX
2 37 32 60 32 32 32 40 43 48 55 54 53 46 52 51 15 3
Start ANS --- 28 0 0 --- 8 +0765.43 CRC Stop
Frames ‘ERR’ (38)
Header Trail
STX ID RSV FROM TO REG RSV LONG CRC ETX
2 38 32 43 32 33 32 32 46 3
Start ERR --- 11 0 1 --- 0 CRC Stop
Example - ‘Slave’ at address ‘11’ replies to the ‘Master’ (address ‘0’)
with an error frame (‘ERR’ frame) indicang that the requested regis-
ter number is unknown (‘UNKNOWN_REGISTER’, error code ‘1’). The
*Instruments with 4 digits also send reading values formaed with 6
digits : value -321.5 is transmied as -00321.5
error code is codied into the ‘REG’ byte. For a list of error code see
secon 2.4.6.
2.4.8 CRC calculaon

Table of Contents

Related product manuals