Untitled

mail@pastecode.io avatar
unknown
plain_text
13 days ago
927 B
1
Indexable
Never
VAR
    Fiber_Optic_Status: BOOL;        // Variable to store fiber optic connection status
    Fiber_Optic_DI: BOOL;            // Digital input for fiber optic status
    Fiber_Optic_Failure: BOOL;       // Indicator to be activated on fiber optic failure
END_VAR


// Read the status of the digital input connected to the fiber optic signal
Fiber_Optic_DI := Variable[0];      // "Variable" is whatever variable is connected to the fiber optic signal

// Check if the fiber optic signal is broken
IF Fiber_Optic_DI = FALSE THEN
    Fiber_Optic_Status := FALSE;      // Fiber optic connection is broken
    Fiber_Optic_Failure := TRUE;      // Activate failure indicator
ELSE
    Fiber_Optic_Status := TRUE;       // Fiber optic connection is intact
    Fiber_Optic_Failure := FALSE;         // Deactivate digital output
END_IF

// Write the digital output status to the respective channel
Variable[0] := Fiber_Optic_Failure;
Leave a Comment