In order to correctly perform an ADC it is important to ensure there is enough time between enabling the ADC module to performing a conversion. Here is a code sample for PIC 16F88
#define TEMP 0x00 //AN0
#define LIGHT 0x08 //AN1
ANSEL |= 0x03; //Select AN0-1 as analog
TRISA |= 0x03; //Select RA0-1 as input
ADCON0 =0x00; //Configure A/D params
unsigned int GetA2DLevel(unsigned char channel)
unsigned int adc_result=0;
ADCON1 =0b10000000; //Configure A/D params
ADCON0 =0b11000001 | channel; //Set the channel and start A/D module
__delay_us(20); //Delay required to ensure module is operating properly
ADCON0 |= 0x04; //Start Conversion
while(ADCON0 & 0x04); //Wait for conversion
adc_result = ADRESH;
adc_result = (adc_result<<8)|ADRESL;
YDLidar X4 This is a demo of the YDLidar using a golang API. The software supplied with the device only contains the drivers in C++ an...
My original idea for this project was simply to try and interface the WINTEK WD-C2401P lcd panel to the pic (see my previous post). I figure...
Roomba Dashboard Background: Roomba-Dash is a cli dashboard for the IRobot Create 2 platform. I got the roomba because I wanted to bu...