Projet

Général

Profil

« Précédent | Suivant » 

Révision 433

Ajouté par magraffin il y a presque 4 ans

lcd 4bit fonctionnel

Voir les différences:

branch/graffin/sp4b2/TP4B2/TP4B2/TP4B2.c
/* This file is generated by Renesas Project Generator (Ver.4.18). */
/* NOTE:THIS IS A TYPICAL EXAMPLE. */
/***********************************************************************/
#include "sfr32c87.h"
#define LCD_E
#define LCD_RW
#define LCD_DC
#define LCD_E_DIR
#define LCD_RW_DIR
#define LCD_DC_DIR
#define LCD_PORT
#define LCD_PORT_DIR
#define plcd p1
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 main(void)
{
pd1=0xff;
while(1){
lcd_4b(0b1111);
lcd_4b(0b0100);
lcd_4b(0b0010);
lcd_4b(0b0001);
}
}
void lcd_4b(unsigned char car)
{
p1_2=1;
p1_4=car & 0b0001;
p1_5=(car & 0b0010)>>1;
p1_6=(car & 0b0100)>>2;
p1_7=(car & 0b1000)>>3;
p1_2=0;
}

Formats disponibles : Unified diff