Codesys Power-up bit

lesmar96

Lifetime Supporting Member
Join Date
May 2017
Location
PA
Posts
520
I am using SoMachine 4.3, but I would think that all versions of Codesys would be the same in this regard.

I am looking for a power-up bit. A bit that will turn on for one scan when the plc is booted up.

How is this normally done in a clean way in Codesys?

thanks!
 
With CODESYS all variables are reinitialised to whatever you set in the declaration editor on powerup, unless you explicitly mark them as retain and or persistent.

So declare your variable

Powerupbit : BOOL := TRUE;

and then reset it at the end of the task you wish to reset it in.
Powerupbit := FALSE;

Of course, you could write a function "isFirstCycleOfTask", but I think your own powerupbit is cleaner.
Use the cmpIecTask library
You will need the following parts:
IecTaskGetCurrent()
IecTaskGetInfo3()
.dwIECCycleCount

Help file here
https://help.codesys.com/webapp/idx-CmpIecTask-lib;product=CmpIecTask;version=3.5.14.0
 
Hey, thanks for your help. I hadn't thought of trying that, but declaring my own power up bit will easily work for what I am attempting.
 

Similar Topics

Hello, I am new to Codesys, and am trying to learn about it for a project we're developing. I've got a couple questions, but first a little...
Replies
1
Views
72
Hi everyone, as this is my first experience with Rockwell Software i would like to know what's the best way to make Enumerations?
Replies
10
Views
412
I am trying to get Codesys to work with a couple of Moxa ioLogik E1200 series DIO devices (E1210 and E1211). I am able to write to the E1211 DOs...
Replies
2
Views
113
Hi Guys, I am trying to establish communication over profinet between Siemens S7-1200 PLC as IO device and codesys plc as IO controller. But I am...
Replies
39
Views
2,060
Hello to all, Is it possible to export Codesys symbols to .txt, .csv or .xml in a similar manner like exporting symbol table in STEP 7? For...
Replies
0
Views
102
Back
Top Bottom