Appendix A
A-59
A
NJ/NX-series Database Connection CPU Units User’s Manual (W527)
Sample Programming
(* ---------------------------------------------------------------------------------------------------------------------
- Start recording to the Debug Log when the variable LogOn changes to TRUE.
Finish the recording when the variable LogOn changes to FALSE.
--------------------------------------------------------------------------------------------------------------------- *)
// Start the sequence when the variable LogOn changes to TRUE.
IF ( (LogOn=TRUE) AND (LastTrigger=FALSE) ) THEN
OperatingStart := TRUE;
Operating := TRUE;
MyCmd := _DBC_CMD_DEBUGLOG_ON; // Start recording to the Debug Log.
ELSIF ( (LogOn=FALSE) AND (LastTrigger=TRUE) ) THEN
OperatingStart := TRUE;
Operating := TRUE;
MyCmd := _DBC_CMD_DEBUGLOG_OFF; // Finish recording to the Debug Log.
END_IF;
LastTrigger := LogOn;
// Sequence start processing
IF (OperatingStart=TRUE) THEN
// Initialize the instruction instance.
DB_ControlService_instance( Execute:=FALSE );
OperatingStart := FALSE;
END_IF;
// Command to start or finish recording to the Debug Log.
IF (Operating=TRUE) THEN
// Start or finish recording to the Debug Log.
DB_ControlService_instance(
Execute := TRUE,
Cmd := MyCmd
);
IF (DB_ControlService_instance.Done=TRUE) THEN
// Normal end processing
Operating := FALSE;
END_IF;
IF (DB_ControlService_instance.Error=TRUE) THEN
// Error handler.
Operating := FALSE;
END_IF;
END_IF;