error in lcd interfacing with pic using c in proteus

Thread Starter

gobi615

Joined Jul 26, 2011
30
hi this is my c code to interface pic with lcd . i build it sucessfully in MPLAB HI-TECH C Compiler , when i attached to pic it says error as"internal exception:access violation in module pic16.DLL i didnt find what is problem ..
i am using pic 16f877a , LM016L(16,2) LCD ..
Rich (BB code):
#include  <pic.h>
//#include  <htc.h>
#define RS RE0
#define RW RE1
#define E RE2
void picinit(void);
void lcdinit(void);
void senddata(char*);
void command(char);
void delay(int);
void main()
{   
    char name[5]="gobi";
    int n=0;
	picinit();
	lcdinit();
    while(1)
    {
      for(n;n!='\0';n++)
	  senddata(name);
    } 
	
}
void lcdinit()
{
	command(0x38);
	command(0x0f);
	command(0x01);
    command(0x06);
	
}
void command(char comm)
{
   PORTD=comm;
   RS=0;
   RW=0;
   E=1;
   delay(1000);
   E=0;
}
void picinit()
{ 
  TRISE=0x00;
  PORTE=0x00;
  TRISD=0x00;
  PORTD=0x00;

}
void senddata (char *data)
{
  PORTD=*data;
  RS=1;
  RW=0;
  E=1;
  delay(1000);
  E=0;
}
void delay(int d)
{
  int i;
  for(i=0;i<=d;i++);
}
 
Top