Structured Text Help

Hi All,

I'm really new to structured text. My PLC experience is mainly PLC5 (ladder), Omron (ladder), and Micro850 (function block). I'm trying to use structured text to save data at a certain time of day (0800) or TOD#. I've searched the forum, but no joy. I haven't found a good example of how TOD# is used. It appears to set the time? I'm using a Schweitzer RTAC if that helps. I'm also looking for a good tutorial that uses examples (not one-liners).

Thanks,
rp123
 
What access do you have to the clock with the SEL structured text?
The following is what rslogix5000 code would look like

/*
Wall Clock Data checked to evaluate the current time, if it is 8AM and the seconds are less than 5 then execute the recording of current
values to my logging system one time
*/

If (WallClockData[3] = 8) and (WallClockData[4] = 0) and (WallClockData[5] < 5) and not OneShotTag Then

If Not OneShotTag Then

OneShotTag := 1;
cop(MyData[0], DataFile[0], 8);

End_if;

End_If;

/*
Wall Clock Data checked to evaluate the current time, if it is 8AM and the seconds are greater than 10 and the one shot tag is true then
reset the one shot tag so it can be reused when the time occurs
*/

If (WallClockData[3] = 8) and (WallClockData[4] = 0) and (WallClockData[5] < 10) and OneShotTag Then

If OneShotTag Then

OneShotTag := 0;

End_if;

End_If;
 
Hi Programmer1,

Thanks for the reply! I don't see a reference to a wallclockdata function in the their manual. Is it an IEC 61131-3 Structured Text function? The SEL manual states there are other IEC 61131-3 manuals, which I'm looking for. The have the data types TIME, LTIME, DATE, DATE_AND_TIME, TIME_OF_DAY. Which seem to be used for TON or event logging. I will do some testing on the example you have given.

Greatly Appreciated,
rp123
 
The WallClockData tag is holds data from Get System Value (GSV) in Logix, you first need to make sure that there is an available clock in the processor. Then use that in a manner similar to the example.

I have tried to get access to the software to see if I can create a better example. It will be a few days if they approve the request before I will have that access. Worst case scenario you may have to get a digital input from an external time clock to trigger the event.

If you are the maintainer of the system you could also create a time function with timers counting seconds/minutes/hours. But if there is a problem with the system the time stops then offsetting the time by the downtime(probably not acceptable in most situations).

In the example the
(WallClockData[3] = 8) this element is the Hours
(WallClockData[4] = 0) this element is the Minutes
(WallClockData[5] > 10) this element is the seconds
 

Similar Topics

I am working to get a stepper motor moving with this PLC. I have tried help from two 2 AI Agents, but just get run around in circles with no...
4
Replies
491
Views
Hey everyone, I’ve been experimenting with using AI to generate Structured Text for PLCs (mainly Codesys and Beckhoff), mostly because I got...
98
Replies
7,302
Views
Hi all, i have a logix 5000 program that has a lot of structured text. i am online and looking at the program and i have the monitor glasses on...
5
Replies
1,274
Views
Hello, doing switch from FBD to ST. First task is converting my old work. How do you sum variables? For example, Interlock1, interlocl2 and...
5
Replies
1,084
Views
Hey guys, was hoping someone could give me a bit of advice here in a couple spots. I'll start off with my dumb code and explain after...
10
Replies
3,944
Views
Top