Sign in to follow this  
Followers 0
mikeb

Variable Timer Preset

9 posts in this topic

Hi, I am new to Allen Bradley. I have an ML1100. I need to set up a TON timer, but the preset needs to be adjusted from the LCD & Keys. It looks to me like the preset value in a TON cannot be specified as a data memory, it has to be a constant. Am I correct? What is the best way to achieve this? I was thinking of using a data register and increment it with a clock pulse, then compare with the value from the LCD, but even that doesn't seem simple. If it was a Mitsi, I would use a D register for the timer value...easy! Thanks in advance.

Share this post


Link to post
Share on other sites
Use a MOV instruction to move a value from an integer to the preset. MOV N7:0 T4:0.PRE

Share this post


Link to post
Share on other sites
Thanks for that. Its the sort of thing thats obvious when you know.

Share this post


Link to post
Share on other sites
Glad to help

Share this post


Link to post
Share on other sites
No, you're not really correct. It is data memory, its not anything else. First off, a timer is not a device. It is a computer instruction that operates on a section of memory. The AB supports strong data types, and a T file is a section of memory where the words are divided into three word groups for use by a timer instruction. The timer preset is one of the words in the timer data structure located in memory, just like an integer (in fact it is an integer). The preset in any time structure is at the memory address TX:X.1. Using .PRE is a shortcut supported by the programming software to enforce strong data typing. You can pre program that word to be a particular value when you enter the timer instruction. You could also leave it at 0 and have that word in memory written to programatically. You can also program most HMI devices such as a Panel View, or the Redlion G3 or the C-More, and many others, to write directly to any desired word address of not only N files but also any word of a T file, C file, R file, etc. So depending on what LCD/keypad you are using you can probably write directly to the preset word of your timer memory. However if your HMI does not support range limiting then better practice is to write to an N word and include logic to make sure that a valid preset has been entered. Edited by Alaric

Share this post


Link to post
Share on other sites
One caveat to Ken's suggestion be sure and limit check N7:0 somewhere. For example. GEQ N7:0 0 MOV N7:0 T4:0.PRE. I can guarantee that if you move a negative number into T4:0.pre the cpu will fatal crash. Actually used this fact onetime as a troubleshooting aide in a high speed sorter to halt program execution when a set of conditions was true.

Share this post


Link to post
Share on other sites
Yep, should have included the range checking. A negative preset will always fault a cpu, I use this to check my fault shutdown logic.

Share this post


Link to post
Share on other sites
Thanks for all the replies. I understand it all much better now. I'm using the built in keypad and LCD on an ML1100, to allow the timer value to be adjusted. After more searching I found a whitepaper on the Rockwell website that described what I want to do. As I said i'm finding my way with Allen Bradley at the moment. I've used Mitsubishi for so long now, that it just takes a bit of time to get to grips with a different way. Once again thanks to you all, I should get to test it out later in the week.

Share this post


Link to post
Share on other sites
Slightly off topic Mike, but the Mitsi's power up with all real world outputs off until the program turns them on - correct? If so BE WARNED, AB uses an output table to record the last state of the output and this is the state it powers up to until the program changes it. This was a big key learning for me when I shifted from Toshiba and Omron PLCs to ABs.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0