Shop OBEX P1 Docs P2 Docs Learn Events
define a range in con section — Parallax Forums

define a range in con section

Is there a simple, straight forward way to define a range of values in the con section? I've read through the CON section of the prop manual and don't see any close examples. I want to use pre-defined zones to test against in a case expression.
CON
        _clkmode = xtal1 + pll16x                                               'Standard clock mode * crystal frequency = 80 MHz
        _xinfreq = 5_000_000


zone1 >0 AND <60   'define the range of zone1
zone2 ...ect

'/////////////////////////////////////////////////////////////
pub whatever |arc
dira[5]~~
arc:=25
repeat

   case arc                 'compare arc value to various zone ranges

     zone1 : outa[5]~~
     zone2 : outa[5]~
     ect...

Comments

  • There's no way to do that exactly as you describe in Spin. However, you could do something like this:
    CON
    
      ZONE1L = 0
      ZONE1H = 60
    
    ...
    
      case arc
    
        ZONE1L .. ZONE1H: outa[5]~~
    
        ...
    

    -Phil
  • Easy enough, thanks Phil Pilgrim
Sign In or Register to comment.