need help in classicladder comparison object

20 Dec 2021 17:50 #229566 by Coordinates
i need help how to use exponent and modulus in classicladder  there is not enough examples in linuxcnc documents i want to use them for tool turret  logic  Thanks. 

  For arithmetic comparison. Is variable %XXX = to this number (or evaluated number)The compare block will be true when comparison is true. you can use most math symbols:
  • +, - ,* , /, = (standard math symbols)
  • < (less than), > (greater than), <= (less or equal), >= (greater or equal), <> (not equal)
  • (, ) grouping
  • ^ (exponent),% (modulus),& (and),| (or),. -
  • ABS (absolute), MOY (French for average) ,AVG (average)
For example ABS(%W2)=1, MOY(%W1,%W2)<3.No spaces are allowed in the comparison equation. For example %C0.V>%C0.P is a valid comparison expression while %C0.V > %CO.P is not a valid expression.There is a list of Variables down the page that can be used for reading from and writing to ladder objects. When a new compare block is opened be sure and delete the # symbol when you enter a compare.

Please Log in or Create an account to join the conversation.

20 Dec 2021 18:28 #229567 by Todd Zuercher
To do a modulus 12 of the value held in %IW0. You would need to use an Assignment box to set the answer to a variable. To assign the answer to variable %QW0, you would type the following in the assignment field. (Not sure if I ever tried it in a compare field but in theory should work.)

Using the exponent function should be similar. [%QW0=%IW0^3] should cube the %IW0 value.
I don't think I was ever successfull in using the &, | math functions, so I just did two comparisons and built the and/or logic into the ladder.
The following user(s) said Thank You: Coordinates

Please Log in or Create an account to join the conversation.

Time to create page: 0.210 seconds
Powered by Kunena Forum