ndJf
(Library)
A conditional branch upon receipt of OK/NG from an external device (RS232C input/output).
ndJf (<2-digit integer>, <Determination argument>)
This statement provides a similar function to a JF instruction in the conventional language.
The system transfers a 2-digit integer to an external device and calculates a response result to execute a conditional branch in the program.
If the response from the external device is OK, the system proceeds to the next step. If it is not good, it branches to a labeled step.
#include <Pacman.h>
|
|
PROGRAM PRO1
|
|
DEFINT JF_VAL = 0
|
|
FLUSH
|
|
CALL ndVType(1)
|
'Sets the protocol (Conventional = 0/ New = 1).
|
CALL ndVrst
|
'Initializes the external device.
|
CALL ndVset(0)
|
'Clears the received data (VDT) to 0.
|
CALL ndVis(3)
|
'Starts up the external device (Sends 03).
|
CALL ndJf(3,JF_VAL)
|
'Obtains a response result from the external device
'(Sends 03).
|
IF JF_VAL = TRUE THEN
|
'Receives data, if the response is OK (TRUE).
|
CALL ndVset(3)
|
'Receives 10 data from the external device (Sends 03).
|
CALL ndVdt(pacPOS,1)
|
'Assigns the data received from the external device
'to variable (P1).
|
CALL ndVdt(pacJNT,1)
|
'Assigns the data received from the external device
'to variable (J1).
|
CALL ndVdt(pacTRN,1)
|
'Assigns the data received from the external device
'to variable (T1).
|
END IF
|
|
END
|
|