Instruction Manual

Writing Your Own Application Program
Chapter 4
4-6
Preventing Reply Messages from Being Lost
To prevent reply messages from being lost, we provide a Get_tns()
function. Use the following format:
x = Get_tns()
The Get_tns() function returns an unsigned integer value. Place this value
in the two-byte TNS field of your DH-485 message prior to calling the
Send_StdDrv() function. See page B-5 for more information on
Get_tns().
The Get_ErrMsg() function call supplies a message string for errors in
data transmission. If an error occurs, call Get_ErrMsg() with the error
code to get a message indicating the problem. Use the following format
and parameters:
Format for Get_ErrMsg()
The Get_ErrMsg() function call is shown below:
Get_ErrMsg(err, ret_msg);
Parameters for Get_ErrMsg()
Table 4.E explains the parameters:
T
able 4.E
Get_ErrMsg()
Parameters
Parameter Type Description
err
unsigned int
is a copy of the error value returned in io_stat[0].
ret_msg char
is a pointer to a character buffer at least 80 characters long. It contains
the error message string that corresponds to the code in the err
parameter
. The error message is returned in this buf
fer.
Table 4.F explains how to read io_stat[0] to get the STS and EXT STS
bytes.
Using Get_ErrMsg()