Révision 435
Ajouté par albeaufour il y a presque 4 ans
SP4b2.c | ||
---|---|---|
/* NOTE:THIS IS A TYPICAL EXAMPLE. */
|
||
/***********************************************************************/
|
||
|
||
void main(void)
|
||
#define PLCD p1;
|
||
#define LCD_DC p3_0;
|
||
#define LCD_RW P3_1;
|
||
#define LCD_E p3_2;
|
||
|
||
void tpo_us(unsigned short duree);// temporisation en ?s
|
||
void tpo_ms(unsigned short duree);// temporisation en ms
|
||
void lcd_init_port(void);// initialisation des broches du ?C
|
||
void lcd_4b(unsigned char car);// envoi des 4 bits de poids fort
|
||
void lcd_8b(unsigned char car);// envoi des 8 bits de donn?e
|
||
void lcd_car(unsigned char car);// envoi d'une donn?e ? afficher
|
||
void lcd_com(unsigned char com);// envoi d'une commande
|
||
void lcd_init(void);// initialisation de l'afficheur
|
||
void lcd_str(unsigned char *str);// envoi d'une cha?ne de caract?re
|
||
|
||
|
||
void LCD4b_H(char c)
|
||
{
|
||
pd1 = 0xFF;
|
||
LCD_E = 1;
|
||
|
||
p1_7 = ( c & 0b10000000)>>7;
|
||
p1_6 = ( c & 0b01000000)>>6;
|
||
p1_5 = ( c & 0b00100000)>>5;
|
||
p1_4 = ( c & 0b00010000)>>4;
|
||
|
||
LCD_E = 0;
|
||
}
|
||
|
||
void LCD4b_L(char c)
|
||
{
|
||
LCD_E = 1;
|
||
|
||
p1_3 = ( c & 0b00001000)>>3;
|
||
p1_2 = ( c & 0b00000100)>>2;
|
||
p1_1 = ( c & 0b00000010)>>1;
|
||
p1_0 = ( c & 0b00000001);
|
||
|
||
LCD_E = 0;
|
||
}
|
||
/*
|
||
// initialize the LCD display
|
||
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);
|
||
lcd_com(0x28);
|
||
lcd_com(0x06);
|
||
lcd_com(0x0E);
|
||
lcd_com(0x01);
|
||
tpo_ms(5);
|
||
}
|
||
*/
|
||
|
||
|
||
void main(void)
|
||
{
|
||
LCD4b('a');
|
||
}
|
Formats disponibles : Unified diff
ajout sfr32c87.h