logix 5000 gsv variables

James Mcquade

Member
Join Date
Oct 2007
Location
Nashville, Tennessee area
Posts
3,683
Hi all,

i'm picking up logix 5000 quickly when it comes to the usual commands.
i was asked if we could bypass (for lack of a better word) a magnetic lock to a door to the office from 6 am to 3 pm, monday to friday so everyone could enter the room if they don't have the security key. this prevents the main person from opening the door all the time for everyone.

the system is controlled by a logix 5583e.
what are the variable names for the day, hour, minutes?
i have a test plc like this one in which i would like to see if i can write the logic and test it using internal registers.
also, what is the variable i use for getting the time from the network server? i read about it, but things are not clear to me.
thanks in advance,
james
 
GSV(WallClockTime, , LocalDateTime, DestinationUDT)

7 DINTs are returned to either of a UDT of:
- Year
- Month
- Day
- Hour
- Minute
- Second
- Microsecond

or a DINT[7] array. Your choice.

A “network server” might supply NTP, but could serve up IEEE 1588 if the box implements precision time protocol. The latter lets you just check a box under the controller properties in Studio 5K, the former requires an AOI from Rockwell’s sample code.
 
Last edited:
so i would create a variable GSV[7]
define year as gsv[1]
and so on?
is this correct?
thanks,
james

Close, you create an array of DINT's, we call it Time, the destination in your GSV is Time[0]. The GSV will populate the array, where Time[0] is the year, Time[1] is the month, Time[2] is the day and so on.
 
Yes, pretty much.

Year is gsv[0], I think, and you are interested in gsv[3] i.e. hour, so

Code:
LIM 6 gsv[3] 14 ...

Is true between 6am and 3pm, assuming the PLC clock is right, you get the local time, and it handles dst.

If you want to add something for weekday/weekend then it gets ugly, I think.
 
Last edited:
dmroeder,

so i would create a dint array of 7 - TIME[6]
time[0] = GSV[0] - year
time[1] = gsv[1] - month
time[2] = gsv[2] - day
time[3] = gsv[3] - hour
time[4] = gsv[4] - minutes
is this correct?
i have done slc500 and i know where these are, but i'm getting into deeper things with logix 5000 and wanted to try and program what i was asked.
thank you,
james
 
dmroeder,

so i would create a dint array of 7 - TIME[6]
time[0] = GSV[0] - year
time[1] = gsv[1] - month
time[2] = gsv[2] - day
time[3] = gsv[3] - hour
time[4] = gsv[4] - minutes
is this correct?
i have done slc500 and i know where these are, but i'm getting into deeper things with logix 5000 and wanted to try and program what i was asked.
thank you,
james

I'm not sure what "GSV[0]" is. Only one GSV is required to do this. Here is the rung text which you could paste into a new rung:

GSV WallClockTime ? LocalDateTime Time[0]

Edit: Also, there has been talk about creating a UDT. I don't believe the GSV will accept a UDT as the destination. I'm pretty sure that you it will only accept a DINT array, you have to then COP the DINT array to the UDT.
 
Last edited:
You can use a UDT. Similar to the array, you must specify the first member of the structure. Such as: GSV WallClockTime ? LocalDateTime MyTimeTag.Year

OG
 
Rockwell have made a Day Of Week Routine, 0 For Sunday, 1 for Monday etc etc

As Attached!

Jes' cuz someone put it in an AOI does not make it elegant ;).

Actually, since 01-JAN-1970 was a Thursday, why not the following, with all tags as LINTs?

Code:
GSV WALLCLOCKTIME ? CurrentValue cv

MOV 86400 uspd                 ### Seconds per day
MUL uspd 1000000 uspd          ### Microseconds (μs) per day

MOD cv uspd ustoday            ### μs this day
SUB cv ustoday cv              ### μs since zero epoch at last midnight
DIV cv uspd cv                 ### Days since zero epoch (Thursday 01.Jan, 1970)
ADD cv 3 cv                    ### Days since Monday before zero epoch
MOD cv 7 cv                    ### Day of week (0=Monday; 7=Sunday)
If L73 doesn't have LINTs, or math instructions cannot write to LINTs, then uglier again with DINT[2]s, go back to that AOI.
 

Similar Topics

Is there any way to use a tag value in the Instance Name field? I would like to have an array of strings with my module names that I can loop...
Replies
2
Views
960
Hey everyone. I am having an issue and can't narrow down the cause. I am losing communications with various Yaskawa drives on a logix5000 network...
Replies
7
Views
1,467
Hi folks! I'd like to add to my PLC logic a way to detect what failure is my I/O module (PowerFlex 525 VFD)having. My goal is been able to array...
Replies
10
Views
4,447
Hello, I always have problems with GSV. I have to prepare a sequence in RS5000, which need to operate only at the set time. For example, from...
Replies
11
Views
2,931
Hello everyone, I am having an issue with random I/O faults on a ControlNet network. In the logic, there is a GSV instruction with LedStatus as...
Replies
3
Views
5,374
Back
Top Bottom