Bienvenue aux nouveaux arrivants sur FantasPic !

- Pensez à lire les règles durant votre visite, il n'y en a pas beaucoup, mais encore faut-il les respecter .
- N’hésitez pas à faire des remarques et/ou suggestions sur le Forum, dans le but de l'améliorer et de rendre vos prochaines visites plus agréables.
- Vous pouvez regarder votre "panneau de l'utilisateur" afin de configurer vos préférences.
- Un passage par "l'utilisation du forum" est recommandé pour connaître les fonctionnalités du forum.

--- L’équipe FantasPic ---
Forum général sur le langage C !

Modérateur : Jérémy

afficheur Nokia 3310
paulfjujo
Avatar de l’utilisateur
Expert
Expert
Messages : 2589
Âge : 73
Enregistré en : juillet 2015
Localisation : 01800
Contact :

#1 Message par paulfjujo » mar. 6 août 2019 20:58

bonsoir,

à ta question

PRNN-lab a écrit :Lorsqu'on telecharge des librairies sous cette forme comment les installe t'ont? Depuis hier je demande et toujours aucune reponse


dans l'exemple cité, il n'y a pas de librairie ( Nokia)à charger, ce n'est pas une librairie MikroC
le projet MikroC englobe la librairie .. le terme librairie est un peu surfait ici..
mais un fichier header MyLib_Nokia_8x16.h
qui reference les fonctions utilisées dans le code source MyLib_Nokia_8x16.c

la capture d'ecran montre le projet ouvert : Project Manager
les differents fichiers utilisés dans ce projet
et sur la droite la Library Manager : les lib MikroC
le Nokia n'y est pas !

MikroC_platine_Nokia_2016.jpg


Dans le resultat de la compilation ( fenetre Messages)
on peut retrouver les Lib MikroC utilisées ( celle Library Manager -System)

0 1 mikroCPIC1618.exe -MSF -DBG -pP18F4685 -RA -C -DL -O11111114 -fo40 -EH"^C
C:\_MikroC\_MesProjets_MikroC\_18F4685_Platine_Nokia_40Mhz_2016\18F4685_Platine_Nokia_2016_EEPROM.ihex" -N"^C
C:\_MikroC\_MesProjets_MikroC\_18F4685_Platine_Nokia_40Mhz_2016\18F4685_Platine_Nokia_2016_40Mhz.mcppi" -SP"^C
C:\_MikroC\mikroC PRO for PIC\Defs\" -SP"^C
C:\_MikroC\mikroC PRO for PIC\uses\P18\" -SP"^C
C:\_MikroC\_MesProjets_MikroC\_18F4685_Platine_Nokia_40Mhz_2016\" -SP"^C
C:\_MikroC\_MesProjets_MikroC\_18F4685_Platine_Nokia\" -IP"^C
C:\_MikroC\mikroC PRO for PIC\uses\P18\" -IP"^C
C:\_MikroC\_MesProjets_MikroC\_18F4685_Platine_Nokia_40Mhz_2016\" "18F4685_Platine_with_Lib_Nokia_24LC512_40Mhz_160416.c" "
_Lib_Math.mcl" "
_Lib_MathDouble.mcl" "
_Lib_System.mcl" "
_Lib_Delays.mcl" "
_Lib_CType.mcl" "
_Lib_CString.mcl" "
_Lib_CStdlib.mcl" "
_Lib_CMath.mcl" "
_Lib_Conversions.mcl" "
_Lib_Sprintf.mcl" "
_Lib_SoftI2C.mcl" "
_Lib_FLASH_w64_e64.mcl" "
_Lib_UART_c67.mcl"


il faut donc incluredes librairies MikroC , pour une application donnée .
Moi je prefere de toutes les désactiver au départ et ne valider ensuite que celles nécessaires..
ça aide beaucoup à en comprendre l'usage.


tu as donc , à prendre en main le compilateur MikroC
et même revoir certaines bases du langage C , avant de pouvoir continuer

Je n'ai pas ecrit ce programme en 24H , tu t'en doutes !
j'ai commencé à travailler sur les microprocesseurs en 1975 ! et débuté ensuite avec le 16F84 en ASM.

"tu es jeune il est vrai, et la valeur n'attend pas le nombre des années "..
:sifflotte: mais un peu quand même .

J'utilise effectivement paintuino pour convertir un fichier BMP 16 bits en un fichier BMP 1 bit
et sortir le code correspondant , à inclure ensuite dans le programme.

l'image etant en NOIR et BLANC ( pas de gris sur le Nokia )
Paint shop pro ne sert qu'à creer ou decouper une image .. n'importe quelle autre appli traitement d'image peut aller.

ça date de 2016 .. à remettre au gout du jour

j'ai corrigé le lien rompu sur ma page web.
. SOFTWARE Projet Mikroc : 18F4685_Platine_Nokia_8x16_w_Lib.zip


je vais peut etre refaire une version avec un 18F27K42 ou 47K42 .. regarde la datasheet de ce PIC ultra costaud.

A+
Vous n’avez pas les permissions nécessaires pour voir les fichiers joints à ce message.
Modifié en dernier par paulfjujo le jeu. 15 août 2019 14:32, modifié 1 fois.
Aide toi, le ciel ou FantasPic t'aidera

afficheur Nokia 3310
PRNN-lab
Amateur
Amateur
Messages : 118
Enregistré en : août 2019

#2 Message par PRNN-lab » mer. 7 août 2019 12:36

:cry: :cry: :cry: :cry: j'ai taffé toute le nuit sur cet écran rien ne marche.
premièrement j'ai essayer de comprendre Votre code ensuite j'ai voulu le simuler dans mon proteus

ps (désolé pour les accents ) :oops:
Les images faut les lire du bas vers le haut
Vous n’avez pas les permissions nécessaires pour voir les fichiers joints à ce message.
Ce qui doit marcher jamais ne doit être pressé...... :idea:

afficheur Nokia 3310
paulfjujo
Avatar de l’utilisateur
Expert
Expert
Messages : 2589
Âge : 73
Enregistré en : juillet 2015
Localisation : 01800
Contact :

#3 Message par paulfjujo » mer. 7 août 2019 19:19

J'utilise une vieille version d' ISIS uniquement pour faire des schemas.
Je ne travaille que sur du matériel HARDWARE REEL . pas de simulateur,
donc hors question de t'aider sur un programme tournant sur Proteus..
qui plus est avec 2 ecrans en paralleles ?


un nokia 3310 , (recupéré sur un telephone Nokia ) necessite un condo de 1 à 4,7µF sur la pin 7 ou 8 ( à verifier),
pour elaborer une tension de 7 à 8V necessaire au nokia..
sur le 5110 , livré sur une Backboard , le condo doit etre ( à verifier) inclus ( en version CMS)
Je doute fort que ton simulateur te previenne .. puisque c'est un élément hardware.

D'une façon generale ,
MikroC ne donne pas les sources de ses librairies
mais seulement les noms des fonctions utilisées avec les parametres à passer.
un fichier *.mcl associé à cette librairie = source déja compilé
un fichier header *.h donnant noms, points d'acces à la librairie.


sur cet autre exemple avec PIC18F26K20
fichier principal : 18F26K20_test_Graf_Nokia_5110_140224.c
usage de Nokia_5110.h fichier Header nom des fonctions
usage de Nokia_51110.c fichier source définition des fonctions
mais c'est en C18 !


en MikroC:
dans la version mikroc 18F4685
3310.h
usage de la lib compilée : 3310.mcl
ou rajout du source 3310.c , en plus du main programme
Aide toi, le ciel ou FantasPic t'aidera

afficheur Nokia 3310
PRNN-lab
Amateur
Amateur
Messages : 118
Enregistré en : août 2019

#4 Message par PRNN-lab » mer. 7 août 2019 19:29

D'accord je réuni le matériel et je commence la simulation réel
Ce qui doit marcher jamais ne doit être pressé...... :idea:

afficheur Nokia 3310
Temps-x
Avatar de l’utilisateur
Expert
Expert
Messages : 2595
Enregistré en : juillet 2016
Localisation : Terre

#5 Message par Temps-x » jeu. 8 août 2019 01:28

Bonsoir PRNN-lab, paulfjujo, et tout le forum,

Pour mettre du code, il existe un bouton d'étier à ça, regarde la capture d'écran que j'ai faite.

Code.JPG


==> A+
Vous n’avez pas les permissions nécessaires pour voir les fichiers joints à ce message.
:roll: Les requins, c'est comme le langage ASM, c'est le sommet de la chaîne alimentaire. :wink:

afficheur Nokia 3310
PRNN-lab
Amateur
Amateur
Messages : 118
Enregistré en : août 2019

#6 Message par PRNN-lab » jeu. 8 août 2019 02:33

Code : Tout sélectionner

#include "Nokia_5110_Basics.h"

sbit Nokia_MOSI at RC7_bit;     //MOSI (ONLY FOR SOFT SPI) DIN
sbit Nokia_SCL at RB1_bit//SCL (ONLY FOR SOFT SPI)
sbit Nokia_MOSI_Direction at TRISC7_bit//MOSI_DIR (ONLY FOR SOFT SPI)
sbit Nokia_SCL_Direction at TRISB1_bit//SCL_DIR (ONLY FOR SOFT SPI)

sbit Nokia_SCE_Direction at TRISA5_bit//SCE_DIR PIN
sbit Nokia_DC_Direction at TRISD0_bit//DC_DIR PIN
sbit Nokia_RST_Direction at TRISD1_bit//RST_DIR PIN
sbit Nokia_SCE at RA5_bit//SCE PIN
sbit Nokia_DC at RD0_bit//DC PIN
sbit Nokia_RST at RD1_bit//RST PIN


void main() {

 
Nokia_Init();




Code : Tout sélectionner

#define EEPROM_24LC256
#define Dump
#define Software_I2C
#define EEPROM_32K_ADR 0xA0

#define D_C PORTD.B0
#define SCE PORTA.B5
#define RES PORTD.B1
#define SCK PORTB.B1
#define SDI PORTC.B7



const char table[480] = {
0x00,0x00,0x00,0x00,0x00, // 20 space ASCII table for NOKIA LCD: 96 rows * 5 bytes= 480 bytes
0x00,0x00,0x5f,0x00,0x00, // 21 ! Note that this is the same set of codes for character you
0x00,0x07,0x00,0x07,0x00, // 22 " would find on a HD44780 based character LCD.
0x14,0x7f,0x14,0x7f,0x14, // 23 # Also, given the size of the LCD (84 pixels by 48 pixels),
0x24,0x2a,0x7f,0x2a,0x12, // 24 $ the maximum number of characters per row is only 14.
0x23,0x13,0x08,0x64,0x62, // 25 %
0x36,0x49,0x55,0x22,0x50, // 26 &
0x00,0x05,0x03,0x00,0x00, // 27 '
0x00,0x1c,0x22,0x41,0x00, // 28 (
0x00,0x41,0x22,0x1c,0x00, // 29 )
0x14,0x08,0x3e,0x08,0x14, // 2a *
0x08,0x08,0x3e,0x08,0x08, // 2b +
0x00,0x50,0x30,0x00,0x00, // 2c ,
0x08,0x08,0x08,0x08,0x08, // 2d -
0x00,0x60,0x60,0x00,0x00, // 2e .
0x20,0x10,0x08,0x04,0x02, // 2f /
0x3e,0x51,0x49,0x45,0x3e, // 30 0
0x00,0x42,0x7f,0x40,0x00, // 31 1
0x42,0x61,0x51,0x49,0x46, // 32 2
0x21,0x41,0x45,0x4b,0x31, // 33 3
0x18,0x14,0x12,0x7f,0x10, // 34 4
0x27,0x45,0x45,0x45,0x39, // 35 5
0x3c,0x4a,0x49,0x49,0x30, // 36 6
0x01,0x71,0x09,0x05,0x03, // 37 7
0x36,0x49,0x49,0x49,0x36, // 38 8
0x06,0x49,0x49,0x29,0x1e, // 39 9
0x00,0x36,0x36,0x00,0x00, // 3a :
0x00,0x56,0x36,0x00,0x00, // 3b ;
0x08,0x14,0x22,0x41,0x00, // 3c <
0x14,0x14,0x14,0x14,0x14, // 3d =
0x00,0x41,0x22,0x14,0x08, // 3e >
0x02,0x01,0x51,0x09,0x06, // 3f ?
0x32,0x49,0x79,0x41,0x3e, // 40 @
0x7e,0x11,0x11,0x11,0x7e, // 41 A
0x7f,0x49,0x49,0x49,0x36, // 42 B
0x3e,0x41,0x41,0x41,0x22, // 43 C
0x7f,0x41,0x41,0x22,0x1c, // 44 D
0x7f,0x49,0x49,0x49,0x41, // 45 E
0x7f,0x09,0x09,0x09,0x01, // 46 F
0x3e,0x41,0x49,0x49,0x7a, // 47 G
0x7f,0x08,0x08,0x08,0x7f, // 48 H
0x00,0x41,0x7f,0x41,0x00, // 49 I
0x20,0x40,0x41,0x3f,0x01, // 4a J
0x7f,0x08,0x14,0x22,0x41, // 4b K
0x7f,0x40,0x40,0x40,0x40, // 4c L
0x7f,0x02,0x0c,0x02,0x7f, // 4d M
0x7f,0x04,0x08,0x10,0x7f, // 4e N
0x3e,0x41,0x41,0x41,0x3e, // 4f O
0x7f,0x09,0x09,0x09,0x06, // 50 P
0x3e,0x41,0x51,0x21,0x5e, // 51 Q
0x7f,0x09,0x19,0x29,0x46, // 52 R
0x46,0x49,0x49,0x49,0x31, // 53 S
0x01,0x01,0x7f,0x01,0x01, // 54 T
0x3f,0x40,0x40,0x40,0x3f, // 55 U
0x1f,0x20,0x40,0x20,0x1f, // 56 V
0x3f,0x40,0x38,0x40,0x3f, // 57 W
0x63,0x14,0x08,0x14,0x63, // 58 X
0x07,0x08,0x70,0x08,0x07, // 59 Y
0x61,0x51,0x49,0x45,0x43, // 5a Z
0x00,0x7f,0x41,0x41,0x00, // 5b [
0x02,0x04,0x08,0x10,0x20, // 5c Yen Currency Sign
0x00,0x41,0x41,0x7f,0x00, // 5d ]
0x04,0x02,0x01,0x02,0x04, // 5e ^
0x40,0x40,0x40,0x40,0x40, // 5f _
0x00,0x01,0x02,0x04,0x00, // 60 `
0x20,0x54,0x54,0x54,0x78, // 61 a
0x7f,0x48,0x44,0x44,0x38, // 62 b
0x38,0x44,0x44,0x44,0x20, // 63 c
0x38,0x44,0x44,0x48,0x7f, // 64 d
0x38,0x54,0x54,0x54,0x18, // 65 e
0x08,0x7e,0x09,0x01,0x02, // 66 f
0x0c,0x52,0x52,0x52,0x3e, // 67 g
0x7f,0x08,0x04,0x04,0x78, // 68 h
0x00,0x44,0x7d,0x40,0x00, // 69 i
0x20,0x40,0x44,0x3d,0x00, // 6a j
0x7f,0x10,0x28,0x44,0x00, // 6b k
0x00,0x41,0x7f,0x40,0x00, // 6c l
0x7c,0x04,0x18,0x04,0x78, // 6d m
0x7c,0x08,0x04,0x04,0x78, // 6e n
0x38,0x44,0x44,0x44,0x38, // 6f o
0x7c,0x14,0x14,0x14,0x08, // 70 p
0x08,0x14,0x14,0x18,0x7c, // 71 q
0x7c,0x08,0x04,0x04,0x08, // 72 r
0x48,0x54,0x54,0x54,0x20, // 73 s
0x04,0x3f,0x44,0x40,0x20, // 74 t
0x3c,0x40,0x40,0x20,0x7c, // 75 u
0x1c,0x20,0x40,0x20,0x1c, // 76 v
0x3c,0x40,0x30,0x40,0x3c, // 77 w
0x44,0x28,0x10,0x28,0x44, // 78 x
0x0c,0x50,0x50,0x50,0x3c, // 79 y
0x44,0x64,0x54,0x4c,0x44, // 7a z
0x00,0x08,0x36,0x41,0x00, // 7b <
0x00,0x00,0x7f,0x00,0x00, // 7c |
0x00,0x41,0x36,0x08,0x00, // 7d >
0x10,0x08,0x08,0x10,0x08, // 7e Right Arrow ->
0x78,0x46,0x41,0x46,0x78}; // 7f Left Arrow <-


unsigned char TEXTE[32];
unsigned char *txt;



void initlcd(void); // Initializes the LCD.
void sendcmd(char); // Writes a command.
void senddata(char); // Writes data to DDRAM to illuminate the pixels.
void cleanram(void); // Erase the DDRAM contents.
void gotoxy(char,char); // Position cursor to x,y.     x de 0 à 95   Y de 1 à 9
void sendchar(char); // Write one character.
void sendpack(char);
void redirige_RS232(int wcr,unsigned char *T);
unsigned char *Float2Ascii (float x, unsigned char *str,char precision);
void UART1_Write_CText(const char *txt);

//---- EEPROM PIC  bytes  ================
unsigned char EEPROM_Lect(unsigned char adrE) ; // lecture a l'adresse adrL
void EEPROM_Ecr(unsigned char adrE,unsigned char car); // ecrit  a l'adresse adrE
void Save_Msg_To_EEPROM(unsigned char * adrx, unsigned char *ptr1);
void PrintOut_Eeprom_Msg(unsigned char PtrE);  //  for 16Fxxxxx


//------  EEPROM du PIC18f4550 ---------------

unsigned char EEPROM_Lect(unsigned char AdrE) // lecture a l'adresse adr
{
     EEADR =(unsigned char) AdrE & 0x00FF;
    //EEADRH =0;
        EECON1.EEPGD=0;     // 0= adressage sur EEPROM , 1=sur flash
      // EECON1.CFGS=0;      // 0= acces data EEPROM
        EECON1.RD=1;        // arme Lecture EEprom
       while( EECON1.RD=1);  // wait RD=0
        return(EEDATA);
}


void EEPROM_Ecr(unsigned char AdrE,unsigned char car) // ecrit  a l'adresse adrE
{int dr=0;
   if(INTCON.GIE ==1)
   {
   INTCON.GIE =;
    dr=1;
   }
    while( EECON1.WR==1);
    EEADR =AdrE ;
    EEDATA=car;
    EECON1.EEPGD=0;
    EECON1.WREN=1;
   EECON1.WRERR=0;
    EECON2=0x55;
    EECON2=0xAA;
    EECON1.WR=1;
    // test si fin d'ecriture
   while ( EECON1.WR ==1);
    // ou rajout delay
    // Delay_ms(20);
    PIR2.EEIF=0;    // to be sure
    EECON1.WREN=0;
   if (dr==1)INTCON.GIE =1;
}

void Save_Msg_To_EEPROM(unsigned char adrx, unsigned char * ptr1)
{
   while ((*ptr1>0) && (adrx<256))
        {
         EEPROM_Ecr(adrx++,*ptr1++);
         Delay_ms(20);
         }
}




unsigned char *Float2Ascii (float x, unsigned char *str,char precision)
{
 /* converts a floating point number to an ascii string */
 /* x is stored into str, which should be at least 30 chars long */
 unsigned char *adpt;
 int ie, i, k, ndig;
 double y;
 adpt=str;
 ndig = ( precision<=0) ? 7 : (precision > 22 ? 23 : precision+1);
 ie = 0;
 /* if x negative, write minus and reverse */
 if ( x < 0)
 {
   *str++ = '-';
   x = -x;
 }
 /* put x in range 1 <= x < 10 */
 if (> 0.0) while (< 1.0)
 {
   x *= 10.0;                // a la place de =*
   ie--;
 }
 while (>= 10.0)
 {
   x = x/10.0;
   ie++;
 }
 // in f format, number of digits is related to size
 ndig += ie;                                // a la place de =+
 //round. x is between 1 and 10 and ndig will be printed to
 // right of decimal point so rounding is ...
 for (= i = 1; i < ndig; i++)
 y = y/10.;
 x += y/2.;
 if (>= 10.0) {= 1.0; ie++;}
 if (ie<0)
 {
   *str++ = '0'; *str++ = '.';
   if (ndig < 0) ie = ie-ndig;
   for (= -1; i > ie; i--)  *str++ = '0';
 }
 for (i=0; i < ndig; i++)
 {
   k = x;
   *str++ = k + '0';
   if (==  ie ) *str++ = '.';
   x -= (y=k);
   x *= 10.0;
  }
 *str = '\0';
return (adpt);
}



void main() {
 TRISD = 0xC0 | 0b11111100;
 PORTD |= (1<<0);
 PORTD |= (1<<1);
 TRISA = 0xC0 | 0b11011111;
 PORTA |= (1<<5);
 TRISB = 0xC0 | 0b11111101;
 PORTB |= (1<<1);
 TRISC = 0b00000000;
 PORTC |= (1<<7);
 
   UART1_Write_CText
( "TEST "Version"\r\n");


 initlcd();       // Nokia LCD 3310
 Delay_ms(300);


Ce qui doit marcher jamais ne doit être pressé...... :idea:

afficheur Nokia 3310
PRNN-lab
Amateur
Amateur
Messages : 118
Enregistré en : août 2019

#7 Message par PRNN-lab » jeu. 8 août 2019 18:59

Bonsoir me revoilà j'ai toujours pas evolue sur le pic mais question d'organisation j'ai fini ce projet avec arduino.

Code : Tout sélectionner

// Module bluthoot
#include <SoftwareSerial.h> // Software Serial port
#define RxD   2
#define TxD   3
#define DEBUG_ENABLED 1

// Ecran NOKIA
#define PIN_SCE   5
#define PIN_RESET 6
#define PIN_DC    4
#define PIN_SDIN  8
#define PIN_SCLK  9

#define LCD_C     LOW
#define LCD_D     HIGH

#define LCD_X     84
#define LCD_Y     48
#define LCD_CMD   0

// boutons
const int bouton1=10;//bouton de commande vers la gauche
const int bouton2=11;//bouton de commande vers la droite
const int bouton3=12;//bouton de commande ENTREE
const int bouton4=13;//bouton de commande RETOUR

// bargraphe a led
const int leds[]={22,23,24,25,26,27,28,29,30,31};

// capteur du niveau de tension sur A1
//capteur du glucometre sur A2




int d=1// compteur pour a navigation dans le menu
int a 0;
float tension// tension indiquant le niveau de batterie pour l'allumage du bargraphe
float capteur;
int etat1;// etat du bouton1
int etat2;// etat du bouton2
int etat3;// etat du bouton3
int etat4;// etat du bouton4
SoftwareSerial blueToothSerial(RxDTxD);

static const 
byte ASCII[][5] =
{
 {
0x000x000x000x000x00// 20  
,{0x000x000x5f0x000x00// 21 !
,{0x000x070x000x070x00// 22 "
,{0x140x7f0x140x7f0x14// 23 #
,{0x240x2a0x7f0x2a0x12// 24 $
,{0x230x130x080x640x62// 25 %
,{0x360x490x550x220x50// 26 &
,{0x000x050x030x000x00// 27 '
,{0x000x1c0x220x410x00// 28 (
,{0x000x410x220x1c0x00// 29 )
,{0x140x080x3e0x080x14// 2a *
,{0x080x080x3e0x080x08// 2b +
,{0x000x500x300x000x00// 2c ,
,{0x080x080x080x080x08// 2d -
,{0x000x600x600x000x00// 2e .
,{0x200x100x080x040x02// 2f /
,{0x3e0x510x490x450x3e// 30 0
,{0x000x420x7f0x400x00// 31 1
,{0x420x610x510x490x46// 32 2
,{0x210x410x450x4b0x31// 33 3
,{0x180x140x120x7f0x10// 34 4
,{0x270x450x450x450x39// 35 5
,{0x3c0x4a0x490x490x30// 36 6
,{0x010x710x090x050x03// 37 7
,{0x360x490x490x490x36// 38 8
,{0x060x490x490x290x1e// 39 9
,{0x000x360x360x000x00// 3a :
,{0x000x560x360x000x00// 3b ;
,{0x080x140x220x410x00// 3c <
,{0x140x140x140x140x14// 3d =
,{0x000x410x220x140x08// 3e >
,{0x020x010x510x090x06// 3f ?
,{0x320x490x790x410x3e// 40 @
,{0x7e0x110x110x110x7e// 41 A
,{0x7f0x490x490x490x36// 42 B
,{0x3e0x410x410x410x22// 43 C
,{0x7f0x410x410x220x1c// 44 D
,{0x7f0x490x490x490x41// 45 E
,{0x7f0x090x090x090x01// 46 F
,{0x3e0x410x490x490x7a// 47 G
,{0x7f0x080x080x080x7f// 48 H
,{0x000x410x7f0x410x00// 49 I
,{0x200x400x410x3f0x01// 4a J
,{0x7f0x080x140x220x41// 4b K
,{0x7f0x400x400x400x40// 4c L
,{0x7f0x020x0c0x020x7f// 4d M
,{0x7f0x040x080x100x7f// 4e N
,{0x3e0x410x410x410x3e// 4f O
,{0x7f0x090x090x090x06// 50 P
,{0x3e0x410x510x210x5e// 51 Q
,{0x7f0x090x190x290x46// 52 R
,{0x460x490x490x490x31// 53 S
,{0x010x010x7f0x010x01// 54 T
,{0x3f0x400x400x400x3f// 55 U
,{0x1f0x200x400x200x1f// 56 V
,{0x3f0x400x380x400x3f// 57 W
,{0x630x140x080x140x63// 58 X
,{0x070x080x700x080x07// 59 Y
,{0x610x510x490x450x43// 5a Z
,{0x000x7f0x410x410x00// 5b [
,{0x020x040x080x100x20// 5c ¥
,{0x000x410x410x7f0x00// 5d ]
,{0x040x020x010x020x04// 5e ^
,{0x400x400x400x400x40// 5f _
,{0x000x010x020x040x00// 60 `
,{0x200x540x540x540x78// 61 a
,{0x7f0x480x440x440x38// 62 b
,{0x380x440x440x440x20// 63 c
,{0x380x440x440x480x7f// 64 d
,{0x380x540x540x540x18// 65 e
,{0x080x7e0x090x010x02// 66 f
,{0x0c0x520x520x520x3e// 67 g
,{0x7f0x080x040x040x78// 68 h
,{0x000x440x7d0x400x00// 69 i
,{0x200x400x440x3d0x00// 6a j 
,{0x7f0x100x280x440x00// 6b k
,{0x000x410x7f0x400x00// 6c l
,{0x7c0x040x180x040x78// 6d m
,{0x7c0x080x040x040x78// 6e n
,{0x380x440x440x440x38// 6f o
,{0x7c0x140x140x140x08// 70 p
,{0x080x140x140x180x7c// 71 q
,{0x7c0x080x040x040x08// 72 r
,{0x480x540x540x540x20// 73 s
,{0x040x3f0x440x400x20// 74 t
,{0x3c0x400x400x200x7c// 75 u
,{0x1c0x200x400x200x1c// 76 v
,{0x3c0x400x300x400x3c// 77 w
,{0x440x280x100x280x44// 78 x
,{0x0c0x500x500x500x3c// 79 y
,{0x440x640x540x4c0x44// 7a z
,{0x000x080x360x410x00// 7b {
,{0x000x000x7f0x000x00// 7c |
,{0x000x410x360x080x00// 7d }
,{0x100x080x080x100x08// 7e ←
,{0x000x060x090x090x06// 7f →
};




void LcdCharacter(char character)
{
  
LcdWrite(LCD_D0x00);
  for (
int index 0index 5index++)
  {
    
LcdWrite(LCD_DASCII[character 0x20][index]);
  }
  
LcdWrite(LCD_D0x00);
}

void LcdClear(void)
{
  for (
int index 0index LCD_X LCD_Y 8index++)
  {
    
LcdWrite(LCD_D0x00);
  }
}

void LcdInitialise(void)
{
  
pinMode(PIN_SCE,   OUTPUT);
  
pinMode(PIN_RESETOUTPUT);
  
pinMode(PIN_DC,    OUTPUT);
  
pinMode(PIN_SDIN,  OUTPUT);
  
pinMode(PIN_SCLK,  OUTPUT);
  

  
digitalWrite(PIN_RESETLOW);
 
// delay(1);
  
digitalWrite(PIN_RESETHIGH);

  
LcdWriteLCD_CMD0x21 );  // LCD Extended Commands.
  
LcdWriteLCD_CMD0xBf );  // Set LCD Vop (Contrast). //B1
  
LcdWriteLCD_CMD0x04 );  // Set Temp coefficent. //0x04
  
LcdWriteLCD_CMD0x14 );  // LCD bias mode 1:48. //0x13
  
LcdWriteLCD_CMD0x0C );  // LCD in normal mode. 0x0d for inverse
  
LcdWrite(LCD_C0x20);
  
LcdWrite(LCD_C0x0C);
}

void LcdString(char *characters)
{
  while (*
characters)
  {
    
LcdCharacter(*characters++);
  }
}

void LcdWrite(byte dcbyte data)
{
  
digitalWrite(PIN_DCdc);
  
digitalWrite(PIN_SCELOW);
  
shiftOut(PIN_SDINPIN_SCLKMSBFIRSTdata);
  
digitalWrite(PIN_SCEHIGH);
}

// gotoXY routine to position cursor 
// x - range: 0 to 84
// y - range: 0 to 5

void gotoXY(int xint y)
{
  
LcdWrite00x80 x);  // Column.
  
LcdWrite00x40 y);  // Row.  

}



void drawLine(void)
{
  
unsigned char  j;  
   for(
j=0j<84j++) // top
  
{
          
gotoXY (j,0);
    
LcdWrite (1,0x01);
  }   
  for(
j=0j<84j++) //Bottom
  
{
          
gotoXY (j,5);
    
LcdWrite (1,0x80);
  }   

  for(
j=0j<6j++) // Right
  
{
          
gotoXY (83,j);
    
LcdWrite (1,0xff);
  }   
  for(
j=0j<6j++) // Left
  
{
          
gotoXY (0,j);
    
LcdWrite (1,0xff);
  }

}


void setup(void)
{

  
 
pinMode(bouton1INPUT);
 
pinMode(bouton2INPUT);
 
pinMode(bouton3INPUT);
 
pinMode(bouton4INPUT);
int i=0;
for(
i=0;i<11;i++){
pinMode (leds[i],OUTPUT);
}
for(
i=0;i<11;i++){
digitalWrite(leds[i],LOW);
}

  
 
LcdInitialise();
 
LcdClear();
 
setupBlueToothConnection(); // Lacement du Bluetooth
 
blueToothSerial.begin(9600);

 
gotoXY(24,3);
  
LcdCharacter(' ');
  
LcdCharacter('M');
  
LcdCharacter('E');
  
LcdCharacter('N');
  
LcdCharacter('U');
  
LcdCharacter(' ');
  
LcdCharacter('-');
  
// Draw + at this position
  
gotoXY(10,3);
  
LcdCharacter('-');

  
gotoXY(24,4);
  
LcdCharacter(' ');
  
LcdCharacter('T');
  
LcdCharacter('E');
  
LcdCharacter('S');
  
LcdCharacter('T');
  
LcdCharacter(' ');
  
LcdCharacter('>');
  
// Draw + at this position
  
gotoXY(10,4);
  
LcdCharacter('<');

}

void loop(void)
{
  
// Display some simple character animation
  //
  
int a,b;
  
char Str[15];
  
// Draw a Box
  
for(b=1000b>0b--){
  
drawLine();
  for(
a=0a<=a++){
  
gotoXY(4,1);
  
// Put text in Box
  
LcdString ("GLUCOMETRE");

 
   
  
 
// NAVVIGATION vers la gauche et vers la droite
 
etat1 digitalRead(bouton1);
 
etat2 digitalRead(bouton2);
  if (
etat1==LOW)//le bouton est relacher
     
{
      
M1:
      
d=1;

  
gotoXY(24,3);
  
LcdCharacter(' ');
  
LcdCharacter('M');
  
LcdCharacter('E');
  
LcdCharacter('N');
  
LcdCharacter('U');
  
LcdCharacter(' ');
  
LcdCharacter('-');
  
// Draw + at this position
  
gotoXY(10,3);
  
LcdCharacter('-');
  
         
gotoXY(24,4);
  
LcdCharacter(' ');
  
LcdCharacter('T');
  
LcdCharacter('E');
  
LcdCharacter('S');
  
LcdCharacter('T');
  
LcdCharacter(' ');
  
LcdCharacter('>');
  
// Draw + at this position
  
gotoXY(10,4);
  
LcdCharacter('<'); 
       }  else if (
etat2==LOW)//le bouton est relacher
     
{
      
M2:
      
d=2;

  
gotoXY(24,3);
  
LcdCharacter(' ');
  
LcdCharacter('M');
  
LcdCharacter('E');
  
LcdCharacter('N');
  
LcdCharacter('U');
  
LcdCharacter(' ');
  
LcdCharacter('-');
  
// Draw + at this position
  
gotoXY(10,3);
  
LcdCharacter('-');
        
gotoXY(24,4);
  
LcdCharacter(' ');
  
LcdCharacter('S');
  
LcdCharacter('A');
  
LcdCharacter('V');
  
LcdCharacter('E');
  
LcdCharacter(' ');
  
LcdCharacter('>');
  
// Draw - at this position
  
gotoXY(10,4);
  
LcdCharacter('<');
        }
// ENTRER et sortir d'une selection
 
etat3 digitalRead(bouton3);
 
etat4 digitalRead(bouton4);
if (
etat3==LOW)//le bouton est relacher
     
{
     switch (
d){
      case 
1
       
gotoXY(24,3);
  
LcdCharacter(' ');
  
LcdCharacter('T');
  
LcdCharacter('E');
  
LcdCharacter('S');
  
LcdCharacter('T');
  
LcdCharacter(' ');
  
LcdCharacter('-');
  
// Draw + at this position
  
gotoXY(10,3);
  
LcdCharacter('-');

    
gotoXY(24,4);
  
LcdCharacter(' ');
  
LcdCharacter(' ');
  
LcdCharacter(' ');
  
LcdCharacter(' ');
  
LcdCharacter(' ');
  
LcdCharacter(' ');
  
LcdCharacter(' ');
  
// Draw - at this position
  
gotoXY(10,4);
  
LcdCharacter(' ');

   
gotoXY(24,4);
   
//LcdString (char(capteur));
  
capteur analogRead(2);
  
capteurmap (capteur,0,1023,0,5000);
  
LcdString ("3");
  
delay (500);
  
gotoXY(24,4);
  
LcdString ("2");
  
delay (500);
  
gotoXY(24,4);
   
LcdString ("1");
  
delay (500);
  
capteur analogRead(2);
  
capteurmap (capteur,0,1023,0,5000);
  
gotoXY(24,4);
  if (
capteur!=0){
  
LcdString ("SUCCESS !!");
  }else{
   
LcdString ("FAILD !!"); 
    }
  
d=3;
  break;
       case 
:
      
gotoXY(24,3);
  
LcdCharacter(' ');
  
LcdCharacter('S');
  
LcdCharacter('A');
  
LcdCharacter('V');
  
LcdCharacter('E');
  
LcdCharacter(' ');
  
LcdCharacter('-');
  
// Draw + at this position
  
gotoXY(10,3);
  
LcdCharacter('-');
    
gotoXY(24,4);
  
LcdCharacter(' ');
  
LcdCharacter(' ');
  
LcdCharacter(' ');
  
LcdCharacter(' ');
  
LcdCharacter(' ');
  
LcdCharacter(' ');
  
LcdCharacter(' ');
  
// Draw - at this position
  
gotoXY(10,4);
  
LcdCharacter(' ');
  
blueToothSerial.print(capteur);
  
delay(500);
  

  
  
d=4;
  break;
      
      }
    
       }  else if (
etat4==LOW)//retour en arriere
     
{
      switch (
d){
        case 
3:
        goto 
M1;
        break;
        case 
4:
        goto 
M2;
        break;
        
        }
 
        }

tension=analogRead(1);
tensionmap (tension,0,1023,0,5000);
tensiontension/1000;
afficher (tension );

 

  }
  }


 
}

void afficher(float valeur){
  
    if (
valeur>=(0.35))
    
digitalWrite(leds[0],HIGH);
    else 
    
digitalWrite(leds[0],LOW);
     if (
valeur>=(0.70))
    
digitalWrite (leds[1],HIGH);
    else 
    
digitalWrite(leds[1],LOW);
      if (
valeur>=(1.05))
     
digitalWrite(leds[2],HIGH);
     else 
    
digitalWrite(leds[2],LOW);
      if (
valeur>=(1.40))
    
digitalWrite(leds[3],HIGH);
    else 
    
digitalWrite(leds[3],LOW);
        if (
valeur>=(1.75))
    
digitalWrite(leds[4],HIGH);
    else 
    
digitalWrite(leds[4],LOW);
    if (
valeur>=(2.1))
    
digitalWrite(leds[5],HIGH);
    else 
    
digitalWrite(leds[5],LOW);
    if (
valeur>=(2.45))
    
digitalWrite(leds[6],HIGH);
    else 
    
digitalWrite(leds[6],LOW);
    if (
valeur>=(2.80))
    
digitalWrite(leds[7],HIGH);
    else 
    
digitalWrite(leds[7],LOW);
    if (
valeur>=(3.15))
    
digitalWrite(leds[8],HIGH);
    else 
    
digitalWrite(leds[8],LOW);
    if (
valeur>=(3.50))
    
digitalWrite(leds[9],HIGH);
    else 
    
digitalWrite(leds[9],LOW);
    
    
    
  }

void setupBlueToothConnection() // fonctionnement a 9600bit/s mode onctionnement esclave permettant dapparier lappareil
{
  
blueToothSerial.begin(9600);
  
blueToothSerial.print("AT");
  
delay(400);                // recuperation sur e moniteur serie des liaison bluetooth
  
blueToothSerial.print("AT+DEFAULT");
  
delay(2000);
  
blueToothSerial.print("AT+NAMEcollege"); // Nom du bluetooth: College(12)
  
delay(400);                                  // a remplacer par le nom de votre section TSTI2DSIN
   
blueToothSerial.print("AT+PIN0000");// code dauthentification
  
delay(400);
  
blueToothSerial.print("AT+AUTHI");
  
delay(400);
  
blueToothSerial.flush();
Ce qui doit marcher jamais ne doit être pressé...... :idea:

afficheur Nokia 3310
PRNN-lab
Amateur
Amateur
Messages : 118
Enregistré en : août 2019

#8 Message par PRNN-lab » jeu. 8 août 2019 19:05

j'ai utiliser un arduino mega j'ai testé tout fonctionne mais c'est un peut lent mais ca fonctionne j'aurai pu mettre un module sd mais bon comme avec le pic c'est impossible j'ai laissé .
Maintenant je dois trouvee un moyen de traduire tout ca en language pic :roll:
Vous n’avez pas les permissions nécessaires pour voir les fichiers joints à ce message.
Ce qui doit marcher jamais ne doit être pressé...... :idea:

afficheur Nokia 3310
PRNN-lab
Amateur
Amateur
Messages : 118
Enregistré en : août 2019

#9 Message par PRNN-lab » jeu. 8 août 2019 19:11

..
Vous n’avez pas les permissions nécessaires pour voir les fichiers joints à ce message.
Ce qui doit marcher jamais ne doit être pressé...... :idea:

afficheur Nokia 3310
Temps-x
Avatar de l’utilisateur
Expert
Expert
Messages : 2595
Enregistré en : juillet 2016
Localisation : Terre

#10 Message par Temps-x » jeu. 8 août 2019 19:18

Bonsoir PRNN-lab, et tout le forum,

PRNN-lab a écrit :Source du message Maintenant je dois trouvee un moyen de traduire tout ca en language pic :roll:


L'arduino c'est facile, mais la programmation Pic c'est autre chose, il faut connaître ton microcontrôleur, et l'étudier.

A propos d'arduino je te conseille de lire ça

Si j'ai le temps :sifflotte: je te le ferais en ASM pour ton écran ....

Dans tout les cas ça fait plaisir de voir quelqu'un qui s'intéresse à son métier, car croit moi, on vois pas mal de monde passer, qui ne font aucun effort
pour écrire quelque ligne ou faire un schéma.

==> A+
:roll: Les requins, c'est comme le langage ASM, c'est le sommet de la chaîne alimentaire. :wink:


Retourner vers « Langage C »

Qui est en ligne

Utilisateurs parcourant ce forum : Aucun utilisateur enregistré et 41 invités