23.03.2017 Views

wilamowski-b-m-irwin-j-d-industrial-communication-systems-2011

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Modbus 36-5<br />

Request APDU<br />

Response APDU<br />

01 Ah Al Ch Cl 01 B D ... D<br />

02 Ah Al Ch Cl 02 B D ... D<br />

03 Ah Al Ch Cl 03 B Dh Dl ...<br />

Dh<br />

Dl<br />

04 Ah Al Ch Cl 04 B Dh Dl ...<br />

Dh<br />

Dl<br />

05 Ah Al Dh Dl 05 Ah Al Dh Dl<br />

06 Ah Al Dh Dl 06 Ah Al Dh Dl<br />

0F Ah Al Ch Cl B Dh Dl ... Dh Dl<br />

0F Ah Al Ch Cl<br />

10 Ah Al Ch Cl B Dh Dl ... Dh Dl<br />

10 Ah Al Ch Cl<br />

16 Ah Al M A h M A l M o h M o l<br />

16 Ah Al<br />

M A h M A l M o h M o l<br />

17 A R h A R l C R h C R l A W hA W l C W h C W l D W h D W l ... D W hD W l 17 B D R h D R l ...<br />

D R h D R l<br />

18 Ah Al<br />

18 Bh Bl Dh Dl ... Dh Dl<br />

A –Starting bit/register address<br />

C – Number (count) of referenced bit/register<br />

Xh – High byte of 16 bit value X<br />

Xl – Low byte of 16 bit value X<br />

X R – Parameters for reading<br />

X W – Parameters for writing<br />

B – Number of remaining bytes in frame<br />

D–Data values<br />

M A – AND mask<br />

M o – OR mask<br />

FIGURE 36.4<br />

Format of data access functions APDUs.<br />

Note that the maximum number of addressable elements is limited by the maximum size of the<br />

APDU. For example, for function code 0x0F, the request APDU starts off with 6 bytes containing the<br />

function code and respective parameters (see Figure 36.4), leaving a maximum of 247 (equal to 253 − 6)<br />

available bytes in which to send the data. The data, consisting of 1 bit elements, are packed 8 per byte,<br />

resulting in a maximum of 1976 (247 × 8) addressable elements.<br />

Function 0x16 (Mask Write Register) changes the value stored in a single holding register. However,<br />

unlike the other functions, the new value is not obtained directly from the data sent in the APDU, but<br />

rather is obtained by applying a logical operation using the current value of the holding register with<br />

two masks, an AND mask and an OR mask, sent with the APDU.<br />

New_value = (Current_value AND And_mask) OR (Or_mask AND (NOT And_mask))<br />

Using this function the client can switch off certain bits and set other bits of the holding register,<br />

while simultaneously leaving the remaining bits unchanged, in a single atomic operation.<br />

Function 0x18 (Read FIFO Queue) allows the client to request reading a FIFO queue from the server.<br />

The FIFO queue must be stored within the holding registers memory area in the server and consists of<br />

a first register containing the number of elements in the queue (queue count register), followed by the<br />

values of each element in the queue in the following registers (queue data registers). The client merely<br />

© <strong>2011</strong> by Taylor and Francis Group, LLC

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!