Projet

Général

Profil

« Précédent | Suivant » 

Révision 535

Ajouté par clbouillot2 il y a presque 4 ans

couplage lcd et clavier

Voir les différences:

branch/bouillot/sp4b2/SP4b2/SessionM32C_E8a_SYSTEM.ini
PROCESSOR_MODE=0
[COMMUNI]
COMSPEED=8
COMSPEED PROGRAM FLASH=8
COMSPEED DATA FLASH=8
[Driver Configuration]
Renesas Communications=USB interface,0,
[Target]
M32C E8a SYSTEM=Renesas Communications
[USER_DATA]
RESET=fe0000
RESET=fe0002
branch/bouillot/sp4b2/SP4b2/SessionM32C_E8a_SYSTEM.hsf
"{313F4FC1-6566-11D5-8BBE-0004E2013C71}CmdLineCtrlBrowseDirectory" ""
"{313F4FC1-6566-11D5-8BBE-0004E2013C71}CmdLineCtrlLogFileName" ""
"{313F4FC1-6566-11D5-8BBE-0004E2013C71}CmdLineCtrlSplitterPosition" "242"
"{313F4FC1-6566-11D5-8BBE-0004E2013C71}CmdLineCtrlViews" "0"
"{313F4FC1-6566-11D5-8BBE-0004E2013C71}CmdLineCtrlViews" "1"
"{313F4FC1-6566-11D5-8BBE-0004E2013C71}CmdLineCtrlWindowProperties" "17"
"{313F4FC1-6566-11D5-8BBE-0004E2013C71}CmdLineWndInstanceKey0" "{WK_00000001_CmdLine}"
"{313F4FC1-6566-11D5-8BBE-0004E2013C71}TclTkCtrlLogFileName" ""
"{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_COMPARE_END_ADDRESS" ""
"{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_COMPARE_START_ADDRESS" ""
......
"{55384715-F881-421C-A548-D7D1ABE158E1}PDMRCtrlViews" "0"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_EVAL_DENORMAL_MODE" "0"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_EVAL_ROUND_MODE" "0"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_0" "0000000000000000"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_0" "0000000000000001"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_1" "0000000000000000"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_10" "0000000000000000"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_11" "0000000000000000"
......
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_13" "0000000000000000"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_14" "0000000000000000"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_15" "0000000000000400"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FE0385"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FE0432"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000FFFD00"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "00000000000006FC"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000A00"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "00000000000006FA"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000A02"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "0000000000000000"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "0000000000000084"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "0000000000000081"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_21" "0000000000000000"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_22" "0000000000000000"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_23" "0000000000000000"
......
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_33" "0000000000000000"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_34" "0000000000000000"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_35" "0000000000000000"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_4" "0000000000FE0000"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_4" "0000000000FE0001"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_5" "0000000000020000"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000000"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_7" "0000000000000400"
......
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth12" "150"
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth2" "120"
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth3" "200"
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000" "lcd8b, 10, 0, P, Col, Hex, N"
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000" "p10, 10, 0, P, Col, Hex, N"
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000_SCOPE" "Current Scope,"
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "1"
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth0" "120"
......
0
[WINDOW_POSITION_STATE_DATA_VD1]
"Help" "TOOLBAR 0" 59419 1 5 "0.00" 0 0 0 0 0 17 0 "" "0.0"
"{WK_00000001_IO}SP4b2SessionM32C_E8a_SYSTEM" "WINDOW" 59422 0 2 "0.15" 180 0 0 350 200 18 0 "32817|32826|32819|32820|32821" "0.0"
"{WK_00000001_OUTPUT}" "WINDOW" 59422 0 1 "0.48" 180 683 371 350 200 18 0 "36756|36757|36758|36759|<<separator>>|36746|36747|<<separator>>|39531|<<separator>>|39500|39534|<<separator>>|36687" "0.0"
"{WK_00000001_CmdLine}" "WINDOW" 59422 0 1 "0.10" 180 0 0 350 200 17 0 "32771|32772|32778|<<separator>>|32773|32774|<<separator>>|32820|<<separator>>|32801|32824" "0.0"
"{WK_00000001_IO}SP4b2SessionM32C_E8a_SYSTEM" "WINDOW" 59422 0 3 "0.15" 180 0 0 350 200 18 0 "32817|32826|32819|32820|32821" "0.0"
"{WK_00000001_OUTPUT}" "WINDOW" 59422 0 2 "0.48" 180 683 371 350 200 18 0 "36756|36757|36758|36759|<<separator>>|36746|36747|<<separator>>|39531|<<separator>>|39500|39534|<<separator>>|36687" "0.0"
"{WK_00000001_WATCH}SP4b2SessionM32C_E8a_SYSTEM" "WINDOW" 59422 0 0 "0.37" 180 0 0 350 200 18 0 "32781|32783|<<separator>>|32771|32829|32772|32827|32773|<<separator>>|32786|<<separator>>|32810|32811|32831" "0.0"
"{WK_00000002_WORKSPACE}" "WINDOW" 59420 0 0 "1.00" 180 683 371 350 200 18 0 "" "0.0"
"{WK_TB00000001_STANDARD}" "TOOLBAR 0" 59419 0 2 "0.00" 0 0 0 0 0 18 0 "" "0.0"
......
[FLASH_DETAILS]
"" 0 0 "" 0 "" 0 0 "" 0 0 0 0 0 0 0 "" "" "" "" ""
[BREAKPOINTS]
"d:\tp_sp4_2021_bouillot\sp4b2\sp4b2\sp4b2.c" 59 16646997 1 "{00000000-0000-0000-C000-000000000046}" ""
[END]
branch/bouillot/sp4b2/SP4b2/SP4b2.c
void lcd_4b (char c) {
char valeur4b;
p3_2=1; //fonction permettant la r?ception des donn?es par l'afficheur
p3_7=(c & 0b10000000)>>7;
p3_6=(c & 0b01000000)>>6;
p3_5=(c & 0b00100000)>>5;
p3_4=(c & 0b00010000)>>4;
p3_2=0;
}
void tpo_ms (unsigned short duree){
p3_4=(c & 0b0001);
p3_5=(c & 0b0010)>>1;
p3_6=(c & 0b0100)>>2;
p3_7=(c & 0b1000)>>3;
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){
p3_2=0;
}
tcspr = 0x8A;
ta0mr = 0x82;
ta0 = duree;
ta0s = 1;ta0os = 1;
ta0ic = 0x00;
while (ir_ta0ic != 1);
ta0s = 0;
}
void lcd_8b (char c) {
lcd_4b(c);
......
}
void lcd_car (char c) {
p3_0=1;
lcd_8b(c);
}
void lcd_str (char *str){
int i = 0;
while (str[i]!='\0')
{
lcd_car(str[i]);
i++;
}
}
// initialize the LCD display
void lcd_init(void)
......
pd3=0xFF;
p3=0x00;
p3_0=0 ;
//tpo_ms(15);
lcd_4b(0x03);
//tpo_ms(5);
lcd_4b(0x03);
//tpo_us(100);
lcd_4b(0x03);
//tpo_us(100);
lcd_4b(0x02);
lcd_com(0x82);
lcd_com(0x60);
lcd_com(0xE0);
lcd_com(0x10);
//tpo_ms(5);
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 init_keyboard(void){
pd10 = 0x0f;
p10=0 ;
pu31 = 1;
}
void main(void){
//LCD_E=1;
lcd_init();
void tpo_50ms(void){
tcspr = 0x8A;
ta0mr = 0x82;
ta0 = 50000;
ta0s = 1;ta0os = 1;
ta0ic = 0x00;
while(ir_ta0ic != 1);
ta0s = 0;
}
unsigned char touche_c = 0;
unsigned char touche_appuyee;
void main(void){
init_keyboard();
lcd_init();
while(1){
init_keyboard();
if ( (p10 & 0xf0)!= 0xf0 ){ //les colonnes sont en entr?es
touche_c = p10 ;
tpo_50ms() ; // une temporisation entre en oeuvre pour ?viter les ph?nom?nes de rebond
p10 = 0x0e;
if ( (p10 & 0xff)== 0xbe ){ //diff?rents tests
touche_appuyee = '1';
}
if ( (p10 & 0xff)== 0xde ){
touche_appuyee = '2';
}
if ( (p10 & 0xff)== 0x7e ){
touche_appuyee = '3';
}
p10 = 0x0d;
if ( (p10 & 0xff)== 0xbd ){
touche_appuyee = '4';
}
if ( (p10 & 0xff)== 0xdd ){
touche_appuyee = '5';
}
if ( (p10 & 0xff)== 0x7d ){
touche_appuyee = '6';
}
p10 = 0x0b;
if ( (p10 & 0xff)== 0xeb ){
touche_appuyee = '7';
}
if ( (p10 & 0xff)== 0xdb ){
touche_appuyee = '8';
}
if ( (p10 & 0xff)== 0x7b ){
touche_appuyee = '9';
}
p10 = 0x07;
if ( (p10 & 0xff)== 0xe7 ){
touche_appuyee = '*';
}
if ( (p10 & 0xff)== 0xd7 ){
touche_appuyee = '0';
}
if ( (p10 & 0xff)== 0x77 ){
touche_appuyee = '#';
}
lcd_car(touche_appuyee);
lcd_init();
}
}
} +

Formats disponibles : Unified diff