Shekhar Tandon
Newbie level 1
- Joined
- Jun 20, 2013
- Messages
- 1
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 11
Hi everyone,
I am new to microcontroller using the following code for pic16f877a. I am using mplab 8.91 and hi-tech compiler 9.83 to compile the code but it is giving error on _Config statement at line no 2. Pl help
#include<pic.h>
__CONFIG(WDTDIS & XT & UNPROTECT);
char name1[32]={" Hello World "};
void delay(int x)
{
int d,l;
for(l=0;l<x;l++)
{
for(d=0;d<3000;d++);
}
}
void instwrt(void)
{
RC0=0;
RC1=0;
RC2=1;
delay(1);
RC2=0;
delay(1);
}
void datawrt(void)
{
RC0=1;
RC1=0;
RC2=1;
delay(1);
RC2=0;
delay(1);
}
void lcdin()
{
PORTD=0x38;
instwrt();
PORTD=0x0c;
instwrt();
PORTD=0x01;
instwrt();
PORTD=0x06;
instwrt();
PORTD=0x80;
instwrt();
}
void main(void)
{
int a;
TRISD=0x00;
TRISC=0X00;
TRISB=0x00;
lcdin();
for(a=0;a<32;a++)
{
PORTD=name1[a];
datawrt();
}
while(1)
{
PORTD=0x18;
instwrt();
PORTB=0x0aa;
delay(10);
PORTB=0x55;
delay(10);
}
}
I am new to microcontroller using the following code for pic16f877a. I am using mplab 8.91 and hi-tech compiler 9.83 to compile the code but it is giving error on _Config statement at line no 2. Pl help
#include<pic.h>
__CONFIG(WDTDIS & XT & UNPROTECT);
char name1[32]={" Hello World "};
void delay(int x)
{
int d,l;
for(l=0;l<x;l++)
{
for(d=0;d<3000;d++);
}
}
void instwrt(void)
{
RC0=0;
RC1=0;
RC2=1;
delay(1);
RC2=0;
delay(1);
}
void datawrt(void)
{
RC0=1;
RC1=0;
RC2=1;
delay(1);
RC2=0;
delay(1);
}
void lcdin()
{
PORTD=0x38;
instwrt();
PORTD=0x0c;
instwrt();
PORTD=0x01;
instwrt();
PORTD=0x06;
instwrt();
PORTD=0x80;
instwrt();
}
void main(void)
{
int a;
TRISD=0x00;
TRISC=0X00;
TRISB=0x00;
lcdin();
for(a=0;a<32;a++)
{
PORTD=name1[a];
datawrt();
}
while(1)
{
PORTD=0x18;
instwrt();
PORTB=0x0aa;
delay(10);
PORTB=0x55;
delay(10);
}
}