TonyA
- 4th April 2006, 19:40
Hi,
I am a little confused about how to set up the pic12F683, was wondering if some can offer some help. I'm using PicBasic Pro
I'm just using ANO-AN2 as analog inputs to read pots.
GP5 as an output to drive a speaker. (I'm using the SOUND command to make some noise).
This is what I have for the setup so far:
DEFINE OSC 8 'Oscillator speed in MHz
DEFINE ADC_BITS 10
DEFINE ADC_SAMPLEUS 50
OSCCON = %01110000 ' Set to 8MHz
CMCON0 = 7 ' Analog comparators off
ANSEL = %00000111 ' Set AN0-AN2 analog, rest digital
'And then my main code just does something like this:
main:
adcin 0, result 'read pot on pin
adcin 1, result1
adcin 2, result2
sound 5, [stuff] 'pin 2 is sound ouput
I was wondering if I have to also set up the TRISIO, and if I am missing anything else here.
I'm just piecing this togther for bits of code I find on the web, trying to make sense of it. Any help would be appreciated, thank you.
Tony A
I am a little confused about how to set up the pic12F683, was wondering if some can offer some help. I'm using PicBasic Pro
I'm just using ANO-AN2 as analog inputs to read pots.
GP5 as an output to drive a speaker. (I'm using the SOUND command to make some noise).
This is what I have for the setup so far:
DEFINE OSC 8 'Oscillator speed in MHz
DEFINE ADC_BITS 10
DEFINE ADC_SAMPLEUS 50
OSCCON = %01110000 ' Set to 8MHz
CMCON0 = 7 ' Analog comparators off
ANSEL = %00000111 ' Set AN0-AN2 analog, rest digital
'And then my main code just does something like this:
main:
adcin 0, result 'read pot on pin
adcin 1, result1
adcin 2, result2
sound 5, [stuff] 'pin 2 is sound ouput
I was wondering if I have to also set up the TRISIO, and if I am missing anything else here.
I'm just piecing this togther for bits of code I find on the web, trying to make sense of it. Any help would be appreciated, thank you.
Tony A