Projet

Général

Profil

« Précédent | Suivant » 

Révision 614

Ajouté par beclement2 il y a presque 4 ans

Fin du programme pour l'ecan lcd

Voir les différences:

branch/CLEMENT/sp4b2/sp4b2/SessionM32C_E8a_SYSTEM.ini
[Target]
M32C E8a SYSTEM=Renesas Communications
[USER_DATA]
RESET=fe0000
RESET=fe0006
branch/CLEMENT/sp4b2/sp4b2/sp4b2.c
#include "sfr32c87.h"
void main(void)
void lcd4b(char c){ //Gestion des 4 bits
pd3 = 0xff;
p3_2 = 1; // E = 1;
if (c & 0x80){ //On fait un et entre chaque valeur pour savoir lequel est ? 1
p3_7 = 1;
}
else{
p3_7 = 0;
}
if (c & 0x40)
{
p3_6 = 1;
}
else{
p3_6 = 0;
}
if (c & 0x20)
{
p3_5 = 1;
}
else{
p3_5 = 0;
}
if (c & 0x10)
{
p3_4 = 1;
}
else{
p3_4 = 0;
}
p3_2 = 0; // E = 0;
}
void lcd8b(char c){ //On utilise notre fonction pr?cedente
lcd4b(c);
lcd4b(c << 4);
}
void lcdcom(char c){ //On affiche une commande
p1_0 = 0;
lcd8b(c);
}
void lcdinit(void){ //On initialise notre ?cran
p1_0=0;
// tpo_ms(15);
lcd4b(0x30);
// tpo_ms(5);
lcd4b(0x30);
// tpo_us(100);
lcd4b(0x30);
// tpo_us(100);
lcd4b(0x20);
lcdcom(0x28);
lcdcom(0x06);
lcdcom(0x0E);
lcdcom(0x01);
}
void lcdcar(char c){ //On affiche un carat?re
p3_0 = 1;
lcd8b(c);
}
void lcdstr(unsigned char *str){ //On affiche une chaine de caract?re
int i = 0;
int j = 0;
while(str[i] != '\0'){
lcdcar(str[i]);
i++;
}
}
void main(void) //On test dans notre main
{
p1_2 = 0;
lcdinit();
lcdstr("Test");
}

Formats disponibles : Unified diff