Beckhoff CX1010 first scan

karlek

Member
Join Date
Jul 2014
Location
Varazdin, Croatia
Posts
68
Googled a little, but didn't quite find the answer. I need to detect first scan of device so I found out in Beckhoff documentation about this data type: SYSTEMTASKINFOTYPE(http://infosys.beckhoff.com/english...m/html/tcplclibsys_systemtaskinfotype.htm&id=) which, among other variables, contains firstCycle variable (System library).

I don't know if I am missing something but I can't find a function which I could use to retrieve this variable, and I have searched among all functions and function blocks in System library.

Hopefully soon I will be able to help others the same way I am getting help on this very, very useful forum :)
 
http://www.powermation.com/pdf/contrex/cx-1010-tech-ref-manual.pdf

There is a first PLC scan bit.
Descriptions of the groups of operands and discussion of the associated Control Parameters follow:
Bit 0 is the top of the stack, S0 (first entry point).
Bit 1 is the bottom of the stack, S1, (lowest level).
Bit 2 is fixed at the value of 0.
Bit 3 is fixed at the value of 1.
Bit 4 is set to a 1 for the first PLC scan after power-up.

Also look at 'A Pulse Generator - One Shot' in the manual. This can be done on an internal bit to represent the first scan.

Hope this is helpful,
Garry
http://www.accautomation.ca
 
I believe the OP was asking about the Beckhoff CX1010 which is an embedded PC controller, not the similarly named Contrex product.
 
I have always thought that the way to do the "FirstScan" in TwinCAT is as follows:

1. Declare a global BOOL variable with the default value of 'TRUE'.
2. Set it to 'FALSE' at the very end of the program task.
 
several options available in codesys (twincat)
there is an event under tasks you can use called start.
you can use ladderlogic way, however i have to remark that when running several tasks you have to find a way to detect if task is done.
This has advantages so you can see which task is done.

So IF firstscan do initialisation: firstscan:=false; END_IF
 
TwinCAT 3 first scan bit

I found using the green triangle and red square to stop and start the PLC code running DOES NOT work for "first scan". First scan only seems to work after re-starting the Twin CAT runtime. First scan seems to mean first "Runtime started" scan. This caught me out for a while. The below worked for me. I set a TP timer to run if "bTest" NOT true. I gave the timer like 50 seconds to run because that gave me enough time to log on and monitor the timer actually running after restarting TC3 runtime..

VAR
fbGetCurTaskIdx : GETCURTASKINDEX;
bTest : BOOL;
END_VAR
fbGetCurTaskIdx();
bTest := _TaskInfo[fbGetCurTaskIdx.index].FirstCycle;
 

Similar Topics

Hi, I am just learning to work with Beckhoff controllers and am trying to set up TCP/IP communication with a Siemens S7-300 PLC. In the process I...
Replies
2
Views
2,823
I'm starting a new project HMI on the company where I work, where I develop modules for system events, plotting graphs, trends, and persistence of...
Replies
9
Views
6,695
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
957
Hello sameone have Beckhoff PLC Siemens Sinamics V90 configuration example?
Replies
0
Views
96
hello, I am using Beckhoff with TwinCAT3 and when I change or add some new hardware or for any reason, there is a mismatch in the real hardware vs...
Replies
1
Views
122
Back
Top Bottom