#include<pic.h>
#define uchar unsigned char
#define uint unsigned int
//const uchar table[]={}
//延时一毫秒
void delay1ms()
{
uchar i,j;
for(i=0;i<10;i++)
for(j=0;j<33;j++)
;
}
//延时若干毫秒
void delaynms(uchar n)
{
uchar i;
for(i=0;i<n;i++)
delay1ms();
}
void cshlcd()
{
LCDDATA0=0b00000000;
LCDDATA3=0b00000000;
LCDDATA6=0b00000000;
LCDDATA9=0b00000000;
TRISA=0b00000000;
TRISB=0X00;
TRISC=0X00;
PORTA=0X00;
PORTB=0X00;
PORTC=0X00;
LCDPS=0b00010011;
LCDSE0=0XFF;
LCDCON=0b01001111;
LCDIF=0;
LCDIE=0;
LCDREF=0b10101110;
LCDRL=0b11110001;
LCDCST=0b00000001;
LCDEN=1;
}
void main()
{
cshlcd();
//delaynms(1);
LCDDATA0=0xff;
//delaynms(1);
LCDDATA3=0xff;
//delaynms(1);
LCDDATA6=0xff;
//delaynms(1);
LCDDATA9=0xff;
//delaynms(1);
while(1)
{
//SEG0COM0=1;
//SEG1COM1=1;
//SEG4COM3=1;
}
} |