Beckhoff Twincat - set timer time manually

julle

Member
Join Date
Aug 2013
Location
Helsinki
Posts
2
Hi,
I've been working with Beckhoff TwinCAT for a small time now and I already know the basics. There are however few things I can't make out so I'm asking your help.

I need a timer which time I should be able to set manually while the program is running.
I made a button to the visualizations page and by pressing that button it opens a numpad.
So I need some kind of timer which starts when a BOOL variable goes on (TRUE) and it runs the time I've set to it and then sets another BOOL variable on.
For example if I press the button on the visualizations page and enter number 500 using the numpad which opens, then when the timer starts it runs 500 milliseconds and then sets the another BOOL as TRUE.

By the way I'm using 1 millisecond in PLC task cycle time. Should I use that cycle time somehow when building the timer/counter? For example making a function and using FOR loop or something?
 
You can do this with a TON timer
what langauge are you using LD or ST or another.

here you go unzip and load it.
do not mind errors from libs and targets.
 
For similar tasks, I have used both the TON function block and just monitored elapsed time on my own using the GETSYSTEMTIME() call (or similar). The later takes a little effort because it returns two 32-bit integers that you must combine. This will surely be easier when one can use 64-bit integers in PLC code. Perhaps one can in TwinCAT3 (my next task).

The TON function is traditional in PLC coding. I recall having to play with it a bit to get the timer to reset. I vaguely recall that it only allows 1 sec increments, so check that.
 

Similar Topics

Hi everyone, This is my first time posting, so please forgive any omissions or mistakes. I am attempting to control the velocity of a stepper...
Replies
18
Views
996
Hello, I was wondering if anyone know how to upload a PLC program to the Beckhoff TwinCAT 3 from a file? i.e. without having the development pc...
Replies
0
Views
755
Hi anyone got any tips and tricks?? I'm at a stage wherei need to tidy up my hmi project and give all objects sensible names, I did start this...
Replies
0
Views
958
Hello, I have a System running a beckhoff IPC with twincat 2 software on it, Also i have no original source code. Is it possible with the...
Replies
1
Views
1,266
Hi all, I've inherited someone else's program and can't for the life of me figure out his use of the # symbol in one of his structured text...
Replies
5
Views
1,919
Back
Top Bottom