Author Topic: comparing value of two DM  (Read 367 times)

artkraft

  • Newbie
  • Posts: 22
  • I'm a llama!
    • View Profile
comparing value of two DM
« on: April 03, 2021, 12:34:52 PM »
I have DM[1] witch is the current position on a linear encoder. I want to know if DM[1] is = to or not greater than+ or- 4 cnts when at rest. If statement is true set Home flag.

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3128
    • View Profile
    • Internet Programmable PLCs
Re: comparing value of two DM
« Reply #1 on: April 23, 2021, 08:12:43 AM »
You should post this question at the Tech Support board.

It is simple IF THEN ELSE statement

#DEFINELOCAL  targetCount = 1000

IF DM[1] < (targetCount + 4) AND DM[1] >= (targetCount - 4) THEN
    ...
ELSE
   ....
ENDIF
 
Email: support@triplc.com
Tel: 1-877-TRI-PLCS