Sign in to follow this  
Followers 0
Bridrum22

TIM instruction not working

9 posts in this topic

HI All. Hope someone can help. I am writing a program to a CP1L unit and for some reason i cannot use the TIM instruction it just appears as a red end statement kinda of box. When I try to type in Tim in the instruction box I keep getting TIMHX and I do not want a high speed timer for this function. Cheers Brian

Share this post


Link to post
Share on other sites
If you use TIMX (binary timer), set the preset value with a decimal value (&100 = 10.0 sec) If you use TIM (BCD timer),set the preset value with a BCD value (#100 = 10.0 sec)
1 person likes this

Share this post


Link to post
Share on other sites
Thanks Propeller Head I would still prefer to use the basic Tim function if at all posible. I dont know why it wont let me select it. I took the project over from another programmer and Im trying to back track over his work.

Share this post


Link to post
Share on other sites
Exactly and the CP1L requires that you choose one way or the other for the entire project. To find this setting, right click on the processor and choose Properties as shown below: Then, if the Execute Timer/Counter as Binary box is checked (See window below for box location), then all of your timer and counter instructions will then have an X in them (TIMX, CNTX, for example). Execute as binary means that all the timer and counter setpoints are integer values instead of BCD values. I prefer this method as BCD is mostly a format of the past and is inefficient (can only go from 0 - 9999 in a 16-bit word, whereas integers go from 0 - 65535). As PdL said, you would use &100 (& means constant integer) to represent 10.0 s in a TIMX instruction when setting a constant for the setpoint.
1 person likes this

Share this post


Link to post
Share on other sites
Cheers lads. I dont use Omron a whole lot (normally an AB man) so I was wondering what was going on.

Share this post


Link to post
Share on other sites
Last question how do I set the time as a variable set by the HMI?

Share this post


Link to post
Share on other sites
You have the PLC properties set for Execute Timer/Counter as Binary but are trying to use a BCD based timer.
1 person likes this

Share this post


Link to post
Share on other sites
To use a variable from the HMI use a D instead of #**** - set the value in the HMI as HEX for the D.
1 person likes this

Share this post


Link to post
Share on other sites
Not exactly, because the value must be BCD. A Hex notation may or may not look as a valid BCD notation, but the values described almost never are equal. Bridrum22, The BCD encoding dates back to the era of 7-segment indicators and thumbwheel switches. Today, I see no reason to use BCD encoding, except backwards compatibility on retrofit projects. Neither do I see any reason to use Hex encoding for numerical values. Use binary timers/counters, write and monitor values as decimal, and you will avoid many problems.

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