RSLogix5000 production counters and FT View

peelseeds

Member
Join Date
Mar 2012
Location
Not at your house.
Posts
71
I need a way to track parts on a daily/yesterday and weekly basis. I am curious what the gurus here can suggest me.

basically, I was thinking of using the GSV WallClockTime->LocalDateTime and start comparing if the LocalDateTime matches my shift time conditions than to write to a tag, and then shift the tags on the next day. Once the next week starts everything will reset.

Let me know if anything is unclear.
 
I'm already stuck with my method...

I cannot copy WallClockTime->LocalDateTime to a user-defined data type.
I've tried creating 2 different DataType. 7 single DINTs and a DINT[7] (to match the data type of WallClockTime->LocalDataTime , but I cannot accept my rung changes. it gives me ;

Error: Rung 2, GSV, Operand 3: Invalid data type. Argument must match parameter data type.

what am I doing wrong :(
 
Use an actual DINT[7], not a datatype that includes a DINT[7].

You'll need both a GSV and a COP (length 1) instruction to get the data into a tidy UDT, but that's not too much effort.
 
Sorry Ken, I need a little help before I attempt this.

first off, I can't get any tag populated with the WallClockTime->LocalDateTime .

I've tried, DINT, DINT[6], DINT[7] nothing is populating. I can only accept my rung edits when teh tag is just a DINT; but then that tag is never populated.

note: its in the schedule - other instructions are being populated. ie: CurrentValue is filling the user-tag but not this localdatetime.
 
I am very confused why this doesn't work.


LocalDateTime
DINT[7]
GSV
SSV
The controller local date and time in human readable format, as follows.

Value
Meaning

DINT[0]
Year

DINT[1]
Month (1...12)

DINT[2]
Day (1...31)

DINT[3]
Hour (0...59)

DINT[4]
Minute (0...59)

DINT[5]
Seconds (0...59)

DINT[6]
Microseconds (0...999,999)


If I create UDT "mylocaldatetime"
and have a DINT[7] (it matches the LocalDateTime datatype) but yet it tells me invalid data type, but a DINT will be accepted... I'm frustratingly confused.

I tried creating a DINT for each.. YEAR [DINT], MONTH [DINT]...etc.

if I add LocalDateTime to my ControllerTags its a DINT and nothing is populated....

could someone clarify this to me?
 
If I create UDT "mylocaldatetime"
and have a DINT[7] (it matches the LocalDateTime datatype) but yet it tells me invalid data type, but a DINT will be accepted... I'm frustratingly confused.

The trick here is what Ken said earlier. Let me rephase it. You do NOT want to create a UDT.

From controller tags "Edit Tags".
Make "mylocaldatetime" a DINT datatype.
Now click in the Type field and click on the "..." button next to DINT.
Now enter 7 in the "Dim 0" field.

This is what Ken meant by an actual DINT[7] and it should work.

Ecapsulating a DINT[7] inside a UDT doesn't work.
 
Last edited:
Here's how I've always done this....

First create a tag named "TempLocalDateTime". Make its Data Type a DINT with length of 7.
Capture2.JPG


Then I create a UDT called DateTime and set it up as shown
Capture4.JPG


Then I create a tag of that data type called MyLocalDateTime
Capture3.JPG


Here's the code:
Capture1.JPG


Pretty much exactly what Ken was describing above. The "Dest" of the GSV command is looking for the first element of an array of DINT's. You must include the [0] at the end of the tag name for it to work. It will start there and populate the next 6 elements accordingly.

The COP command then takes that array and shoves it all into a cute little UDT so that you don't have to remember what order all of the information is sorted in when you want to use the information later in the code. Just use "MyLocalDateTime.Month" or "MyLocalDateTime.Second", etc.
 
Definitive answer from someone who knows...

Whenever you use a GSV to retrieve any controller status info....

The destination you specify should be a physical location.

Let me expand...

WallClockTime needs a DINT[7] destination to store the fetched data. This just means there needs to be a DINT[7] destination (or one that looks like a DINT[7] space for the data. i.e. a UDT).

Whether the destination is an array, you always need to specify the start element...

Now[0] (where Now is an array tag)

if a UDT...(eg. Year, Month, Day, Hour, Min, Sec, uSecond)

Now.Year
 
awesome! thank you cbuysse for your wonderful tutorial. I successfully got it to populate but I've changed things based on Daba's response.

massive thanks to Daba! Basically I was not specifying the start element. I needed to specify the first element in the array (now[0] (regular tag) or now.year as its the first element in the UDT in this example)

Much more clear now.

also thank you to everyone who contributed. seems there is a million ways to skin a cat with everything hehe
 
Of course once you understand why.....

1. The DINT[7] destination that is required could be in the middle of another defined array

2. The UDT could be nested inside another UDT.

whichever way you look at it, GSV needs to be told WHERE to start writing the data it fetches from the system area, and WHERE needs to be a specific data location, not just the name of a tag.
 
Here's how I've always done this....

First create a tag named "TempLocalDateTime". Make its Data Type a DINT with length of 7.
View attachment 24258


Then I create a UDT called DateTime and set it up as shown
View attachment 24260


Then I create a tag of that data type called MyLocalDateTime
View attachment 24259


Here's the code:
View attachment 24257


Pretty much exactly what Ken was describing above. The "Dest" of the GSV command is looking for the first element of an array of DINT's. You must include the [0] at the end of the tag name for it to work. It will start there and populate the next 6 elements accordingly.

The COP command then takes that array and shoves it all into a cute little UDT so that you don't have to remember what order all of the information is sorted in when you want to use the information later in the code. Just use "MyLocalDateTime.Month" or "MyLocalDateTime.Second", etc.

Cut out the middle man, you don't need the DINT[7] array at all....

Simply GSV your wallclock time directly into a tag of your data-type DateTime - the GSV destination should be XXXXX.Year (where XXXXX is the tagname you create of data-type DateTime
 

Similar Topics

Hi! So my problem is a little funky, I had Studio 5000 v 24 and 30 installed, but forgot to install RSLogix (which I cannot go without). Is there...
Replies
2
Views
116
So I had an odd request from a customer for the above. I have written the logic and tested it all in one PLC with only using 7 outputs and 7...
Replies
15
Views
427
Hello everyone, I have an RSLogix5000 project which is running live in the factory but I need to make some changes to the logic. I want to test...
Replies
0
Views
1,120
Good Morning Everyone, I'm looking to use the GSV instruction to get I/O fault codes for my project so I know if there's a comms issue in my E/IP...
Replies
5
Views
868
The machine is running production. When trying to go online with the laptop the whole machine looses communication and faults out. Drives, HMI...
Replies
13
Views
1,934
Back
Top Bottom