NRC_RunqueueInsertIF( int port, int value)
Insert IF instruction in the run queue
Before calling this function, please call NRC_CreateNoFlieRunqueue() to create a fileless run queue
It needs to be used with NRC_RunqueueInsertENDIF()
Type
int=>Insert IF instruction in the run queue
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 |
---|---|---|
port | int | The number of the digital input port to be detected, parameter range: port > 0 |
value | int | Input status to be checked; 0 represents low-level input state; 1 represents high-level input state |
Sample code
//If the IF condition is met, execute the IF code block, otherwise execute the ELSE code block; if there is no ELSE instruction and the IF condition is not met, the IF code block will be skipped, and the instruction after ENDIF will be executed directly
NRC_RunqueueInsertIF(5, 1);
NRC_RunqueueInsertMOVJ(100, pos1, 0);
NRC_RunqueueInsertDOUT(1, 0);
NRC_RunqueueInsertELSE();
NRC_RunqueueInsertMOVL(100, pos2, 0);
NRC_RunqueueInsertTIMER(0.5);
NRC_JobfileInsertENDIF();