I've migrated from the Parallax sx but I'm new to PICs and PicBasic Pro
How do I use ADCIN
The following program is meant to display the binary value of a pot on AN2 on 8 LEDs on port RC. It doesn't work!!!
================================================== =========
' Name : LearningADC.bas
LEDs var PORTC
' Allocate variables
PotVal Var Byte
ANSEL = %00000100 ' Set PORTA.1 analog, rest digital
ANSELH = %00000000
mainloop:
Adcin 2, x ' Read ADC value on AN2 (PORTA.2)
LEDs = potval
Pause 100 ' Do it about 10 times a second
Goto mainloop
End
================================================== =========
Thanks from Kwa Dukuza, lost somewhere in South Africa
John Bond
Bookmarks