littletransistor
New Member
Hey there!
I've learned some A-D - and is it a way to let the A-D conversion to a maximum of 4-bits instead of 10-bits?
I searched the tutorials for the PK2 (Pic Kit 2) Lessons but didn't found anything.
Here's the code - I took some from Mike Predko's Evil Genius book and it's default to 10 bits. Anything I should add there?
Btw - the µC is a PIC 16F690.
I've learned some A-D - and is it a way to let the A-D conversion to a maximum of 4-bits instead of 10-bits?
I searched the tutorials for the PK2 (Pic Kit 2) Lessons but didn't found anything.
Here's the code - I took some from Mike Predko's Evil Genius book and it's default to 10 bits. Anything I should add there?
Code:
#include <htc.h>
__CONFIG(INTIO & WDTDIS & PWRTEN & MCLRDIS & UNPROTECT
& BORDIS & IESODIS & FCMDIS);
int main()
{
ANSEL = 0x01;
TRISC = 0x00;
PORTC = 0x00;
TRISA = 0xFF;
ADCON0 = 0b000000001;
ADCON1 = 0b000100000;
int ADCState = 0;
int ADCValue = 0;
int array[5] = {0x00, 0x01, 0x02, 0x04, 0x08};
int i=0;
while(1)
{
PORTC = ADCValue;
switch(ADCState)
{
case 0:
GODONE = 1;
ADCState++;
break;
case 1:
if(!GODONE)
ADCState++;
break;
case 2:
ADCValue = ADRESH;
ADCState = 0;
break;
}
}
}
Btw - the µC is a PIC 16F690.