Révision 642
Ajouté par malameynar il y a plus de 4 ans
| SP4b1.c | ||
|---|---|---|
|
/***********************************************************************/
|
||
|
|
||
|
#include "sfr32c87.h"
|
||
|
#define LCD_E p3_2
|
||
|
#define LCD_RW p3_1
|
||
|
#define LCD_DC p3_0
|
||
|
#define LCD_PORT pd3
|
||
|
|
||
|
void decode_touche(){
|
||
|
char decode_touche(){
|
||
|
char touche;
|
||
|
char t;
|
||
|
pd10=0x0f;
|
||
|
pu31=1;
|
||
|
p10=0x00;
|
||
|
while(1){
|
||
|
t=p10;
|
||
|
if(t!=0xf0){
|
||
|
// pd10=0x0f;
|
||
|
// pu31=1;
|
||
|
// p10=0x00;
|
||
|
// while(1){
|
||
|
// t=p10;
|
||
|
// if(t!=0xf0){
|
||
|
//pmi?re ligne
|
||
|
p10=0xfe;
|
||
|
t=p10;
|
||
| ... | ... | |
|
if(t==0x7e){
|
||
|
touche='3';
|
||
|
}
|
||
|
|
||
|
//deuxi?me ligne
|
||
|
p10=0xfd;
|
||
|
t=p10;
|
||
| ... | ... | |
|
if(t==0x77){
|
||
|
touche='#';
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
// }
|
||
|
// }
|
||
|
return(touche);
|
||
|
}
|
||
|
|
||
|
/*
|
||
| ... | ... | |
|
}
|
||
|
*/
|
||
|
|
||
|
#define LCD_E p3_2
|
||
|
#define LCD_RW p3_1
|
||
|
#define LCD_DC p3_0
|
||
|
#define LCD_PORT pd3
|
||
|
|
||
|
|
||
|
void lcd_4b(char c){
|
||
|
|
||
|
|
||
| ... | ... | |
|
ta0s = 0;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
void lcd_init(void){
|
||
|
LCD_DC=0;
|
||
|
tpo_us(15000);
|
||
| ... | ... | |
|
}
|
||
|
|
||
|
void main(){
|
||
|
pd10=0x0f;
|
||
|
pu31=1;
|
||
|
p10=0x00;
|
||
|
|
||
|
LCD_PORT=0xFF;
|
||
|
lcd_init();
|
||
|
lcd_char('M');
|
||
|
decode_touche();
|
||
|
|
||
|
|
||
|
|
||
|
while(1){
|
||
|
if(p10!=0xf0){
|
||
|
lcd_char(decode_touche());
|
||
|
while(p10!=0xf0){
|
||
|
p10=0x00;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
Formats disponibles : Unified diff
fonction entière et gestion clavier