CH Tech EM405D user manual Number of bytes = number of blocks * block size * word size

Page 27

Example 4: Read 32 words starting at address 0x0 followed by 32 words starting at address 0x80

starting address = 0x0 block size = 32 number of blocks = 2 address increment = 128

4.3.4.1Block Write command

The Block Write command writes a block of data to an M-module. A maximum of 1024 bytes can be written in a single command. The number of bytes written in any given command is equal to:

number of bytes = number of blocks * block size * word size

The block write command consists of nine command bytes and any number (up to 1024) of data bytes. The return value is a single status byte indicating the success of the command.

Command Syntax:

0x40 md as ws ad ai nh nl bs d1 d0 …

Return:

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 × nb SC = Status Code

Example (values shown hex):

To write the data values 0x1234, 0x5678, 0x9ABC to M-module A starting at I/O Register 4, send the following command:

Command:

cd

md

as

ws

ad

ai

nh

nl

bs

dh1 dl1

dh2 dl2

dh3 dl3

Send:

40

01

00

02

04

02

00

03

01

12

34

56

78

9A

BC

Receive:

00 (if successful)

 

 

 

 

 

 

 

 

 

 

 

21

Image 27
Contents H E R N E T Copyright 2004 by C&H Technologies, Inc CopyrightDocument Revision Notice Introduction Operating Instructions Table of Contents General DescriptionInstallation Functional DescriptionList of Tables EM405D Ethernet M-Module CarrierFeatures and Specifications Key FeaturesPurpose of Equipment Maximum Ratings SpecificationsBus Compliance ElectricalMechanical EnvironmentalApplicable Documents Installation Unpacking and Inspection Handling PrecautionsInstallation of M-MODULES MA Configuration Diagram Ethernet Interface Functional Description GeneralPower Conversion Module InterfaceRear Panel Front Panel Front PanelPage Configuring the Ethernet Interface Operating Instructions GeneralIP Address Default subnet mask is Gateway Default gateway address is Port NumbersRecommendation Default setting is Auto-Scan Telnet x.x.x.x Performing the Configuration Wireless Ethernet Wi-Fi Page Table II. Status Code SC Table I. Command SummaryError Handling Communicating with the Carrier and M-MODULESPage Read Data command Write Data commandStarting address + block size * word size Block AccessNumber of bytes = number of blocks * block size * word size 0x50 md as ws ad ai nh nl bs Table III. Register Summary 5 EM405D Configuration/Status RegistersFirmware Version Reset Error & Manufacturer IdentificationDevice Identification Hardware VersionFan Control & Temperature Status Reset & Trigger ControlFollowing values would be invalid Controlling the TriggersFAN and Temperature Control Page Figure A-1 -Pin Dsub Connector Page Table B-1. Ethernet Interface Default Settings Appendix B Wired Ethernet Default SettingsOn Passive Connection True CPU Performance High Page Wireless LAN Settings Table C-1. Wireless Ethernet Configuration Default SettingsCurrent Port Profile TCP Sockets Gpio Page T E S Page Comments Readers Comment FormInstructions