18F2550 20mhz HSPLL set up for USB
PIC functions and pcb is fine. I can get a simple blinky light to work. I can get a correct ADC value to write to EEPROM and read through the programmer, but I cant get it compare the ADC value with the value stored in fb and turn on or off the LED as I vary the voltage in the ACD pin.
What the heck am I missing?
Code:define OSC 48 DEFINE ADC_BITS 10 DEFINE ADC_CLOCK 3 DEFINE ADC_SAMPLEUS 50 raw var word raw1 var word fb var word fb = 205 ADCON1 = 001011 ADCON2 = 000011 TRISA = 001111 TRISB = 110000 TRISC = 000000 PORTC.2 = 0 main: pause 100 adcin 0, raw raw1 = raw/10 if raw1 => fb then Portc.0 = 1 else portc.0 = 0 endif goto main]




Bookmarks