Projet

Général

Profil

« Précédent | Suivant » 

Révision 442

Ajouté par thcoulaud il y a presque 4 ans

Réalisation des lcd4b et lcd8b

Voir les différences:

SP4b1.c
/* This file is generated by Renesas Project Generator (Ver.4.18). */
/* NOTE:THIS IS A TYPICAL EXAMPLE. */
/***********************************************************************/
#include "sfr32c87.h" +#include "sfr32c87.h";
void lcd_4b(unsigned char c){
pd1==0xff;
char t;
void main(){
pd10=0X0F;
p10=0X00;
pu31=0XFF;
while (1){
if ((t & 0xF0)!=0XF0){
p10=0X0E;
t=p10;
}
if ((t & 0xF0)!=0XF0){
p10=0X0D;
t=p10;
}
if ((t & 0xF0)!=0XF0){
p10=0X0B;
t=p10;
}
if ((t & 0xF0)!=0XF0){
p10=0X07;
t=p10;
}
if (c & 0b10000000)
{
p1_7=1;
}
else
{
p1_7=0;
}
if (c & 0b00000100)
{
p1_6=1;
}
else{
p1_6=0;
}
if (c & 0b00000100)
{
p1_5=1;
}
else{
p1_5=0;
}
if (c & 0b00000100)
{
p1_4=1;
}
else{
p1_4=0;
}
p1_2=0;
}
void lcd_8b(unsigned char car){
lcd_4b(car <<4);
}
void lcd_com(unsigned char com){
p1_0=0;
lcd_8b(com);
}
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 lcd_car(unsigned char car){
p1_0=1;
lcd_8b(car);
}
void lcd_str(unsigned char *str){
unsigned char i=0;
while(str[i]){
lcd_car(str[i++]);
}
}
void main(void){
lcd_4b(0xf0);
lcd_4b(0xA0);
}

Formats disponibles : Unified diff