CAN
CX8050, CX8051 - Embedded-PCs for
CANopen and CAN
122
Version: 1.4
Reading the register value
The coupler must first be informed of which register is to be read. This requires an SDO write access to the
appropriate index/sub-index combination, with:
- channel number (access bit = 0) in byte 3
- register address in byte 2 of the 32-bit data value.
Bytes 1 and 0 are not evaluated if the access bit (MSB of byte 3) equals 0. The register value can then be
read with the same combination of index and sub-index.
After the writing of the register address to be read, the coupler sets the access bit to 1 until the correct value
is available. Thus an SDO read access must check that the table number lies in the range from 0...0x7F.
An access error during register communication is indicated by the corresponding return value in the SDO
protocol (see the SDO section, Breakdown of parameter communication).
An example of reading register values
The thermocouple type to which the second input channel of a KL3202 Thermocouple Input Terminal has
been set is to be determined. This requires feature register 32 to be read. The terminal is located in the fifth
slot, next to the Bus Coupler. This means that the following SDO telegrams must be sent:
Write access (download request) to index 4501, sub-index 5 with 32 bit data value 01 20 00 00 (0x01 = 2nd
channel, 0x20 = register 32)
Id=0x600+Node-ID DLC=8; Data=23 01 45 05 00 00 20 01
Then a read access (upload request) to the same index/sub-index. The data value sent here is irrelevant
(0x00 is used here).
Id=0x600+Node-ID DLC=8; Data=40 01 45 05 00 00 00 00
The coupler responds with the upload response telegram:
Id=0x580+Node-ID DLC=8; Data=43 01 45 05 06 31 20 01
This means that the feature register contains the value 31 06. The upper 4 bits indicate the thermocouple
type. Their value here is 3, which means that PT500 is the type that has been set for this channel (see the
KL3202 documentation).
Writing register values
SDO write access to the corresponding combination of index and sub-index with:
- channel 0x80 (access bit = 1) in byte 3
- register address in byte 2
- high byte register value in byte 1
- low byte register value in byte 0 of the 32-bit data value.
Attention
[Gefahrinformation hier einfügen!]
WarningIf the write protection is not removed (as a result, for instance, of a faulty code-
word), then although a write access to the terminal register will be confirmed (SDO down-
load response), the value is not in fact entered into the register. It is therefore recom-
mended that the value is read back after writing and compared.
Remove terminal write protection
Before the user registers in the Bus Terminal (register 32-xx, depending on terminal type or extension
module) can be written to, it is first necessary for write protection to be removed. The following codeword is
written for this purpose into register 31 of the channel concerned:
Write protection
Channel
Register
Value
Corresponding
SDO download
value (0x4500/0)
1,2, 3 or 4
31 (0x1F)
4661 (0x1235)
8y 1F 12 35 (y =
channel number)
Содержание CX8050
Страница 2: ......