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 using a Hitachi Micro EHV+ for a small project, and I wanted to have a Web visu, done with Codesys V3.5 SP13 Patch 2. I test the...
Replies
6
Views
262
Hello, I have a requirement to manage the text alignment dynamically. So, for example: 1. English Texts should be displayed from Left in...
Replies
0
Views
86
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
130
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
478
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
157
Back
Top Bottom