4.3.2 Write Data command

The Write Data command writes data to an EM405D control register or to a register residing on an M-module. The command consists of seven bytes including the command-id, the module to which the data should be written, an address space selector, the access width, the address, and two data bytes. The return value consists of a single status byte.

Command Syntax:

0x20 md as ws ad dh dl

Return:

SC

where

md = module (0 = EM405D control, 1 = M-module A, 2 = M-module B) as = address space (0 = I/O, 1 = future use)

ws = word size (2 = 16-bit word, other values for future use) ad = address (0 to FF)

dh = data (MSB) dl = data (LSB) SC = Status Code

Example (values shown hex):

To write the data value 0x1234 to M-module A, send the following command:

Command:

cd

md

as

ws

ad

dh

dl

Send:

20

01

00

02

06

12

34

Receive: 00 (if successful)

4.3.3 Read Data command

The Read Data command reads data from an EM405D control/status register or from a register residing on an M-module. The command consists of five bytes including the command-id, the module from which the data should be read, as address space selector, the access width and the address from which to read. The return value consists of two data bytes followed by a single status byte.

Command Syntax:

0x30 md as ws ad

Return:

dh dl SC

where

md = module (0 = EM405D control, 1 = M-module A, 2 = M-module B) as = address space (0 = I/O, 1 = future use)

ws = word size (2 = 16-bit word, other values for future use) ad = address (0 to FF)

dh = data (MSB) dl = data (LSB) SC = Status Code

19

Page 25
Image 25
CH Tech EM405D user manual Write Data command, Read Data command