;******************************************************** ;Nano Simon Board Analog button demo program. ;Written by Dale K. Kubin ;******************************************************** Pressed var word ;Setup a word sized variable DIRL = 0x00 ;set data port pins as outputs OUTL = 0x00 ;set all graph LEDs off High P8 ;Turns Display 1 ON Low P9 ;Turns Display 2 OFF low P13 ;Turns all 8 LEDs OFF OUTL = %11111100 ;Display 0 on DS1 Main adin p10,Pressed if pressed >= 70 and pressed <=125 then UpBtn ;Value for simon is typical 93, if/then gives us range if pressed >= 140 and pressed <=250 then DownBtn ;Value for simon is typical 184, if/then gives us range if pressed >= 290 and pressed <=360 then LeftBtn ;Value for simon is typical 325, if/then gives us range if pressed >= 450 and pressed <=600 then RightBtn ;Value for simon is typical 510, if/then gives us range Goto Main UpBtn High DS1 OUTL = %01100000 ;Display 1 on DS1 sound p12,[100000\784,100000\1047,100000\1319,100000\1568] Goto Main DownBtn High DS1 OUTL = %11110010 ;Display 3 on DS1 sound p12,[100000\100,100000\784,100000\510,100000\600] Goto Main LeftBtn High DS1 OUTL = %01100110 ;Display 4 on DS1 sound p12,[100000\2000,100000\1047,100000\700,100000\450] Goto Main RightBtn High DS1 OUTL = %11011010 ;Display 2 on DS1 sound p12,[100000\3000,100000\2047,100000\1319,100000\100] Goto Main