Loading .Pre in an array of timers?

Don't forget the god of all arithmetic functions, FAL. Should be able to do this in one rung. You can copy a single value as in this case or even an array of values into a selective field of an array structured tag such as timers and counters. Remember FAL is not available with the SLC platform.
 
I would agree whole-heartedly Paul, simple is best, when simple suits.

As JeremyM is pointing out, using the above logic it's possible to index through many elements using more concise logic instead of many individual rungs, which of course is also fine and can be edited in quite quickly and easily using a word processor.

I suppose I was tempted, as we often are, to solve the riddle using ladder logic in as concise a method as possible, but not necessarily the simplest.

However, what is missing from my rungs, and would normally always be present, is VERY detailed comments. These would describe exactly what each rung and its instructions are doing.

Another option is to can the logic into an AOI.

Structured Text I feel though would probably be best here, as Ken pointed out, but that option is not available to most general users, so I stuck with ladder logic.

dginbuffalo said:
...I can copy a timer data type to an array of timers...

Pay attention in class! 👨🏻‍🏫

As JeremyM has also pointed out (you're doing a lot of that here!), and as was my very point in the above post, you cannot, successfully, copy a Source element of one data type to a Destination element of the same data type, if that Destination element resides in an array.

The resultant data will be erroneous.

First...

MOV MASTER_MOVE_TIMER to VALVE_ALARMS[0] (assuming VALVE_ALARMS is an array of TIMER data type elements?)

Then...

COP VALVE_ALARMS[0] to VALVE_ALARMS[1] for Length 59 (not 60)

The Length is decremented by 1 because the first element VALVE_ALARMS[0] is already copied to and the remaining 59 just need copying.

The resultant data will be valid.

Regards,
George
 
DaveW said:
Don't forget the god of all arithmetic functions, FAL. Should be able to do this in one rung. You can copy a single value as in this case or even an array of values into a selective field of an array structured tag such as timers and counters. Remember FAL is not available with the SLC platform.

Dave,

I'm curious about the FAL instruction? (I know how it operates)

What would you assign to the FAL's Destination to copy into TIMER[0].PRE?

Something like...

TIMER[0,CONTROL_TAG.pos] or what?

How would you then step onto the next correct positional element within the next member of the array?

It looks tricky, but I'd like to see a working example.

Regards,
George
 
I would agree whole-heartedly Paul, simple is best, when simple suits.

As JeremyM is pointing out, using the above logic it's possible to index through many elements using more concise logic instead of many individual rungs, which of course is also fine and can be edited in quite quickly and easily using a word processor.

I suppose I was tempted, as we often are, to solve the riddle using ladder logic in as concise a method as possible, but not necessarily the simplest.

However, what is missing from my rungs, and would normally always be present, is VERY detailed comments. These would describe exactly what each rung and its instructions are doing.

Another option is to can the logic into an AOI.

Structured Text I feel though would probably be best here, as Ken pointed out, but that option is not available to most general users, so I stuck with ladder logic.



Pay attention in class! 👨🏻‍🏫

As JeremyM has also pointed out (you're doing a lot of that here!), and as was my very point in the above post, you cannot, successfully, copy a Source element of one data type to a Destination element of the same data type, if that Destination element resides in an array.

The resultant data will be erroneous.

First...

MOV MASTER_MOVE_TIMER to VALVE_ALARMS[0] (assuming VALVE_ALARMS is an array of TIMER data type elements?)

Then...

COP VALVE_ALARMS[0] to VALVE_ALARMS[1] for Length 59 (not 60)

The Length is decremented by 1 because the first element VALVE_ALARMS[0] is already copied to and the remaining 59 just need copying.

The resultant data will be valid.

Regards,
George

Geo- Thanks. I shot my proverbial load too quickly while only glancing over all the responses and pictures :)

I really appreciate all the feedback and examples. I knew there would be a way, or many ways to skin this cat. 🍺
 
hi Geospark
Sorry to go off on a tangent but what package are you using for your screenshot markups?

As for the task in hand another alternative would be OPC/DDE from excel to initialise the presets but that is a whole new topic
 
Variables required
DINT_ARRAY[0..89]
TIMER_ARRAY[0..29]
PRESET_DINT_ARRAY[0..2]
HMI_PRESET_TIME as DINT
FAL_CONTROL1 as Control

Then I assume the below code will work, although I haven't tested it

Code:
NEQ HMI_PRESET_TIME PRESET_DINT_ARRAY[0]
MOV HMI_PRESET_TIME PRESET_DINT_ARRAY[0]
FAL FAL_CONTROL1 90 0 All DINT_ARRAY[FAL_CONTROL1.POS] PRESET_DINT_ARRAY[FAL_CONTROL1.POS MOD 3]
COP DINT_ARRAY[0] TIMER_ARRAY[0].PRE 90
 
cjd1965 said:
hi Geospark
Sorry to go off on a tangent but what package are you using for your screenshot markups?...

Good ol' MSPaint "package". I'm a dab hand with it, you know?

(The real secret is they are Dropbox linked, so high res)

cjd1965 said:
...alternative would be OPC/DDE...but that is a whole new topic...

I see what you did there...OPC...topic...

dginbuffalo said:
...many ways to skin this cat

As always, and the FAL methods mentioned above are also looking good...

Forum_FALs.bmp


Regards,
George
 
I've got a feeling I'm going to have a few more missions with this:

Mission #1:A way to know if any of the timers are done?

Mission #2:An easy way to set the timer array done bits into FTV ME alarms? Right now I'm figuring I'm just going to export to Excel to make it easier and then re-import.

Fun fun!!
 

Similar Topics

How can I access the web page that allows me to see and upload the pcl or translation file into my Pl1000E? My Pl1000E doesn’t have an ethernet...
Replies
2
Views
125
Hi guys, I have had some issues with uploading a program from a Micro 850 PLC. This is the first time connecting so I don’t have a file on my...
Replies
8
Views
285
Hi everyone, I want to upload the program from my CPU317TF-2 DP to my PC via connecting to CP 343-1 Advanced since it has LAN ports and the CPU...
Replies
1
Views
167
Hi all, Im stuck trying to support a client with Motorola ACE.. I was able to upload all of the other sites to STS but one. Im working remotely...
Replies
0
Views
112
how do you load from [A] floppy disk to laptop 9030 program
Replies
3
Views
150
Back
Top Bottom