Elmomc CANopen DS 301 Implementation Guide Manual do Utilizador Página 118

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 118
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 117
Appendix A: Little and Big Endians
The “end” in “endians” refers to the address of the most significant or least significant
byte in a multiple-byte data type (such as short, long or float). The address of big endians
is the most significant byte (the “big” end) while the address of little endians is the least
significant byte (the “little” end).
Example using standard C conventions:
long lType;
short sType[2]
char cType[5] = “ABCD”;
lType = 0x12345678;
sType[1] = 0x1234 ;
sType[2] = 0x5678 ;
Memory structure: big endians (starts with MSB):
00 08
12 34 56 78 - lType
12 34 56 78 - sType
AB CD 0 - cType
Memory structure: little endians (starts with LSB):
00 08
78 56 34 12 - lType
34 12 78 56 - sType
AB CD 0 - cType
The CANopen protocol supports the little endian method; for example, a node replies to
a TPDO with three objects:
Object 1: Signed24 - 0x12ABCD
Object 2: Unsigned32 - 0x123456AB
Object 3: Unsigned8 - 0x1F
The CAN octet will be as follows:
CD AB 12 AB 56 34 12 1F
CANopen DS 301 Implementation Guide Initial CAN Communication Setup
MAN-CAN301IG (Ver. 2.1)
A-1
Vista de página 117
1 2 ... 113 114 115 116 117 118

Comentários a estes Manuais

Sem comentários