Projet

Général

Profil

« Précédent | Suivant » 

Révision 613

Ajouté par megoutteno il y a presque 4 ans

Réalisation de la fonction lcd_8b

Voir les différences:

branch/Gouttenoire/sp4b2/SP4b2/SP4b2/SP4b2.c
#include "sfr32c87.h"
void lcd_4b(unsigned char car);
void lcd_8b(unsigned char car);
void main(void)
{
/* pd1=0xff; // definit en sortie
p1_2=1; //E=1
p1_7=1; */
lcd_4b(0x80);
lcd_4b(0xAA); // test fonction 4bits
lcd_8b(0xAA); // test fonction 8bits
}
void lcd_4b(unsigned char car)
{
pd1=0xff; // definit en sortie
p1_2=1; //E=1
if(car & 0x80)
{
p1_7=1;
......
{
p1_4=0;
}
}
void lcd_8b(unsigned char car)
{
pd1=0xff; // definit en sortie
if(car & 0x80)
{
p1_7=1;
}
else
{
p1_7=0;
}
if(car & 0x40)
{
p1_6=1;
}
else
{
p1_6=0;
}
if(car & 0x20)
{
p1_5=1;
}
else
{
p1_5=0;
}
if(car & 0x10)
{
p1_4=1;
}
else
{
p1_4=0;
}
if(car & 0x08)
{
p1_3=1;
}
else
{
p1_3=0;
}
if(car & 0x04)
{
p1_2=1;
}
else
{
p1_2=0;
}
if(car & 0x02)
{
p1_1=1;
}
else
{
p1_1=0;
}
if(car & 0x01)
{
p1_0=1;
}
else
{
p1_0=0;
}
}

Formats disponibles : Unified diff