Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Projet_client_serveur EX5 ex10 ex11 ... more
Revision 2:ba3449b7e070, committed 2016-11-08
- Comitter:
- slowness
- Date:
- Tue Nov 08 02:05:57 2016 +0000
- Parent:
- 1:663cbe5baac4
- Child:
- 4:a9e51ac904e2
- Commit message:
- corrige tous les probl?mes du LCD
Changed in this revision
| IHM.cpp | Show annotated file Show diff for this revision Revisions of this file |
| IHM.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/IHM.cpp Sat Nov 05 17:19:59 2016 +0000
+++ b/IHM.cpp Tue Nov 08 02:05:57 2016 +0000
@@ -5,7 +5,6 @@
#define CAN_REMOTE CANType(2)
//
-
IHM::IHM(PinName CANRx, PinName CANTx): can(CANRx,CANTx)
{
can.frequency(1000000); /*Baud rate : kbits/s */
@@ -13,10 +12,26 @@
}
void IHM::LCD_printf(const char* format, ...)
{
+ unsigned char i,j;
va_list arg;
va_start(arg,format);
- IHM_vprintf(format,arg);
+ vsprintf(tableau_ecran+curseur,format,arg);
+ // IHM_vprintf(format,arg);
va_end(arg);
+ for(i=0; i<32;i++)
+ {
+ if(tableau_ecran[i]==0)
+ tableau_ecran[i]=20;
+ }
+ for(j=0; j<4; j++) {
+ trame_Tx.id=LCD_CHAR0+j;
+ trame_Tx.type=CANData;
+ trame_Tx.len=8;
+ for(i=0; i<8; i++)
+ trame_Tx.data[i]=tableau_ecran[i+j*8];
+ while(!can.write(trame_Tx));
+ wait_us(150);
+ }
}
unsigned char JOG_valeur,mise_a_jour_JOG=0,mise_a_jour_COD=0;
void IHM::can_ISR_Reader(void)
@@ -96,99 +111,7 @@
}
-/****************************************************************************************/
-/* FUNCTION NAME: IHM_sendchar */
-/* DESCRIPTION : Envoie un caractere à afficher au controleur de l'afficheur LCD */
-/* RETURN : VOID */
-/* PARAMETER 1 : char data : caractère à afficher */
-/****************************************************************************************/
-void IHM::IHM_sendchar (char data)
-{
- tableau_ecran[curseur]=data;
- curseur=(curseur+1)%32;
-}
-
-/****************************************************************************************/
-/* FUNCTION NAME: IHM_printf */
-/* DESCRIPTION : Affichage formaté de type "printf" sur un afficheur LCD */
-/* RETURN : VOID */
-/* PARAMETER 1 : char* format : format d'affichage de printf */
-/* PARAMETER 2 : ... : parametres à afficher */
-/* Attention : le nouvel affichage doit recouvrir le précédent. */
-/*********************** NOTE concernant la commande IHM_printf *************************/
-/* Les appels melangés à printf, LCD_printf et IHM_printf peuvent donner des resutlats */
-/* imprevisibles */
-/* */
-/* L'IHM doit etre initialise par la fonction IHM_init */
-/****************************************************************************************/
-void IHM::IHM_printf(const char* format, ...)
-{
- //oldcurseur=curseur;
- unsigned char i,j;
- va_list args;
- //sprintf(
- //set_printf(IHM_sendchar); /* Placement des datas dans le tableau */
- //vputc(IHM_sendchar);
- va_start(args, format);
- vsprintf(tableau_ecran+curseur,format, args);
- va_end(args);
- // envoi sur le bus can du tableau complet de l'ecran
- for(j=0; j<4; j++) {
- trame_Tx.id=LCD_CHAR0+j;
- trame_Tx.type=CANData;
- trame_Tx.len=8;
- for(i=0; i<8; i++)
- trame_Tx.data[i]=tableau_ecran[i+j*8];
- while(!can.write(trame_Tx));
- wait_us(150);
- }
-}
-
-//********
-void IHM::IHM_vprintf(const char* format, va_list args)
-{
- //oldcurseur=curseur;
- unsigned char i,j;
- ////va_list args;
- //sprintf(
- //set_printf(IHM_sendchar); /* Placement des datas dans le tableau */
- //vputc(IHM_sendchar);
- ////va_start(args, format);
- vsprintf(tableau_ecran+curseur,format, args);
- ////va_end(args);
- // envoi sur le bus can du tableau complet de l'ecran
- for(j=0; j<4; j++) {
- trame_Tx.id=LCD_CHAR0+j;
- trame_Tx.type=CANData;
- trame_Tx.len=8;
- for(i=0; i<8; i++)
- trame_Tx.data[i]=tableau_ecran[i+j*8];
- while(!can.write(trame_Tx));
- wait_us(150);
- }
-}
-/****************************************************************************************/
-/* FUNCTION NAME: IHM_sendstring */
-/* DESCRIPTION : Affiche une chaine sur l'IHM */
-/* RETURN : VOID */
-/* PARAMETER 1 : char* message : chaine de caractere a afficher */
-/****************************************************************************************/
-void IHM::IHM_sendstring (char* message)
-{
- unsigned char i,j;
- sprintf(tableau_ecran+curseur,message);
-
- for(j=0; j<4; j++) {
- trame_Tx.id=LCD_CHAR0+j;
- trame_Tx.type=CANData;
- trame_Tx.len=8;
- for(i=0; i<8; i++)
- trame_Tx.data[i]=tableau_ecran[i+j*8];
- while(!can.write(trame_Tx));
- wait_us(150);
- }
-}
/****************************************************************************************/
/* FUNCTION NAME: IHM_clear */
/* DESCRIPTION : Efface le LCD */
--- a/IHM.h Sat Nov 05 17:19:59 2016 +0000
+++ b/IHM.h Tue Nov 08 02:05:57 2016 +0000
@@ -111,12 +111,12 @@
CANMessage can_MsgRx[SIZE_FIFO], can_MsgTx;
//extern unsigned char Reception_CAN;
CANMessage trame_Tx;
-char tableau_ecran[32];
+char tableau_ecran[33];
CAN can;
void can_ISR_Reader(void);
void CAN_automate_reception(void);
void IHM_sendchar (char data);
void IHM_printf(const char* format, ...);
- void IHM_vprintf(const char* format, va_list args);
+ void IHM_vprintf(const char* format, ...);
void IHM_sendstring (char* message);
};