User`s manual

http://www.adtechcn.com 62
) 3. Help for debugging in developing through application
The function library of ADT-8840 provides help on debugging.
(1) Use the debugging tool to display the input parameters actually received by the control card and the
execution results. The displaying state of serial interface debugging is enabled or disabled through the
function “Uart_show()”, with default as “disabled”. If the state of serial interface debugging is enabled, a
number of system resources will be consumed, which can affect the execution speed.
(2) When this option is enabled, it will help the development personnel examine execution failures of the
control card caused by the unauthorized parameter input. Once the program becomes stable and mature, the
user can disable the return of execution results of the control card through the Mode option.
When the mode option is enabled, the return value of the function will include the execution results of the
control card (0: execution OK; 1: execution failure; -1: transmission abnormity; -2: response overtime; -3:
abnormal data received; -4: disabled device interface). When disabled, the return value of the function will
not include the execution results of the control card (0: execution OK; -1: transmission abnormity; -4:
disabled device interface).
) 4. Average execution time of function command
If the control card provides no execution results, the average execution time of function commands will be 2.5
ms. If it does, 4 ms. These time values are only used for reference and the actual execution time should be
subject to the host and running state of the network. When real-time control is under way, as many unrelated
applications as possible in the host should be closed, so as to ensure the stability of response.
Chapter VII Major Points on Developing Motion Control Card
Some problems may arise in programming with this control card. However, most of the problems are caused
by the incorrect understanding of the working principle of the card. In the part below are situations users
often come cross and the related explanations.
) Initialization of card
At the very beginning the program runs, the user should initialize the device address through the function
DeviceAddr_init()
”, and then detect the network connection through “
TCP_Conn()
” to see whether the
connection of ADT8840 is conforming. A device number will be returned once the connection is successful.
After that, the user should set the pulse output mode and work mode of limit switch in accordance with the
situation of the machine. The function “
DeviceAddr_init()” should be used only when the application is about to
be initialized. After the initialization is completed, the all network resources should be released through the
function “
Close_all()
”.