Révision 653
Ajouté par megoutteno il y a presque 4 ans
branch/Gouttenoire/sp4b2/SP4b2/SP4b2/SP4b2.c | ||
---|---|---|
/* pd1=0xff; // definit en sortie
|
||
p1_2=1; //E=1
|
||
p1_7=1; */
|
||
pd1=0xff;
|
||
pd3=0xff;
|
||
lcd_4b(0xAA); // test fonction 4bits
|
||
lcd_8b(0x8F); // test fonction 8bits
|
||
lcd_car(0x8F);
|
||
... | ... | |
{
|
||
if(car & 0x80)
|
||
{
|
||
p1_7=1;
|
||
p3_7=1;
|
||
}
|
||
else
|
||
{
|
||
p1_7=0;
|
||
p3_7=0;
|
||
}
|
||
if(car & 0x40)
|
||
{
|
||
p1_6=1;
|
||
p3_6=1;
|
||
}
|
||
else
|
||
{
|
||
p1_6=0;
|
||
p3_6=0;
|
||
}
|
||
if(car & 0x20)
|
||
{
|
||
p1_5=1;
|
||
p3_5=1;
|
||
}
|
||
else
|
||
{
|
||
p1_5=0;
|
||
p3_5=0;
|
||
}
|
||
if(car & 0x10)
|
||
{
|
||
p1_4=1;
|
||
p3_4=1;
|
||
}
|
||
else
|
||
{
|
||
p1_4=0;
|
||
p3_4=0;
|
||
}
|
||
|
||
}
|
||
... | ... | |
}
|
||
void lcd_car(unsigned char car)
|
||
{
|
||
p1_0=1;
|
||
p3_0=1;
|
||
lcd_8b(car);
|
||
}
|
||
void lcd_com(unsigned char com)
|
||
{
|
||
p1_0=0;
|
||
p3_0=0;
|
||
lcd_8b(com);
|
||
}
|
||
// initialize the LCD display
|
||
void lcd_init(void)
|
||
{
|
||
LCD_DC=0;
|
||
tpo_ms(15);
|
||
p3_0=0;
|
||
//tpo_ms(15);
|
||
lcd_4b(0x30);
|
||
tpo_ms(5);
|
||
//tpo_ms(5);
|
||
lcd_4b(0x30);
|
||
tpo_us(100);
|
||
//tpo_us(100);
|
||
lcd_4b(0x30);
|
||
tpo_us(100);
|
||
//tpo_us(100);
|
||
lcd_4b(0x20);
|
||
lcd_com(0x28);
|
||
lcd_com(0x06);
|
||
lcd_com(0x0E);
|
||
lcd_com(0x01);
|
||
tpo_ms(5);
|
||
//tpo_ms(5);
|
||
}
|
||
|
||
|
Formats disponibles : Unified diff
Finalisation tpb2