Révision 538
Ajouté par begresset il y a presque 4 ans
SP4b1.c | ||
---|---|---|
#define LCD_RW_DIR LCD_PORT_DIR
|
||
#define LCD_DC_DIR LCD_PORT_DIR*/
|
||
|
||
//Commande de l'afficheur
|
||
void tpo_us(int duree){
|
||
tcspr=0x8A;
|
||
ta0mr=0x82;
|
||
ta0=duree*1000;
|
||
ta0s=1;
|
||
ta0os=1;
|
||
ta0ic=0x00;
|
||
while(ir_ta0ic !=1);
|
||
ta0os=0;
|
||
}
|
||
|
||
void tpo_ms(int duree){
|
||
tcspr=0x8A;
|
||
ta0mr=0x82;
|
||
ta0=duree*1000000;
|
||
ta0s=1;
|
||
ta0os=1;
|
||
ta0ic=0x00;
|
||
while(ir_ta0ic !=1);
|
||
ta0os=0;
|
||
}
|
||
|
||
void lcd_4b(unsigned char car){
|
||
pd3=0xFF;
|
||
p3_2=1;
|
||
... | ... | |
p3_2=0;
|
||
}
|
||
|
||
|
||
|
||
void lcd_8b(unsigned char car){
|
||
lcd_4b(car);
|
||
lcd_4b(car<<4);
|
||
... | ... | |
void lcd_init(void){
|
||
pd3=0xFF;
|
||
p3_0=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);
|
||
lcd_com(0x28);
|
||
lcd_com(0x06);
|
||
lcd_com(0x0E);
|
||
lcd_com(0x01);
|
||
tpo_ms(5);
|
||
}
|
||
|
||
void lcd_car(unsigned char car){
|
||
... | ... | |
lcd_8b(car);
|
||
}
|
||
|
||
void lcd_str(unsigned char *str){
|
||
int i=0;
|
||
|
||
while(str[i]!='\0'){
|
||
lcd_car(str[i]);
|
||
i++;
|
||
}
|
||
}
|
||
|
||
void main (void){
|
||
lcd_init();
|
||
lcd_car(0b01100001);
|
||
//lcd_str("hello world");
|
||
}
|
||
|
||
}
|
||
|
||
/*id init_keyboard(void);
|
||
void tpo_50ms(void);
|
||
|
Formats disponibles : Unified diff
Finalisation du programme de gestion de l'afficheur.