Jump to content

Recommended Posts

Posted
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
Posted
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)
  • Like 1
Posted
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.
Posted
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.
  • Like 1
Posted
To use a variable from the HMI use a D instead of #**** - set the value in the HMI as HEX for the D.
  • Like 1
Posted
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.

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...