Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. 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

New Member
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)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top