NRC_JobfileInsertUNTIL(int line, int port, int value)
Insert UNTIL instruction into the job file
Before calling this function, please call NRC_CreateJobfile(std::string jobname) or NRC_OpenJobfile(std::string jobname) to create or open a job file
It needs to be used with NRC_JobfileInsertENDUNTIL(int line)
Type
int=>Insert UNTIL instruction into the job file
Return value | Description |
---|---|
0 | The function is called successfully |
-101 | Invalid input parameter |
-102 | The target object does not exist. This typically occurs when the system initialization is incomplete, and calling other functions may return this value |
-103 | The target object is currently in an inoperable state |
Parameter Option
Parameter | Type | Description |
---|---|---|
line | int | The line number where the instruction will be inserted, parameter range: 0 < line < (NRC_GetJobfileLineSum()+1) |
port | int | The number of the digital input port to be detected, parameter range: port > 0 |
value | int | The input state to wait for; 0: low level; 1: high level |
Sample code
//While running between UNTIL and ENDUNTIL, if the condition of UNTIL is met, the program will immediately interrupt the current running instruction and jump to ENDUNTIL for execution
NRC_JobfileInsertUNTIL(1, 5, 1);
NRC_JobfileInsertMOVJ(2, 100, pos1, 0);
NRC_JobfileInsertMOVL(3, 100, pos2, 0);
NRC_JobfileInsertDOUT(4, 1, 0);
NRC_JobfileInsertTIMER(5, 0.5);
NRC_JobfileInsertENDUNTIL(6);