Structured Text Help

rp123

Member
Join Date
Mar 2013
Location
Boise, ID
Posts
2
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

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...
Replies
10
Views
2,821
Good morning, Guys: I have a structured text (Rslogix 5000), i couldn't understand it. can anyone help me and explain its meaning. thanks!
Replies
7
Views
1,571
Hi all, this is a long one, so there's a TL;DR at the bottom :) I have a situation where I'm dragging data from an external database into a UDT...
Replies
9
Views
4,732
Hi all, I'm trying to assign the individual characters from a STRING data type to an array of BYTE's as below: text : STRING(5) := 'hello'; char...
Replies
7
Views
6,994
Hopefully someone can put me right here :huh: I've wrote the following which should function as follows: Scan x no of Bits (Highest to Lowest)...
Replies
30
Views
17,230
Back
Top Bottom