User Manual

Chapter 7: Enabling and Using HART on the 1769sc-IF4IH0
U ser 's M a n u a l 0 300 21 5- 03 R ev. A
7-13
Words 30…49 (Message Response Buffer)
The message response buffer contains the response data for the current page up to thirty
eight bytes at a time.
7.3.3 Processing a Message
To complete a message from beginni ng to end, follo w the steps listed below:
1.
Store the message you wish to send to the module in an array. Remember the
message can be up to 257 byte s long, so make the array large enough.
2.
Copy the first page of data, up to 38 bytes, to the message request buffer. If the
number of bytes is odd, the last byte in the last word will be padded with a zero.
3.
Calculate the checksum of the message by taking the exclusive OR of all the
words within the page (19 max). Place the result into the last word of the
message (i.e. word # 20 if a full page).
4.
Enter the size of the message to be sent to the module into the message request
size output word.
5.
Add a 1 to the lower nibble of the message master control word (i.e. 0001Hex).
The message master control should be zero when the message is started.
6.
Wait for the module to reply that it has received the page without error, by
monitoring the second nibble of the message slave control (i.e. 0100).
If the lower nibble contains FF, stop the process because the data is corrupted.
The first byte in the message response buffer will contain the paging error code.
Refer to Table 7-8 for a description of the errors.
7.
Check to see if there are more pages to send by comparing the bytes sent to the
message request size . If so, repeat steps 2 through 6. If not, go to step 8.
8.
Monitor the lower nibble of the message slave control to see if the first page of
the response data is ready (0101).
9.
Copy the first page of the response data fro m the message response buffer to a
temporary array.
10.
Take the exclusive OR of all the words within the page (19 max) with the
exception of the last word which is the checksum. Compare the calculated
checksum with the checksum stored in the last byte. If they are equal, go to step
11. If they are not, stop the process because the data is corrupted.
11.
Check to see if there is more response data remaining by comparing the bytes
received to the message respon se size. If so, repeat steps 8 through 10. If not,
the message is finished. To send another message clear the message master
control and repeat the process.
A graphical representation of the process can be seen in Figure 7-6 and Figure 7-7.