|
#define LCD_E()
|
|
#define LCD_E_DIR()
|
|
|
|
#define LCD_RW()
|
|
#define LCD_RW_DIR()
|
|
|
|
#define LCD_DC()
|
|
#define LCD_DC_DIR()
|
|
|
|
#define LCD_PORT()
|
|
#define LCD_PORT_DIR()
|
|
|
|
|
|
//temporisation en us
|
|
void tpo_us(unsigned short duree);
|
|
// temporisation en ms
|
|
void tpo_ms(unsigned short duree);
|
|
//initialisation des broches du uc
|
|
void lcd_init_port(void);
|
|
//envoie des 4 bits de poids fort
|
|
void lcd_4b(unsigned char car);
|
|
|
|
// envoie des 8 bits de donnée
|
|
void lcd_8b(unsigned char car){
|
|
}
|
|
//envoie d'une donnée à l'afficheur
|
|
void lcd_car(unsigned char car);
|
|
//envoi d'une commande
|
|
void lcd_com(unsigned char com){
|
|
switch(com){
|
|
case 0x28:N=1;//mode 2 ligne
|
|
break;
|
|
case 0x06://incrémentation du curseur
|
|
break;
|
|
case 0x0E: p3_0=1;// afficheur et curseur allumés
|
|
break;
|
|
case 0x01:
|
|
break;
|
|
}
|
|
}
|
|
|
|
//initialisation de l'afficheur
|
|
void lcd_init(void){
|
|
LCD_DC=0;
|
|
tpo_ms(15);
|
|
lcd_4b(0x30);
|
|
tpo_ms(5);
|
|
lcd_4b(0x30);
|
|
tpo_us(100);
|
|
lcd_4b(0x30);
|
|
tpo_us(100);
|
|
lcd_4b(0x20);//on ecrit juste une fois(pas 2 segments)
|
|
lcd_com(0x28);//mode 2 lignes
|
|
lcd_com(0x06);//incrementation du curseur
|
|
lcd_com(0x0E);//Ecran allumé + curseur
|
|
lcd_com(0x01);//effacer
|
|
tpo_ms(5);
|
|
|
|
}
|
|
//envoi d'une chaine de carateres
|
|
void lcd_str(unsigned char *str);
|