You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

Reply
 
Thread Tools Display Modes
Old January 14th, 2020, 05:17 PM   #1
lesmar96
Lifetime Supporting Member
United States

lesmar96 is offline
 
Join Date: May 2017
Location: PA
Posts: 461
Codesys Power-up bit

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!
__________________
Whatever you are, be a good one.
  Reply With Quote
Old January 14th, 2020, 06:05 PM   #2
AustralIan
Member
Germany

AustralIan is offline
 
Join Date: Jan 2013
Location: Germany
Posts: 1,184
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-...rsion=3.5.14.0
  Reply With Quote
Old January 14th, 2020, 06:51 PM   #3
lesmar96
Lifetime Supporting Member
United States

lesmar96 is offline
 
Join Date: May 2017
Location: PA
Posts: 461
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.
__________________
Whatever you are, be a good one.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Allen Bradley 1769-L18ER-BB1B local 1734 point IO modules arrangements anirudhgk7 LIVE PLC Questions And Answers 11 November 11th, 2019 01:51 PM
scan question slc 5/03 just the cowboy LIVE PLC Questions And Answers 6 March 27th, 2015 10:27 AM
2 24VDC power supplies cskaggs2 LIVE PLC Questions And Answers 5 September 16th, 2010 12:24 AM
profibus problem gh_ounie LIVE PLC Questions And Answers 10 August 18th, 2008 04:31 AM
Siemens Addressing Fun james-0000 LIVE PLC Questions And Answers 4 August 9th, 2008 12:58 AM


All times are GMT -5. The time now is 02:14 AM.


.