I want to use gp0 and gp1 as analog inputs and gp3 as digital out to send midi messages:
DEFINE OSC 20
DEFINE DEBUG_BAUD 31250 ' midi baud rate
DEFINE DEBUG_REG gpio ' Set Debug pin port
DEFINE DEBUG_BIT 2 ' Set Debug pin bit
DEFINE DEBUG_MODE 0
adval var byte ' Create adval to store result
ANSEL = %00000011 ' ----DDAA
CMCON = 7 ' Analog comparators off
loop: ADCIN 0, adval ' Read channel 0 to adval
debug $b0,$00,adval
Pause 250 ' Do it all about 10 times a second
Goto loop ' Do it forever
End
how can i limit the results of analog inputs between 0-127?
Thanks a lot
Bookmarks