Projet

Général

Profil

« Précédent | Suivant » 

Révision 448

Ajouté par albeaufour il y a presque 4 ans

Commit fin de séance initialisation auto du LCD valide

Voir les différences:

SP4b2.c
/* NOTE:THIS IS A TYPICAL EXAMPLE. */
/***********************************************************************/
#include "sfr32c87.h"
#define PLCD p1;
#define PLCD p3;
#define LCD_DC p3_0;
#define LCD_RW P3_1;
#define LCD_E p1_2;
#define LCD_E p3_2;
#define data4 p3_4;
#define data5 p3_5;
#define data6 p3_6;
#define data7 p3_7;
void tpo_us(unsigned short duree);// temporisation en ?s
void tpo_ms(unsigned short duree);// temporisation en ms
......
void lcd_str(unsigned char *str);// envoi d'une cha?ne de caract?re
void LCD4b_H(char c)
void lcd_4b(unsigned char c)
{
pd1 = 0xFF;
p1_2 = 1;
p3_2 = 1;
p1_7 = ( c & 0b10000000)>>7;
p1_6 = ( c & 0b01000000)>>6;
p1_5 = ( c & 0b00100000)>>5;
p1_4 = ( c & 0b00010000)>>4;
p3_7 = ( c & 0b10000000)>>7;
p3_6 = ( c & 0b01000000)>>6;
p3_5 = ( c & 0b00100000)>>5;
p3_4 = ( c & 0b00010000)>>4;
p1_2 = 0;
p3_2 = 0;
}
void LCD4b_L(char c)
void lcd_8b(unsigned char c)
{
p1_2 = 1;
p1_3 = ( c & 0b00001000)>>3;
p1_2 = ( c & 0b00000100)>>2;
p1_1 = ( c & 0b00000010)>>1;
p1_0 = ( c & 0b00000001);
lcd_4b(c);
lcd_4b(c<<4);
}
p1_2 = 1;
void lcd_com (unsigned char c)
{
p3_0 = 0;
lcd_8b (c);
}
void LCD8b(char c)
void tpo_ms(unsigned short duree)
{
LCD4b_H(c);
LCD4b_L(c);
duree=duree*1000;
tcspr = 0x8A;
ta0mr = 0x82;
ta0 = duree;
ta0s = 1;ta0os = 1;
ta0ic = 0x00;
while(ir_ta0ic != 1);
ta0s = 0;
}
/*
void tpo_us(unsigned short duree)
{
tcspr = 0x8A;
ta0mr = 0x82;
ta0 = duree;
ta0s = 1;ta0os = 1;
ta0ic = 0x00;
while(ir_ta0ic != 1);
ta0s = 0;
}
// initialize the LCD display
void lcd_init(void)
{
LCD_DC=0;
pd3 = 0xFF;
p3=0x00;
p3_0=0;
tpo_ms(15);
lcd_4b(0x30);
tpo_ms(5);
......
lcd_com(0x01);
tpo_ms(5);
}
*/
void main(void)
{
LCD8b('a');
lcd_init();
}

Formats disponibles : Unified diff