Studio 5000 DINT addressing

kirk

Lifetime Supporting Member
Join Date
Jul 2003
Location
Houston
Posts
71
So I am working on a clock and they are DINT sddresses
but when I try to look at it on an bit or word level it won't validate, so I must have the addressing wrong.

So I have a GSV WALLCLOCK
and a SSV to set the WALLCLOCK

When I try to pull out one element or set the time I write the address as the Tag name (in this case SET_PLC_TIME)

So I try to set the YEAR I write it SET_PLC_TIME(0) wanting to move the year into the 0 slot and it won't validate

So I try to write it SET_PLC_TIME.0
Still won't validate

What am I missing???

I also want to use the Hour setting PLC_TIME(3) in the GSV WALLCLOCK in a compare command.

Just because that is the second part of the equation that is coming.


DINT address.jpg
 
Is SET_PLC_TIME an array of DINT[7] or just a DINT?

Your GSV/SSV should also reference the first element of the array, so these are correct forms:
GSV(WallClockTime, , DateTime, PLC_TIME[0])
SSV(WallClockTime, , DateTime, SET_PLC_TIME[0])

If you set up your DateTime type as a UDT, then it's:
GSV(WallClockTime, , DateTime, PLC_TIME.Year)
SSV(WallClockTime, , DateTime, SET_PLC_TIME.Year)

FYI:
- DINT.x is a bit-level reference of an atomic type.
- DINT_Array[x] is an indexed item of an array (what you're going for).
- DINT_Array[x].y is a bit-level reference of an indexed item of the array.
- The DateTime attribute of the WallClockTime class is UTC time. DateTimeLocal might be the one you're aiming for.
- WallClockTime updates can only occur once every 15 seconds, so you might condition the SET_TIME action to be one-shot and conditioned for a 15-second timer being elapsed.
 
Last edited:
Is SET_PLC_TIME an array of DINT[7] or just a DINT?

FYI:
- DINT.x is a bit-level reference.
- DINT[x] is an index into an array (what you're going for).
- DINT[x].y is a bit-level reference of an index of the array.

That makes sense and is what I thought (coming from a RSlogix 500 )

I am unfamiliar with the [7]
Is that the "array dimensions"???

DINT1.jpg

DIN2.jpg

DINT3.jpg
 
Yes, the array dimension is the size of the array. You can sort of think of it like creating a new integer file (i.e. N10) in the SLC 500 and specifying how many elements the file would have. Where you see "Dim 0" just set that to 7. or when creating the tag, you can manually type [7] after the data type, such as DINT[7].

OG
 
Last edited:
What's "wrong" is that a MOV does not work on a bit. Since SET_PLC_TIME is a mere DINT, SET_PLC_TIME.0 is referencing a bit. MOV only works on words (DINTS, INTs, REALs, etc.)

The REAL problem is that, to get all the WallTimeClock data, SET_PLC_TIME needs to be a DINT[7] array datatype, not a mere DINT. Then SET_PLC_TIME[0] will hold the year, SET_PLC_TIME[1] the month, and so on.
 
DINT4.jpg

DINT5.jpg

I see where the MOV is wrong, EASY fix

BUT when I Try to fix the DINT[7]
It invalidates the rung ?????
 
Code:
MOV SET_YEAR        SET_PLC_TIME[0]
MOV SET_MONTH       SET_PLC_TIME[1]
MOV SET_DAY         SET_PLC_TIME[2]
MOV SET_HOUR        SET_PLC_TIME[3]
MOV SET_MINUTE      SET_PLC_TIME[4]
MOV SET_SECOND      SET_PLC_TIME[5]
MOV SET_MICROSECOND SET_PLC_TIME[6]
?


Update: could not get all caps w/o this.
 
Last edited:
The MOV rung is invalid because the specific DINT elements of SET_PLC_TIME are not being reference by the instruction, only the big 7-DINT array. The MOV doesn't know where you want 1 DINT of data to go, since it has 7 to choose from.

Note how in the Year MOV, where you have SET_PLC_TIME[0], it shows the current value as '0', where in all the others, you have '???'. That's your hint as to where the problem lies.

The SSV rung is also invalid, but for a weird reason. When SET_PLC_TIME was a DINT, the software could show the value, and did (0). When you changed it to an array (DINT[7]) that "place" in the block where the value was displayed became invalid. But the "place" was still there.

Just delete the "???" in that block, and the problem with that rung will be fixed.
 
Mov set_month set_plc_time[1]
mov set_day set_plc_time[2]
mov set_hour set_plc_time[3]mov set_minute set_plc_time[4]mov set_second set_plc_time[5]mov set_microsec set_plc_time[6]





?

Cool,

but I have a few more questions.
MAINLY, when I set my DESTINATION tag to PLC_TIME or SET_PLC_TIME to DINT[7] the rung will NOT VALIDATE

I get a Error: Rung 0, GSV, Operand 3: Invalid array subscript specifier.

EDIT:
I can't delete the ?? they say they are unknown and populate the ?? Automatically

If I set the dim 0 to "0" the rung will validate

Everything will validate with the dim 0 to "0" it just isn't right.

It

DINT6.jpg
 
Last edited:
Ah. Sorry about that.

The SSV need to reference SET_PLC_TIME[0], not merely SET_PLC_TIME (or SET_PLC_TIME[7] --which doesn't exist. A 7-element array counts from [0] to [6]). Then that '???' will go back to '0', and all will be right with the world.

(serves me right for not duplicating your results in my own copy)
 
I GOT MY MOV TO VALIDATE

THANKS.

The Question is the destination and Source addresses for the GSV and the SSV

They will viladte with a Dim of "0" but not validate with dim "7"
Or a Dim of "0" and a tag name TAG[7]
 
One last question.

On GSV and SSV

is a command only good for 1 Element or will it pull all 6 elements with one command?

In other words do I have to have 6 separate SSV commands with separate "source" addressed Tag[0] thru Tag[6]

and 6 separate GSV Commands with a separate "destination" addresses Tag[0] thru Tag[6]?

It looks that way to me, but if there is a cleaner way, I like my logic as clean and basic as I can get it.
 
They will validate with a Dim of "0" but not validate with dim "7"

The "DIM" is done when creating the tag:
attachment.php

In this case, a DINT[7] datatype.

The "Reference" is pointing to a specific location in the tag. The base location for the data to go is in the first element of the array, or TAG[0].

In theory, you could have created PLC_TIME as a DINT[14] datatype and used PLC_TIME[0] for the GSV and PLC_TIME[7] for your SSV, with elements 0-6 for the current time, and 7-13 for the set time.

But that would have been more confusing. I'm just using it as an example to help you understand the concepts.

PLCs_net.png
 
is a command only good for 1 Element or will it pull all 6 elements with one command?

When the GSV/SSV performs a WallTimeClock function, it gathers 7 pieces of data at the same time, and shoves that data (or as much as it will fit) into the Destination tag.

As with my DINT[14] example, if there is more space (14) than is needed to hold the result (7), the GSV won't change the extra data. I'm not sure how the SSV would react if it had too little data to write (DINT[6], leaving off the msecs). Most likely just write what it could.

Helping strangers is what we do here.
 

Similar Topics

Just something I think about when choosing data types in Studio 5000. It seems logical, but I've never looked deeply into the question. When...
Replies
12
Views
1,354
I was just curious if there is a way to search for a description of a boolean contained within a DINT/INT. For instance, I have a DINT[1] named...
Replies
6
Views
2,259
Hey! Quick question. Is there a quick and easy way of recurrently move safety inputs to a DINT for example? This is the idea but for obvious...
Replies
4
Views
1,812
I'm being directed to fill process values into an array of DINTs. A portion of the REAL values got copied into 2 DINTs each, but there are more...
Replies
2
Views
2,284
I am fairly new to Controllogix and have been thrown into the deep end in a Project. I am trying to read my digital input tags from the plc...
Replies
3
Views
6,287
Back
Top Bottom