[Logix] User adjustable time delay

defcon.klaxon

Lifetime Supporting Member
Join Date
Feb 2015
Location
Far NorCal
Posts
616
Hi guys,

So I'm working on getting a user adjustable time delay implemented in Logix, but it seems like there isn't a built in instruction for this. Basically I want to create a time delay for alarm bits, so that if an alarm condition goes true, it has to remain true for a time delay before the alarm bit is set high and sent to the HMI. The closest thing I can find is a TON, but that's not exactly what I want. The TON enable bit immediately goes true when its rung is energized; I want the enable bit to stay low until the timer reaches a setpoint. Now I could still do that with a TON by using the .DN bit that goes true once the timer delay "preset" has been reached, but the problem is that the TON preset is actually an "immediate" value, and can't be linked to a tag (or so it seems, at least). I need the ability to let the operator on the HMI change the delay setpoint (preset), so without being able to link the preset to a tag this seems impossible.

My workaround so far is to use a TON with a ridiculously high preset, and then use an EQU to compare the TON accumulated counter value to a tag that is adjustable; it works, but I wouldn't exactly call it graceful. I was wondering if there was a better way.

Thanks!
 
Use the .DN bit of the TON.

Before your TON instruction place MOV statement. MOV 'SETPOINT_TAG' to 'TIMER.PRE'.

I personally use a MUL instruction as the setpoints on an HMI are in seconds, so a MUL 'SETPOINT_TAG' x 1000 to 'TIMER.PRE' converts it to ms for the timer to be happy.
 
but the problem is that the TON preset is actually an "immediate" value, and can't be linked to a tag (or so it seems, at least).

Can you detailed what you tried (and seemed to fail at) that led you to the above conclusion?

I tested and an alias can be made for the preset of a timer.

I use HMIs to write into timer presets all the time. With a Panelview Plus I do the conversion between milliseconds and seconds in the panel tag definition.
 
Last edited:
Use the .DN bit of the TON.

Before your TON instruction place MOV statement. MOV 'SETPOINT_TAG' to 'TIMER.PRE'.

I personally use a MUL instruction as the setpoints on an HMI are in seconds, so a MUL 'SETPOINT_TAG' x 1000 to 'TIMER.PRE' converts it to ms for the timer to be happy.

Oh man, thanks so much! I had no idea I could write directly to the .PRE field. And great thought on the MUL too, so I can take care of ms to sec without add'l logic and tags. Thanks again!
 
Can you detailed what you tried (and seemed to fail at) that led you to the above conclusion?

What I did was create the TON instruction block in ladder logic, and when I tried to enter a tag for the Preset value it wouldn't accept it. When I checked the Help file, it says the Preset field is an "immediate" data type, as opposed to "tag". Thus, it seemed like I was unable to pass a value to the Preset value.

I tested and an alias can be made for the preset of a timer.
That's a great solution, thanks for suggesting it. User Paully's5.0 suggested using a MOV function to do the same, so it seems like there's more than one way to do it. I guess because it's a value attached to the timer, you can't directly link a tag to it. Wish they would have mentioned that in the Help file though! There's an awful lot to keep track of when using Logix it seems.
 
OK so I've gotten the changes made and it's somewhat working, but I've come upon a quirk I can't figure out (ladder logic attached below).

qv4WE9r.png


Basically what I'm doing is using a GSV via Module EntryStatus to get comms link info (that is on a ladder rung above this screen grab); if the connection is made the value is 16#0000_4000; as you guys all probably know, the 4 will change to a 3 if attemping to connection, and 1 if the connection has timed out and failed. I mask and divide that down to a simple integer of 4, 3 or 1.

Based on that status value, I use an NEQ to say if the comms status is not equal to 4, then energize the timer. I then use the Timer.DN bit as the delay to energize a latching Fail bit; I also use the Timer.DN bit as an XIC to then de-energize the timer until the alarm is reset. The thing is though, it's not working; the timer keeps looping over and over; I do get the COMMS_Fail latch to energize but the Timer.DN bit doesn't stay energized; it resets so quickly I can't even see it change value. In my previous method it actually was working, but now it's not. Am I missing something? Could it be because the MUL is potentially re-writing the Timer.PRE field on the rung above? If I change the XIC to the COMMS_Fail bit the logic works as intended but I'd like to understand by the Timer.DN isn't doing what I assume it would.
 
Last edited:
The DN bit turns ON, the timer resets which turns the DN bit OFF which lets the timer start timing again.

It is the standard method for making a self-resetting cycling timer, in your case a DN pulse for one scan for each preset time (ok, technically 1 preset time plus the time for one scan.)
 
Last edited:

Similar Topics

Howdy Everyone, I am doing a project with micrologix 1400 1762-L32BWA, where we talk thru message bits one direction and talk thru the discrete...
Replies
1
Views
418
Hey everyone, I am looking for a tool to parse PLC data and I believe pylogix may be the best approach. I am very new with python but can see its...
Replies
1
Views
864
I'm trying to read a tag from a user defined data that is an array. This is the data type. This is the tag I'm trying to read...
Replies
13
Views
3,250
Hello. This is a really basic question. I am puzzled by the data type size reported for a user defined type with eight one-bit elements. Why is...
Replies
3
Views
2,275
hi I would like to know if somebody already try to implement specific communication protocol thru MVI69E-LDM (from prosoft) to be able to...
Replies
0
Views
1,543
Back
Top Bottom