26
4.6.4.2
Block Read command
The Block Read command reads a block of data from an M-Module. 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 twelve command bytes. The return value is the requested
number of data bytes followed by a single status byte indicating the success of the command.
Note that even if the command fails due to no M-Module response, the requested number of
bytes will be returned; however, the data values will not be valid. The status byte will indicate
the failure.
Command Syntax:
0x55 md as ws au am al iu il bu bl bs
Return:
d1
u
d1
l
... SC
where
md
= module (0 = EM405-8 control, 1 = M-Module 0, 2 = M-Module 1, …)
as
= address space (0 = I/O, 1 = future use)
ws
= word size (2 = 16-bit word, other values for future use)
au
= starting address upper
am
= starting address middle
al
= starting address lower
iu
= address increment upper (number to increment address after each read)
il
= address increment lower (number to increment address after each read)
bu
= number of blocks to read upper
bl
= number of blocks to read lower
bs
= block size in words (i.e., number of words per block)
d1
u
= data upper (MSB)
d1
l
= data lower (LSB)
...
= the number of data bytes = ws
bs
number of blocks
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 1, send
the following command:
Command:
cd md as ws au am al iu il bu bl bs
Send:
55 02 00 02 00 00 06 00 00 00 03 02
Receive:
da1
db1
dc1
dd1
da2
db2
dc2
dd2
da3
db3
dc3
dd3
00 (if successful)
Receive:
d1
u
d1
l
d2
u
d2
l
d3
u
d3
l
d4
u
d4
l
d5
u
d5
l
d6
u
d6
l
00 (if successful)
where
d1
u
, d3
u
, d5
u
= MSB of register 6
d1
l
, d3
l
, d5
l
= LSB of register 6
d2
u
, d4
u
, d6
u
= MSB of register 8
d2
l
, d4
l
, d6
l
= LSB of register 8
Note: d1 is first read, d2 is second read, d3 is third read, and so on.
C&H Technologies, Inc. <> 445 Round Rock West Drive <> Round Rock, Texas 78681 <> www.chtech.com