CH Tech EM405D Network Router User Manual


 
22
4.3.4.2 Block Read command
The Block Read command reads a block of data from an M-module. Unlike the block write
command, block read does not have a restriction on the number of bytes that can be read with a
single command. The number of bytes read in any given command is equal to:
number of bytes = number of blocks * block size * word size
The block read command consists of nine command bytes. The return value is any number of
data bytes followed by a single status byte indicating the success of the command.
Command Syntax:
0x50 md as ws ad ai nh nl bs
Return:
d1 d0 ... SC
where
md = module (0 = invalid, 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 = starting address (0 to FF)
ai = address increment (number to increment address by after each write)
nh = number of blocks to read (upper 4 bits)
nl = number of blocks to read (lower 8 bits)
bs = block size in words (i.e., number of words
per block)
d1 = data (MSB)
d0 = data (LSB)
= the number of data bytes = ws bs number of blocks (nh:nl)
SC = Status Code
Example (values shown hex):
To read three data values from a 32-bit FIFO located at I/O Register 6 and 8 on M-module B, send
the following command:
Command: cd md as ws ad ai nh nl bs
Send: 50 02 00 02 06 00 00 03 02
Receive: da1 db1 dc1 dd1 da2 db2 dc2 dd2 da3 db3 dc3 dd3 00 (if successful)
where
dax = MSB of register 6
dbx = LSB of register 6
dcx = MSB of register 8
ddx = LSB of register 8
Note: x = 1 is first read, x = 2 is second read, x = 3 is third read