I'm trying to do A/D conversion for the Temperature sensor LM35 and my code doesnt work, can any of you guys tell me what's wrong with my code.. Code:
the error that gives me is this:
Error 23 "C:testadtemp.c" Line 6(8,9): Can not change device type this far into the code
*** Error 48 "C:testadtemp.c" Line 6(9,12): Expecting a (
*** Error 43 "C:testadtemp.c" Line 6(13,14): Expecting a declaration
is in the line where i declared
#device ADC=8
#include <16F877.h>
#include <STDLIB.H>
#device ADC=8 //set for 8 bit A/D
#use delay(clock=4000000)
int Tempvalue=0;
int Temp;
//Define the A/D control register
#BYTE ADCON0=0X01
Note that your code is incomplete as there is no main() function.
Steve.
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
Posted: Sun Jul 31, 2005 5:04 pm
Make sure that you only have 1 C file if using MPLAB. A common mistake is to use multiple source files in the project workspace. You cannot do this. You must include any C files in your main C file by using the #include
languer
Joined: 09 Jan 2004 Posts: 144 Location: USA
Why location of #device ADC=8 is important
Posted: Sun Jul 31, 2005 11:34 pm
Look here to understand why the location of the following command is important.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum