Bridrum22 Posted March 26, 2015 Report Posted March 26, 2015 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 Quote
PdL Posted March 26, 2015 Report Posted March 26, 2015 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 Quote
Bridrum22 Posted March 26, 2015 Author Report Posted March 26, 2015 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. Quote
Michael Walsh Posted March 26, 2015 Report Posted March 26, 2015 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 Quote
Bridrum22 Posted March 26, 2015 Author Report Posted March 26, 2015 Cheers lads. I dont use Omron a whole lot (normally an AB man) so I was wondering what was going on. Quote
Bridrum22 Posted March 26, 2015 Author Report Posted March 26, 2015 Last question how do I set the time as a variable set by the HMI? Quote
BITS N BYTES Posted March 26, 2015 Report Posted March 26, 2015 You have the PLC properties set for Execute Timer/Counter as Binary but are trying to use a BCD based timer. 1 Quote
BobB Posted March 26, 2015 Report Posted March 26, 2015 To use a variable from the HMI use a D instead of #**** - set the value in the HMI as HEX for the D. 1 Quote
Sergei Troizky Posted March 29, 2015 Report Posted March 29, 2015 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.