RSLogix500 TON preset - setting from HMI

technolog

Lifetime Supporting Member
Join Date
May 2015
Location
Ohio
Posts
320
I'm new to Allen-Bradley PLCs & RSLogix 500 - cue stupid question - and I want to set a timer preset value from an HMI. I was surprised to see I could only put a constant numeric value into the Preset field of the TON instruction

I've googled and I'm MOVing the value to the .PRE value of the timer. I've set the Preset field to 32767 and perform the MOVe on the next rung. I'm guessing that it will work okay but it seems very inelegant. Won't the preset value be written to 32767 briefly on each scan before being written back to the required value?

Is there a better way to do it?

TON preset.jpg
 
When you set up the numeric entry object in the HMI, you should be able to select "T" and the data table (or memory) type, a number for the address of the timer and ".pre" for the FLAG.

If the HMI doesn't have that capability, reference an "N" address with the numeric entry object, then MOV that value into the timer preset in your ladder, like this:

SOR MOV N7:0 T4:0.PRE EOR
 
As rdrast said, you can write directly to T4:0/PRE and also T4:0/ACC if you wish, the same way you can write to N7:x.

Shawn
 
Thanks rdrast, that's not a bad solution. So my 32767 in the TON Preset field is good, correct, sensible, needed? As I see it, if I left it at the default of 0, then the timer would timeout every scan, or is that not how it works?
 
When you drop the TON/TOF instruction on the rung, during programming, you can put a value there and never change it again. You do not need to keep MOVing a value to /PRE in your logic.
 
Just point your HMI tag to T4:x.PRE.


I would not do that, its always a good idea to check the value for limits
to prevent faulting the processor and setting the value to some unwanted setting. So write to an integer, then check it for limits, then move it to the timer's preset.

The limit instruction works well for this. ("LIM" instruction)
 
When you drop the TON/TOF instruction on the rung, during programming, you can put a value there and never change it again. You do not need to keep MOVing a value to /PRE in your logic.

I think you're suggesting hard coding the value into the TON instruction. I need the operator to be able to set the time delay from the HMI at runtime.
 
Welcome to the forum.


Won't the preset value be written to 32767 briefly on each scan before being written back to the required value?

To answer your specific question, the very first time your program is run after you download it the preset will be 32767 on the first scan. Then after that it will be the integer value in N10:0. It won't change back to 32767, and if you went online and looked at the preset you would see the new value written from N10:0 as the preset.

Is there a better way to do it?
Yes, reorder the rungs so that the move instruction is before the timer instruction.


Note that when you enter a value for a timer preset when you program, you are not hard coding the value of the preset to be some particular value. The value you enter is actually being pre-placed in memory in the timer element preset, not actually being set in stone by the ladder code. If you want to verify this for yourself, open the T4 file in the left hand project pane, scroll to the timer, and change the value of the preset in memory. Now go back and look at your rung. You will see the new value reflected on the rung.

I do recommend checking the value entered against limits as Mickey suggested. Whether you have the HMI perform the limit check and then write the value directly to the T4:XX.PRE or whether you have the HMI write the value to an integer and then perform a limit check in your PLC program before MOVing it to the timer preset is up to you.
 
Last edited:
I generally write to an integer and then copy it to the .PRE of the timer.

Since I started programming a long time ago, I group all my data to/from my HMI together to minimize the separate number of read/write messages needed. This used to be very important for not slowing down comma. Now you can get away with a lot more with Ethernet comma but I still tend to keep things together out of habit.

I generally reserve the B13 file and N17 file just for HMI values.
 

Similar Topics

So here's my situation, I have been tasked with modifying the logic to mimic a button press in the PLC. I have two identical machines however one...
Replies
6
Views
539
Hello, I'm new to programming. I'm using RSLogix500 to modify an existing program for a SLC500. My plan was to use one of the existing inputs...
Replies
26
Views
1,984
So i have an allen bradley rack (2080-LC50-24QWB), i have it connected through ethernet. I dont have an offline program so im trying to upload...
Replies
6
Views
678
Hi Everyone, I am supporting a system which runs on a SLC 500 (1747-L532). A fault has developed whereby the output state of some digital outputs...
Replies
10
Views
997
Hello, I am currently taking a course on plc programming and in the course rslogix 500 is being used. I am however having a problem since it keeps...
Replies
4
Views
1,698
Back
Top Bottom