Skip to content

Instantly share code, notes, and snippets.

@WMCPLab
WMCPLab / gist:1106f4f8f5d548238439a5e9e1c9fbb3
Last active October 25, 2025 18:27
Converts raw IO-Link data from a P+F UC250 sensor to a distance in mm.
(**************************************************************************************
* Function Block: FB_IoLink_UC250_Distance
* Version: 1.0
* Author: WMCP Lab
* Date: 2025-10-25
* Description: Converts raw IO-Link data from a P+F UC250 sensor to a distance in mm.
*
* Disclaimer:
* This code is provided for educational purposes. The author is not responsible
* for any errors or omissions, or for the results obtained from the use of this
@WMCPLab
WMCPLab / gist:f48be370e93069e38b54d977abfe8d9f
Created September 16, 2022 07:30
Codesys example BLINK functionblock in Structured Text (ST)
//declaring variables
PROGRAM PLC_PRG
VAR
L_error AT %QX0.6: BOOL; //error light
K_start AT %IX1.0: BOOL; //start button
TimeL: TIME:= T#250MS;
TimeH: TIME:= T#250MS;
Blink_4hz: BLINK; //Creating an instance of the function BLINK
END_VAR
@WMCPLab
WMCPLab / lower_camel_casing_codesys.txt
Last active December 1, 2021 20:27
Example of lower camel casing in a PLC program
PROGRAM PLC_PRG
VAR
//MPS® control console for SysLink
startButton AT %IX1.0: BOOL;
stopButton AT %IX1.1: BOOL; //NC
autoManButton AT %IX1.2: BOOL;
resetButton AT %IX1.3: BOOL;
emergencyBreak AT %IX1.5: BOOL; //NC
startLed AT %QX1.1 : BOOL;
@WMCPLab
WMCPLab / assignment_comment_header_codesys.txt
Created November 28, 2021 11:01
How to comment a PLC program? | Codesys
PROGRAM PLC_PRG
VAR
(*
File : 2021-11-23_Assignment4_Scott_M_v1.4
Author : M. Scott
Date : 23-11-2021
Course : Codesys - term 2
Version : 1.4
Tested by : John Taylor