Jump to content

tejaswiyvs

Members
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral

About tejaswiyvs

  • Rank
    Newbrie
  1. Thanks for the help . Did some searching and found a similar topic on the forums. Thanks anyway!
  2. #include "PIC16F887.h" #define XTAL_FREQ 4000000 // config clock to 4mhz. // Set configuration fuse. #pragma DATA _CONFIG, _XT_OSC & _WDT_OFF & _CP_OFF & _PWRTE_OFF void setupADC(void); void setup(void); void setupSPI(void); char getADC(void); void main() { setup(); } void setup() { setupADC(); setupSPI(); return; } void setupSPI() { // Stub return; } void setupADC() { ADCON1 = 0x80; // setting ADC result as right justify, along with Vdd, Vss as reference voltages. TRISA = 0x01; // Setting RA0 as an input. (ADC Channel 1?) ANSEL = 0x01; // ADC can be used to convert both analog and digital vals. We're specifying that input // is analog. ADCON0 = 0xC1; // 11000001 return; } char getADC() { char low_val,hi_val,total; ADCON0 |= 0x02; // Started an ADC conversion. while(ADCON0 & 0x02); // Wait till conversion is complete. return 0; } Trying to get the ADC working on a PIC16F887. Errors - Building... BoostC Optimizing C Compiler Version 6.89 (for PIC16 architecture) http://www.sourceboost.com Copyright© 2004-2008 Pavel Baranov Copyright© 2004-2008 David Hobday Single user Lite License (Unregistered) for 0 node(s) Limitations: PIC12,PIC16 max code size:2048 words, max RAM banks:2, Non commercial use only ..\..\..\..\..\Users\teja\Desktop\Work\Code\Blink.c C:\Users\teja\Desktop\Work\Code\Blink.c(39): error: left operand must be l-value C:\Users\teja\Desktop\Work\Code\Blink.c(39:9): error: failed to generate expression C:\Users\teja\Desktop\Work\Code\Blink.c(40): error: left operand must be l-value C:\Users\teja\Desktop\Work\Code\Blink.c(40:9): error: failed to generate expression C:\Users\teja\Desktop\Work\Code\Blink.c(41): error: left operand must be l-value C:\Users\teja\Desktop\Work\Code\Blink.c(41:9): error: failed to generate expression C:\Users\teja\Desktop\Work\Code\Blink.c(43): error: left operand must be l-value C:\Users\teja\Desktop\Work\Code\Blink.c(43:9): error: failed to generate expression C:\Users\teja\Desktop\Work\Code\Blink.c(50): error: left operand must be l-value C:\Users\teja\Desktop\Work\Code\Blink.c(50:9): error: failed to generate expression failure "C:\Program Files\SourceBoost\boostc.pic16.exe" ..\..\..\..\..\Users\teja\Desktop\Work\Code\Blink.c -t PIC16F887 Exit code was 1. Removing target: Blink.obj Done
×
×
  • Create New...