constants in rs5000

DairyBoy

Member
Join Date
Jun 2007
Location
UK
Posts
393
I'd like to set a L32e processor rtc to account for daylight savings, so I set up a SSV instruction and tried to set a "1" as the source value. When that was rejected, I created a tag, set as a constant, in the tag editor. Is it necessary to use a separate move function to set a "1" in that tag? Seems very long-winded. Any advice gratefully received.
 
What version is the firmware in your PLC.

Versions 15+ should compensate automatically.

Have you used the RSLoigx 5000 clock update tool that can be found under RSLogix5000 tools?
 
Last edited:
If you are writing to the WallClockTime object (or LocalWallClockTime?) I think (going from memory) you need to write an array of (7?) DINTs. So, you need an array tag with each dint containing your values. You should be able to type them into the tag editor window and save it with your file. Once those values are in the PLC they should stay as long as they are not overwritten.
 
Aha! So the constant selection is hidden in plain view in the monitor tab. But I'm editing. :confused:

OkiePC, it's a SINT with a value of 1 that needs to be written to the WallClock attribute "ApplyDST" (when did the term "wall clock" replace good old "RTC"? It's in the rack, not on the wall). This 5000 thing takes some getting used to. Thank you for the help.
 
Aha! So the constant selection is hidden in plain view in the monitor tab. But I'm editing. :confused:

OkiePC, it's a SINT with a value of 1 that needs to be written to the WallClock attribute "ApplyDST" (when did the term "wall clock" replace good old "RTC"? It's in the rack, not on the wall). This 5000 thing takes some getting used to. Thank you for the help.

I don't know why you are trying to SSV the "ApplyDST" attribute. DST is applied automatically in the Logix5000 clocks as far as I know. I've never needed to "ApplyDST" ever. Just need to configure the "locale" and all is good....

PS If I get time (no pun intended) - i'll run a few tests tomorrow
 
You shouldn't have to program anything.

In RSLogix5000 open the controller properties. Pick the Date and Time. Set your time zone. Put a check in the use daylight savings box.
 
Daba, I used it beceause it's the first attribute on the "Accessing the wallclocktime object" in the document that ra sent a link to, and as it requires a nonzero value to enable it, it seemed reasonable to me that it required setting manually.

Alaric, I had looked in the date/time tab as a matter of course when I first set up the application, but they're all greyed-out, so I moved on and didn't think to go back. As they're still greyed-out, does this suggest an online facility only?
 
Just to clarify the ApplyDST attribute - setting this by SSV is exactly the same as going to the Date/Time tab of the controller properties (when online), and checking the "Adjust for Daylight Saving (+0:00)" option.

Also, the amount of minutes that DST adjustment incurs is automatically selected by choosing the correct Time Zone.

All of this configuration is stored in the controller system values, and saved in the project file, so a subsequent download will restore the configuration.

So, in my opinion there is no need to SSV anything at all to the WallClock, except perhaps to re-synchronise the clock from a time-server, or "master" clock in the system.

Once you have made the configuration you want to work with on the Date/Time tab, those settings will persist.

Of course, if you want to programaticaly switch between DST adjustment and "standard" time in your application, or even to change the date/time to different locales, then it is perfectly OK to SSV this setting. If not, then you have code in your program that is using memory and scan resources, and it is not achieving anything.

However, if you want to guarantee these settings are made, then it is a good idea to put the SSVs into an intialisation subroutine called on first scan only (S:FS), or even use the dedicated Power-Up Handler in the Controller section of the organisor. That way the scan-time will not be compromised continuously.

HTH
 
Not a "dirty trick" as such, but a useful piece of info that helps when using GSV/SSV instructions.

The help will tell you what the data structure GSV/SSV requires.

In the case of the WallClock object, it will tell you that the data is a DINT[7] array. However, there is nothing to prevent you building a UDT that looks like a DINT[7] array - and the GSV/SSV will work just the same, so long as the UDTs bit/byte/word/dint structure is consistent between what the Help says is the data structure.

The WallClockTime attribute is defined as a DINT[7] array.

DINT[0] = Year
DINT[1] = Month
DINT[2] = Day
DINT[3] = Hour
DINT[4] = Minute
DINT[5] = Second
DINT[6] = MicroSecond

But you could easily make a DateTime UDT with the following members, in this case declare them all as DINTs

.Year
.Month
.Day
.Hour
.Minute
.Second
.uSecond

When programming your GSV/SSV, the Destination/Source address will be the first member of the tag you create from the UDT - e.g. PLCTime.Year

This can be done for any Sytem Value object, just make the UDT the same shape/size as the data declared in the instruction Help.

It all helps to make things more readable and "visible"....
 

Similar Topics

Hi, Have done a few programs with CCW and am slowly getting my mind around it. Previously I have used compare instruction blocks to start drives...
Replies
4
Views
2,185
More dumb questions from the 'Janitor: In this program I've been looking through (that I didn't write), I see hard-coded constants which are...
Replies
5
Views
2,792
HI, i am having trouble trying to differentiate between 2 strings using just integers, so i need to do a string compare and use the letters to...
Replies
4
Views
3,056
Working with AOIs, I want to create a Tag that has a constant value. I see that "Constant" is greyed out for all Locals. Is the only way to make...
Replies
12
Views
5,356
Structured text on the S7 system allows for the definition of program constants using the CONST and END_CONST key words. Is there anything broadly...
Replies
0
Views
3,059
Back
Top Bottom