Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

adc errors in mplab pic16f877

Status
Not open for further replies.

maria258

Member level 2
Joined
Feb 10, 2011
Messages
42
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Activity points
1,577
hi there i wrote this program so that wuth a simple potentiometer i will see results on leds but it is giving me erros. can someone help me plas? thanks
code is below with the errors at the end.


#include <htc.h>
#include<pic.h>

void delay(unsigned char itime);

void main (void)
{
TRISAbits.TRISA=0; //RA0 input for analog
TRISC=0xC0H; //RC0, RC1 are set as outputs
TRISD=0x00; //D is set as output

ADCON1=0b10000000;
ADCON0=0b0000001;

while(1)
{
delay(100);
ADCON0bits.GO=1; //start converting
while(ADCON0bits.DONE==1);
PORTC=ADRESL;
PORTD=ADRESH;
delay(100);
}


void delay (unsigned char itime)
{
unsigned int i,j;
for(i=0; i<itime; i++)
for(j=0;j<200;j++);
}


Error [844] C:\Program Files\HI-TECH Software\PICC\9.80\include\pic1687x.h; 22. lexical error
Error [876] C:\Program Files\HI-TECH Software\PICC\9.80\include\pic1687x.h; 22. syntax error
Error [845] GLCD.pre; 6. symbol "volatile" defined more than once
Error [845] GLCD.pre; 6. symbol "unsigned" defined more than once
Error [845] GLCD.pre; 6. symbol "char" defined more than once
Error [844] GLCD.pre; 6. lexical error
Error [876] GLCD.pre; 6. syntax error
Error [845] GLCD.pre; 7. symbol "volatile" defined more than once
Error [845] GLCD.pre; 7. symbol "unsigned" defined more than once
Error [845] GLCD.pre; 7. symbol "char" defined more than once
Error [844] GLCD.pre; 7. lexical error
Error [876] GLCD.pre; 7. syntax error
Error [845] GLCD.pre; 8. symbol "volatile" defined more than once
Error [845] GLCD.pre; 8. symbol "unsigned" defined more than once
Error [845] GLCD.pre; 8. symbol "char" defined more than once
Error [844] GLCD.pre; 8. lexical error
Error [876] GLCD.pre; 8. syntax error
Error [845] GLCD.pre; 9. symbol "volatile" defined more than once
Error [845] GLCD.pre; 9. symbol "unsigned" defined more than once
Error [845] GLCD.pre; 9. symbol "char" defined more than once
Error [844] GLCD.pre; 9. lexical error
Advisory[1] too many errors (21)
 

no no, forget about that. its only the name of the project cos i was gonna write something for a grpahic lcd but then i changed my mind and did the adc instead. its only a name. but i dont know exactly why i have all these errors. i followed an example from a book and almost copied it word by word.
 

same. nothing changed :s

---------- Post added at 12:54 ---------- Previous post was at 12:51 ----------

i changed it to #include <pic16f877.h> and the only error it gave is:Error [141] C:\PROJECT\GLCD.as; 1.22 can't open include file "pic16f877.h": No such file or directory

so that means i have to leave it #include<htc.h>??
 

make it #include<pic.h>

---------- Post added at 18:29 ---------- Previous post was at 18:26 ----------

i always feel htc.h is a better option than pic.h when using hitech C.........
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top