The Secret to Efficient PLC Code: Function Blocks @ACCautomation
The Secret to Efficient PLC Code: Function Blocks  @ACCautomation
Uploaded October 2026 | Updated November 2026, 3 hours ago
Structured text function blocks: TON, CTU and R_TRIG are the same PLC timers, counters and one-shots you know from ladder, with a text based syntax.

โšก QUICK ANSWER
Function blocks are instances that hold their state across scans - which is exactly what a ladder timer or counter does, so you already understand the concept. TON is an on delay timer: declare an instance, call it with IN := X1 and PT := T#2s, then read its Q output. CTU counts up on each rising edge. R_TRIG gives a one scan pulse on a rising edge, which is the one shot you already use in ladder. The simulator also provides TOF for off delay, TP for a pulse, CTD for counting down and F_TRIG for a falling edge. Nothing here is a new idea - it is the same toolbox with a text syntax, which is why structured text is easier to pick up from ladder than most people expect. Full guide on the blog.

๐Ÿ“– FULL WRITTEN GUIDE
accautomation.ca/acc-plc-simulator-how-to-use-structured-text-st-programming

๐Ÿ–ฅ๏ธ OPEN THE SIMULATOR AND PRESS ST
accautomation.ca/simulator

โ–ถ WATCH THE FULL VIDEO
youtu.be/B0UDgJnE3DQ

๐Ÿ“š WHAT YOU'LL LEARN
โœ… Understand what a function block instance is - a block that holds its own state across scans, exactly like a ladder timer or counter does
โœ… Use TON as an on delay timer - IN := X1 for the enable, PT := T#2s for the preset, then read the Q output
โœ… Use CTU to count up on each rising edge, and CTD to count down
โœ… Use R_TRIG for a one scan pulse on a rising edge, and F_TRIG for a falling edge - the text equivalent of a ladder one shot
โœ… Map what you already know onto the text syntax, rather than learning the concepts again from scratch

โ“ FREQUENTLY ASKED
Q: What does T#2s mean in structured text?
A: It is an IEC 61131-3 time literal. T# introduces a duration and 2s is two seconds, so PT := T#2s sets a timer preset of two seconds. You will also see forms like T#500ms and T#1m30s.

Q: Is a function block the same as a ladder timer?
A: Conceptually yes. Both are instances that keep their own state between scans - a TON accumulating elapsed time is doing what a ladder TMR does. The difference is that you call it and read its outputs by name instead of wiring a rung to it.

Q: What is R_TRIG for?
A: A one scan pulse on a rising edge - the structured text version of a one shot. Use it whenever something must happen once per transition rather than every scan the condition stays true.
๐Ÿ‘‰ The full guide, with every statement and function block: accautomation.ca/acc-plc-simulator-how-to-use-structured-text-st-programming

๐Ÿ”— MORE RESOURCES
โ–ถ Try the free simulator: accautomation.ca/simulator
โ–ถ How I learned structured text in the simulator: youtu.be/B0UDgJnE3DQ
โ–ถ PLC Beginners Guide: accautomation.ca/programming/plc-beginners-guide
โ–ถ Free eBooks: accautomation.ca (subscribe for download)

๐Ÿ›’ RECOMMENDED HARDWARE
โ–ถ Shop: automationdirect.com
โ–ถ Parts Guide: accautomation.ca/purchase-find-parts

๐Ÿ’ฌ Questions? Drop a comment below.

๐Ÿ”” New tutorials every Monday โ€” Subscribe and hit the bell!

#PLC #LadderLogic #IndustrialAutomation #PLCProgramming #ACCAutomation #StructuredText #IEC61131 #PLCTimer #PLCCounter #Shorts

Regards,
Garry
ACC Automation
accautomation.ca
The Secret to Efficient PLC Code: Function BlocksStop Endless Rewrites: 5 Steps to PLC Success!What you actually get for $5,000 in PLC gear #engineering #shorts #techThese 2 Timers Do Different Jobs โ€“ Heres When to Use Each! โฑ๏ธThat Moment Your PLC Stops Understanding You! ๐Ÿ˜ค #plc #humor #shortsAsking the Boss for a Raise!Fastest Way to Access Instructions! #PLCProgramming #Automation #TutorialHow to Build a Process Overtime Alarm with a Timer #PLCProgramming #IndustrialAutomationGamepad vs. Keyboard: 3D Scene Control Revolution!This Tiny Part Stops Your Entire System from Failing! #Automation #ElectricalTipsDont Miss PLC Tips Subscribe Now! #automation #plc #engineeringWhy you dont need a $5,000 PLC lab #plc #education
ACC Automation: PLC & Industrial Control Learning |

The Secret to Efficient PLC Code: Function Blocks

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER