Appendix A
A-26
NJ/NX-series Database Connection CPU Units User’s Manual (W527)
Insert production data to the DB Connection MyDB1.
Set the timeout for instruction execution to 200 ms.
MyDB1
MapVar_Insert
T#200ms
Execute
DBConnection
MapVar
TimeOut
Done
Busy
Error
ErrorID
SendStatus
When the instruction is terminated due to an error, execute the error handler for the device (FaultHandler_Insert).
Program the FaultHandler_Insert according to the device.
//Go to next step when the instruction is not completed within the specified time
IF DB_Insert_instance.ErrorID = 16#3012 THEN
RETURN;
ENDIF;
// Close the DB Connection.
Trigger_Close := TRUE;
// Error handler
FaultHandler_Insert();
- Update the records in the DB Connection MyDB1 when the variable Trigger_Update changes to TRUE.
Check the completion of the DB_Update instruction.
Accept the trigger for updating DB records.
Create production data to update.
Create the conditions for Where clause.
// Create production data to update.
MapVar_Update.Status := ’OK’;
MapVar_Update.FinishTime := GetTime();
// Create conditions for Where clause ("LotNo" = XXXX AND "Status" = 'Busy')
WhereCond := CONCAT(
'"LotNo" = $'',
UINT_TO_STRING( LotNo ),
'$' AND "Status" = $'Busy$''
);