#include<htc.h>
#include<pic.h>
#define _XTAL_FREQ 8000000
#define rs RE0
#define en RE1
__CONFIG(FOSC_HS);
void lcd();
void lcdcmd(unsigned char);
void lcddata(unsigned char);
unsigned char z,d1[6]={"Volts:"};
//unsigned char d2[5]={"Amps:"};
void main()
{
CMCON=7;
ADCON1=7;
TRISB=0;
TRISE=0;
lcd();
while(1)
{
for(z=0;z<6;z++)
lcddata(d1[z]);
//lcdcmd(0xC0);
//for(z=0;z<5;z++)
//lcddata(d2[z]);
}
}
void lcd()
{
lcdcmd(0x38);
__delay_ms(50);
lcdcmd(0x01);
__delay_ms(50);
lcdcmd(0x06);
__delay_ms(50);
lcdcmd(0x0C);
__delay_ms(50);
lcdcmd(0x80);
__delay_ms(50);
}
void lcdcmd(unsigned char value)
{
rs=0;
PORTB=value>>4;
en=1;
__delay_ms(1);
en=0;
PORTB=value&0x0f;
en=1;
__delay_ms(1);
en=0;
}
void lcddata(unsigned char value)
{
rs=1;
PORTB=value>>4;
en=1;
__delay_ms(1);
en=0;
PORTB=value&0x0f;
en=1;
__delay_ms(1);
en=0;
return;
}