Projet

Général

Profil

« Précédent | Suivant » 

Révision 587

Ajouté par celasherme il y a environ 4 ans

programme clavier + afficheur fonctionnel et amélioration du programme

Voir les différences:

branch/lashermes/sp4b1/SP4b1/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]
branch/lashermes/sp4b1/SP4b1/SessionM32C_E8a_SYSTEM.hsf
"{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" "0000000000FE031C"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FE02F2"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000FFFD00"
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "00000000000006FE"
"{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" "0000000000000088"
"{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"
......
"{D3D4595F-12B4-4866-8F9A-78C30AC967E3}T_CONFIG_GOOPTION" "0 5 0 0"
"{D3D4595F-12B4-4866-8F9A-78C30AC967E3}T_CONFIG_ROUND" "RM_NEAR"
"{D3D4595F-12B4-4866-8F9A-78C30AC967E3}T_CONFIG_STEPOPTION" "0"
"{D3D4595F-12B4-4866-8F9A-78C30AC967E3}T_EVENT_BC1" "0,0,1,0,1,0,1,0,0,0"
"{D3D4595F-12B4-4866-8F9A-78C30AC967E3}T_EVENT_BC1" "1,1,0,fe02f2,1,0,1,0,0,0"
"{D3D4595F-12B4-4866-8F9A-78C30AC967E3}T_EVENT_BC2" "0,0,1,0,1,0"
"{D3D4595F-12B4-4866-8F9A-78C30AC967E3}T_EVENT_BC3" "0,0,1,0,1,0,1,0,0,0"
"{D3D4595F-12B4-4866-8F9A-78C30AC967E3}T_EVENT_BC4" "0,0,1,0,1,0,1,0,0,0"
......
"{F866DB60-6186-11D5-8BBE-0004E2013C71}IOWnd0Exp98" "0"
"{F866DB60-6186-11D5-8BBE-0004E2013C71}IOWnd0Exp99" "0"
"{F866DB60-6186-11D5-8BBE-0004E2013C71}IOWnd0ScrollHorz" "0"
"{F866DB60-6186-11D5-8BBE-0004E2013C71}IOWnd0ScrollVert" "495"
"{F866DB60-6186-11D5-8BBE-0004E2013C71}IOWnd0ScrollVert" "0"
"{F866DB60-6186-11D5-8BBE-0004E2013C71}IOWnd1ColWidth0" "200"
"{F866DB60-6186-11D5-8BBE-0004E2013C71}IOWnd1ColWidth1" "100"
"{F866DB60-6186-11D5-8BBE-0004E2013C71}IOWnd1ColWidth2" "100"
......
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}SP4b1SessionM32C_E8a_SYSTEM" "WINDOW" 59422 0 1 "0.21" 349 0 0 350 200 18 0 "32817|32826|32819|32820|32821" "0.0"
"{WK_00000001_OUTPUT}" "WINDOW" 59422 0 2 "0.29" 349 683 371 350 200 18 0 "36756|36757|36758|36759|<<separator>>|36746|36747|<<separator>>|39531|<<separator>>|39500|39534|<<separator>>|36687" "0.0"
"{WK_00000001_IO}SP4b1SessionM32C_E8a_SYSTEM" "WINDOW" 59422 0 1 "0.18" 349 0 0 350 200 18 0 "32817|32826|32819|32820|32821" "0.0"
"{WK_00000001_OUTPUT}" "WINDOW" 59422 0 2 "0.32" 349 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}SP4b1SessionM32C_E8a_SYSTEM" "WINDOW" 59422 0 0 "0.50" 349 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" 222 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"
branch/lashermes/sp4b1/SP4b1/SP4b1.c
void main(void)
{
pd10=0x0F;
p10=0x0E;
pu31=1;
//pd10=0x0F; // mettre broche 0 a 3 = 1 (sorties) et broches 4 a 7 =0 (entr?e)
//p10=0x0E; // valeur sur la sortie
//pu31=1; // controle resistance pull-up ( broches 4 a 7 au VDD)
init_keyboard();
while(1)
{
p10=0x07;
//test ligne 4
p10=0x07;
t=p10;
if (t==0x77)
{
touche='#';
}
if(t==0xD7)
{
touche='0';
}
if (t==0xE7)
{
touche='*';
}
// test ligne 3
p10=0x0B;
t=p10;
if(
p10=0x0B;
if (t==0x7B)
{
touche='9';
}
if(t==0xDB)
{
touche='8';
}
if (t==0xEB)
{
touche='7';
}
// test ligne 2
p10=0x0D;
t=p10;
p10=0x0D;
t=p10;
if (t==0x7D)
{
touche='6';
}
if(t==0xDD)
{
touche='5';
}
if (t==0xBD)
{
touche='4';
}
// test ligne 1
p10=0x0E;
t=p10;
if (t==0x7E)
{
touche='3';
}
if(t==0xDE)
{
touche='2';
}
if (t==0xBE)
{
touche='1';
}
}
pu31=1;
}
void init_keyboard(void){
......
}
void tpo_50ms(void){
void tpo_50ms(void){ // tempo
tcspr = 0x8A;
ta0mr = 0x82;
ta0 = 50000;
branch/lashermes/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=fe004a
branch/lashermes/sp4b2/SP4b2/SP4b2.c
/***********************************************************************/
#include "sfr32c87.h"
void lcd_4b(unsigned char car);
void lcd_8b(unsigned char car);
void lcd_com(unsigned char com);
void lcd_init(void);
void lcd_car(unsigned char car);
void tpo_us(unsigned short duree);// temporisation en ?s
void tpo_ms(unsigned short duree);// temporisation en ms
// declaration fonctions LCD
void main(void)
{
unsigned char c='C';
pd3=0xFF;
lcd_init(); //initialiser avant d'envoyer !!
lcd_car(c);
}
void lcd_4b(unsigned char car) // envoi des 4 bits de poids fort
{
//pd3=0xFF; // definir les ports du registres pDi ouvert
......
lcd_8b(car);
}
void lcd_init(void)
{
p3_0=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 tpo_us(unsigned short duree) // temporisation en ?s
{
tcspr = 0x8A;
......
ta0s = 0;
}
void lcd_init(void)
{
p3_0=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_str(unsigned char *str)
{
int i=0;
while(str[i]!='\0')
{
lcd_car(str[i]);
i++;
}
}
//void lcd_clear (void)
//{
// lcd_com(0x01);
//}
// Declaration Fonctions KeyBoard
void init_keyboard(void){
pd10 = 0x0F; // mettre broche 0 a 3 = 1 (sorties) et broches 4 a 7 =0 (entr?e)
p10=0;
pu31 = 1; // activation resistance pull-up ( broches 4 a 7 au VDD)
}
/*void keyboard (void)
{
init_keyboard();
lcd_init();
while(1)
{
if ( (p10 & 0xf0)!= 0xf0 )//les colonnes sont en entrees
{
touche= p10 ; // on enleve le phenomene de rebon en ajoutant la tempo
// tempo car quand j'appuis sur le boutton il affiche rien
// et quand je lache il affiche
tpo_ms() ;
//test ligne 4
p10=0x07;
t=p10;
if (t==0x77)
{
//lcd_com(0x01); // clear
//tpo_ms(15); // tempo car quand j'appuis sur le boutton il affiche rien
// et quand je lache il affiche
touche_ap='#';
lcd_str("#");
}
if(t==0xD7)
{
//lcd_com(0x01);
//tpo_ms(15);
touche_ap='0';
lcd_str("Arret Alarme");
}
if (t==0xE7)
{
//lcd_com(0x01);
//tpo_ms(15);
touche_ap='*';
lcd_str("*");
}
// test ligne 3
p10=0x0B;
t=p10;
if (t==0x7B)
{
//lcd_com(0x01);
//tpo_ms(15);
touche_ap='9';
lcd_str("...");
}
if(t==0xDB)
{
//lcd_com(0x01);
//tpo_ms(15);
touche_ap='8';
lcd_str("...");
}
if (t==0xEB)
{
//lcd_com(0x01);
//tpo_ms(15);
touche_ap='7';
lcd_str("Ajout Zone");
}
// test ligne 2
p10=0x0D;
t=p10;
if (t==0x7D)
{
//lcd_com(0x01);
//tpo_ms(15);
touche_ap='6';
lcd_str("...");
}
if(t==0xDD)
{
//lcd_com(0x01);
//tpo_ms(15);
touche_ap='5';
lcd_str("130 km/h");
}
if (t==0xBD)
{
//lcd_com(0x01);
//tpo_ms(15);
touche_ap='4';
lcd_str("110 km/h");
}
// test ligne 1
p10=0x0E;
t=p10;
if (t==0x7E)
{
//lcd_com(0x01);
//tpo_ms(15);
touche_ap='3';
lcd_str("90 km/h");
}
if(t==0xDE)
{
//lcd_com(0x01);
//tpo_ms(15);
touche_ap='2';
lcd_str("70 km/h");
}
if (t==0xBE)
{
//lcd_com(0x01); // clear
//tpo_ms(15);
touche_ap='1';
lcd_str("50 km/h");
}
pu31=1;
}
}
}*/
void main(void)
{
// declaration variables
char t;
unsigned char touche = 0;
unsigned char touche_ap;
touche=p10;
//unsigned char c[]="j'ai reussi";
//pd3=0xFF;
//lcd_init(); //initialiser avant d'envoyer !!
//lcd_car(c);
//lcd_str(c);
//keyboard();
init_keyboard();
lcd_init();
while(1)
{
//test ligne 4
p10=0x07;
t=p10;
if (t==0x77)
{
lcd_com(0x01); // clear
//tpo_ms(15); // tempo car quand j'appuis sur le boutton il affiche rien
// et quand je lache il affiche
touche_ap='#';
lcd_str("#");
}
if(t==0xD7)
{
lcd_com(0x01);
//tpo_ms(15);
touche_ap='0';
lcd_str("Arret Alarme");
}
if (t==0xE7)
{
lcd_com(0x01);
//tpo_ms(15);
touche_ap='*';
lcd_str("*");
}
// test ligne 3
p10=0x0B;
t=p10;
if (t==0x7B)
{
lcd_com(0x01);
//tpo_ms(15);
touche_ap='9';
lcd_str("...");
}
if(t==0xDB)
{
//lcd_com(0x01);
//tpo_ms(15);
touche_ap='8';
lcd_str("...");
}
if (t==0xEB)
{
lcd_com(0x01);
//tpo_ms(15);
touche_ap='7';
lcd_str("Ajout Zone");
}
// test ligne 2
p10=0x0D;
t=p10;
if (t==0x7D)
{
lcd_com(0x01);
//tpo_ms(15);
touche_ap='6';
lcd_str("...");
}
if(t==0xDD)
{
lcd_com(0x01);
//tpo_ms(15);
touche_ap='5';
lcd_str("130 km/h");
}
if (t==0xBD)
{
lcd_com(0x01);
//tpo_ms(15);
touche_ap='4';
lcd_str("110 km/h");
}
// test ligne 1
p10=0x0E;
t=p10;
if (t==0x7E)
{
touche=t;
lcd_com(0x01);
//tpo_ms(15);
touche_ap='3';
lcd_str("90 km/h");
}
if(t==0xDE)
{
lcd_com(0x01);
//tpo_ms(15);
touche_ap='2';
lcd_str("70 km/h");
}
if (t==0xBE)
{
lcd_com(0x01); // clear
//tpo_ms(15);
touche_ap='1';
lcd_str("50 km/h");
}
pu31=1;
}
while(t==touche_ap)
{
//touche= p10; // on enleve le phenomene de rebon en ajoutant la tempo
// tempo car quand j'appuis sur le boutton il affiche rien
// et quand je lache il affiche
tpo_ms(15) ;
}
lcd_car(touche_ap);
lcd_init();
}
......
//void lcd_4b(unsigned char car);
//void lcd_8b(unsigned char car);
//void lcd_com(unsigned char com);
//void lcd_init(void);
//void lcd_car(unsigned char car);
//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/*
......

Formats disponibles : Unified diff