Wall clock timer in 5000

russrmartin

Member
Join Date
Aug 2002
Location
Eastman, Wisconsin
Posts
744
I need a clock timer to run when a certain part of a line is down. I tried using the GSV and the wall clock timer. I have the current value being written constantly into a tag I named clock timer value. The logic is running, but my value is 0. Does the clock timer need to be set first so that it knows where in time we are at to clock from? The help file for the wall clock timer is pretty vague. Thanks.

Russ
 
If you're looking for a total down-time counter then I recommend using a simple add instruction.

When the line is down use a 1 second pulse to add 1/60 to a double floating point value. The results will in minutes. If you use a 1 minute pulse the result will be in hours.

Note that if you use a regular (32 bit) FP value you may run into resolution issues if you count seconds and if you don't reset the counter (ie. the 1/60 will be too small to add to the results).

I use this method for calculating motor run times on hundreds of motors. It's simple and elegant and doesn't require the use of any special functions. It works well on any brand of PLC that supports FP too.

Good Luck,

(8{)} ( .)
 
huh?

I hate to sound simple minded here, but first I have to ask, what is FP value. Also, I would use the 1 second or 1 minute clock, but I don't know how to access it in Control Logix. I was under the impression that the old S: bits found in PLC5 and 500 are now S bits that must be accessed with a GSV. If there is a simpler way, I am all ears, but judging from you first post you may need to simplify your explanation for me. Thanks.

Russ
 
The 'current value' is an array of DINT[2] - i.e. a 64-bit number representing microseconds since 1 Jan 1972. If the processor clock has never been set, then I suppose it might think it's not 1972 yet.

A simpler way might be to set up a periodic task to run every second and accumulate a count there if the line is down.
 
the game plan

I will probably just set up the periodic task, but now my curiosity is up. Does anyone know how to get a 1 minute or 1 hour clock out of the controller? I'm going to keep messing with it after I get what I need finished.
 
Use an internal pulse into a counter. When the counter counts down, add 1 to a register and reset the counter. I use this routine all the time for long range timers etc.
 
russ

To access the wall clock use a gsv and set the destination to an array of DINT with the array at least 8 long. You will then get the date and time into the array. I normally call the array DateTime

The instruction list is
GSV(WALLCLOCKTIME,,DateTime,DateTime[0]);

If you want a code example e-mail me


regards

kevin
 
example

Does anyone have a code example for a RS5000 GSV that gathers the date and time. Some of the replies on this post are vague and refer to other processors that are simpler. Thanks in advance.

Russ
 
i GET IT

With a little help from a genius here at work I think I understand what my problem was. Word 0 is the year, word 1 is the month, etc. If this is incorrect, feel free to correct me. Thanks for the help guys.

Russ
 
Russ.. the thing that threw me when I first used this was that I wasnt using the proper sized dint. make sure you are using a DINT[7], or else the instruction will do exactly what you said it was doing... display 0 all the time.

Attached is a screen capture for my code.

good luck

wallclock example.jpg
 
setting clock

Men,

I haven't visited this project for a bit. I do have the GSV working, but I noticed a problem. My date and time is not current. I am guessing that I will need to update the processor as far as the date and time is concerned. My thoughts are that this is done with SSV. However, is it common to have an array which the current date and time can be written to, then moved via the SSV into the processor, or is common practice just to one shot the SSV after the date and time has been updated. I'm just wondering what the best way to do this is. Also, after the clock has been set, if I do a simple change and program download, does this clock retain it's status and keep counting before, during and after the download, or will a download cause my clock to be inaccurate? I have a great need for this clock to be correct 100% of the time, if possible. Thanks to all for the input.

Russ
 
Last edited:
Setting Time and Date

Russ

If you want to set the time and date manually, you can do it from the Date/Time tab. Select Edit, Controller Properties, Date/Time and click on Set. You must be online to do this.
 
Last edited:
Russ,

If it is absolutely critical that your clock be correct then I would do it as you mentioned.

I'd have a subroutine that would move the date/time from registers that an HMI can access to a register that has the format the Controllogix is looking for. I'd then set a timer to execute the subroutine however often you feel it necessary to synchronize the time. Your HMI would have to be capable of reading the system time from the PC and have a script to transfer the values to the appropriate tags for the PLC. After all of this you would still be responsible for keeping the time current on the PC though; however you would have the PLC be able to automatically adjust for daylight savings time with this method.

grs
 
Russ
nsted of using all this complicated commands u can also use the processor timer also
Just go to the propertise of controller & set the time date etc as you want & do the programming that will sound or indication at perticuler time
thanks
 

Similar Topics

At the moment on my application (S7-1212C), the PLC/HMI are showing the correct time, i.e. the displayed time matches the time of the clock on the...
Replies
10
Views
880
This old chestnut again... Our clocks (UK) went back an hour yesterday. Now the time displayed on the HMI is 1hr behind what it should be. In...
Replies
24
Views
1,928
The PLC in question is a S7-1212C. The PLC will be transportable on a wheeled trolley and used wherever it's needed in the factory. I've been...
Replies
14
Views
1,278
On the HMI-1200, the Wall clock date shows "1/4/1970". How can I correct this? Can't seem to find where this date is coming from or how to change...
Replies
7
Views
891
Hello all. Would anyone have sample code that uses a wall clock to move the CTU.ACC to a another variable in the PLC after 24-hours has elapsed? I...
Replies
2
Views
1,916
Back
Top Bottom