4.3.3 Obtaining and clearing the counter value
Summary of operation
Read and display the command pulse and feedback pulse counter on the X-axis. The counter value can be cleared only when the axis is normally stopped (stopped without error). Read the counter value in a timer event.
Program code
cmdStr = "PX"
result = SendReceiveCommanderHID(devHandle, cmdStr, replyStr) ’Obtain the command pulse counter value on X-axis
OutplsX.Text = replyStr ’Display the command pulse counter value
cmdStr = "EX"
result = SendReceiveCommanderHID(devHandle, cmdStr, replyStr) ’Obtain the feedback pulse counter value on X-axis
FeedbackX.Text = replyStr ‘Display the feedback counter value
cmdStr = "MSTX"
result = SendReceiveCommanderHID(devHandle, cmdStr, replyStr) ’Obtain the status value of X-axis
mStatusX.Text = replyStr ‘Display the status value for X-axis
Execute the above process repeatedly in the timer event
If mStatusX.Text = "0" Then ‘Does X-axis stop normally?
cmdStr = "PX=0"
result = SendReceiveCommanderHID(devHandle, cmdStr, replyStr) ’X-axis command pulse counter clear
cmdStr = "EX=0"
result = SendReceiveCommanderHID(devHandle, cmdStr, replyStr) ’X-axis feedback pulse counter clear
< Previous Section | Topic Home | Home | Next Section >