programmation avec mikroC for pic - Page 3
Répondre à la discussion
Page 3 sur 4 PremièrePremière 3 DernièreDernière
Affichage des résultats 61 à 90 sur 94

programmation avec mikroC for pic



  1. #61
    invite1d577638

    Re : programmation avec mikroC for pic


    ------

    Bon résumons :

    -tu as trouvé un code venant du net. Où ? Tu es sûr qu'il est compatible avec ton soft ? Tu es sûr qu'il va faire ce dont tu as besoin ?
    -retourne à l'endroit où tu as trouvé ce code. ça serait bien le diable si tu ne trouves pas les librairies qu'il te manque. Sinon oui, une bonne recherche te permettra de trouver des fichiers "defs.h". Après, qu'il s'agisse du bon fichier, c'est autre chose...
    -pourquoi vouloir inclure ce fichier ? Pourquoi vouloir inclure lcd.h et stdio.h ? J'ai l'impression que tu modifies les lignes include un peu n'importe comment...?

    Sans plus d'infos globales, je vais sans doute laisser tomber. Si tu réalises cela dans un cadre scolaire, tu as normalement eu la formation pour, et tu dois normalement pouvoir demander de l'aide à tes encadrants. A ce niveau, nous allons être bloqués.

    -----

  2. #62
    invite11398957

    Re : programmation avec mikroC for pic

    il se confirme bien que dans les nouvelles versions de mikroc la librairie Lcd8 n'existe plus (voir fichier : migration_mikroc_PRO_PIC.chm)
    Removed Libraries and Routines
    In the new mikroC PRO for PIC, you will find that some of the existing libraries are removed. These are :

    Bootloader Library (which is now distributed in the Bootloader example folders),
    Lcd Custom Library,
    Lcd8 Library.

  3. #63
    invitec4b4e47b

    Re : programmation avec mikroC for pic

    Oui, comme ça on revient à mon problème principale c'est que le compilateur n'accepte pas les commandes du "lcd"
    voici le code:
    Code:
    #pragma chip PIC18F4550;
    
     char LCD_DataPort at PORTD;
    
      // LCD pinout setting
      sbit LCD_RS at RE1_bit;
      sbit LCD_RW at RE0_bit;
      sbit LCD_E at RE2_bit;
      sbit LCD_D0 at RD0_bit;
      sbit LCD_D1 at RD1_bit;
      sbit LCD_D2 at RD2_bit;
      sbit LCD_D3 at RD3_bit;
      sbit LCD_D4 at RD4_bit;
      sbit LCD_D5 at RD5_bit;
      sbit LCD_D6 at RD6_bit;
      sbit LCD_D7 at RD7_bit;
      // Pin Direction;
      sbit LCD_RS_Direction at TRISE.B1;
      sbit LCD_RW_Direction at TRISE.B0;
      sbit LCD_E_Direction at TRISE.B2;
      sbit LCD_D0_Direction at TRISD.B0;
      sbit LCD_D1_Direction at TRISD.B1;
      sbit LCD_D2_Direction at TRISD.B2;
      sbit LCD_D3_Direction at TRISD.B3;
      sbit LCD_D4_Direction at TRISD.B4;
      sbit LCD_D5_Direction at TRISD.B5;
      sbit LCD_D6_Direction at TRISD.B6;
      sbit LCD_D7_Direction at TRISD.B7;
    
    void main()
    {
    
       TRISD = 0x00; // PORT D IS OUTPUT TO LCD
       TRISE = 0x00; // PORT E IS OUTPUT TO LCD
       Lcd_Init();
       lcd_cmd(_lcd_clear) ;
       lcd_cmd(_lcd_cursor_off) ;
       lcd_out(1,1,"hello");
       lcd_out(2,1,"wold");
       
    
    }
    le compilateur :
    0 1 mikroCPIC1618.exe -MSF -DBG -pP18F4550 -DL -O11111114 -fo4 -N"C:\Users\Public\Documents\Mi kroelektronika\mikroC PRO for PIC\Examples\Development Systems\EASYPIC6\Led Blinking\MyProject.mcppi" -SP"C:\Users\Public\Documents\M ikroelektronika\mikroC PRO for PIC\defs\" -SP"C:\Users\Public\Documents\M ikroelektronika\mikroC PRO for PIC\uses\P18\" -SP"C:\Users\Public\Documents\M ikroelektronika\mikroC PRO for PIC\Examples\Development Systems\EASYPIC6\Led Blinking\" "MyProject.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_MemManager.mcl" "__Lib_Conversions.mcl" "__Lib_Sprintf.mcl" "__Lib_PrintOut.mcl" "__Lib_Sprinti.mcl" "__Lib_Sprintl.mcl" "__Lib_Time.mcl" "__Lib_Trigonometry.mcl" "__Lib_Button.mcl" "__Lib_Keypad4x4.mcl" "__Lib_Manchester.mcl" "__Lib_OneWire.mcl" "__Lib_PS2.mcl" "__Lib_Sound.mcl" "__Lib_SoftI2C.mcl" "__Lib_SoftSPI.mcl" "__Lib_SoftUART.mcl" "__Lib_ADC_A_D.mcl" "__Lib_EEPROM_256.mcl" "__Lib_FLASH_w32_e64.mcl" "__Lib_I2C_b10.mcl" "__Lib_PWM_c21.mcl" "__Lib_SPI_b10c7.mcl" "__Lib_UART_c67.mcl" "__Lib_USB_genHID.mcl" "__Lib_PortExpander.mcl" "__Lib_CANSPI.mcl" "__Lib_CF.mcl" "__Lib_CFFat16.mcl" "__Lib_GlcdFonts.mcl" "__Lib_Glcd.mcl" "__Lib_LcdConsts.mcl" "__Lib_Lcd.mcl" "__Lib_Mmc.mcl" "__Lib_MmcFat16.mcl" "__Lib_RS485.mcl" "__Lib_S1D13700.mcl" "__Lib_T6963C.mcl" "__Lib_SPIGlcd.mcl" "__Lib_SPILcd.mcl" "__Lib_SPILcd8.mcl" "__Lib_SPIT6963C.mcl" "__Lib_EthEnc28j60.mcl" "__Lib_TFT.mcl" "__Lib_TouchPanel_TFT.mcl" "__Lib_EthEnc24j600.mcl" "__Lib_TouchPanel.mcl"
    0 1139 Available RAM: 2027 [bytes], Available ROM: 32768 [bytes]
    0 126 All files Preprocessed in 32 ms
    0 1507 Unknown pragma line ignored: '' MyProject.c
    0 122 Compilation Started MyProject.c
    42 123 Compiled Successfully MyProject.c
    0 127 All files Compiled in 46 ms
    0 360 Unresolved extern 'LCD_EN' __Lib_Lcd.c
    0 360 Unresolved extern 'LCD_EN_Direction' __Lib_Lcd.c
    0 360 Unresolved extern 'LCD_EN' __Lib_Lcd.c
    0 102 Finished (with errors): 19 mars 2015, 16:54:22 MyProject.mcppi

    J'ai pas compris pourquoi?

  4. #64
    invite11398957

    Re : programmation avec mikroC for pic

    C'est pas possible, dans un message précédent je vous ai signaler le problème avec la déclaration
    sbit LCD_E at RE2_bit;
    il faut mettre
    sbit LCD_EN at RE2_bit;
    la même chose pour
    sbit LCD_EN_Direction at TRISE.B2;
    Il faut lire les messages d'erreur.
    A+

  5. #65
    invite11398957

    Re : programmation avec mikroC for pic

    Si vous avez créé votre projet en utilisant la procédure normale "new_project" vous avez indiqué le type de micro utilisé donc il n'est pas nécessaire de mettre
    #pragma chip PIC18F4550;
    Il y a des différences par rapport à un programme C "disons classique" de type MPLABX par ex.
    on aime ou pas !

  6. #66
    invitec4b4e47b

    Re : programmation avec mikroC for pic

    En fiiiiiiiiin, ça marche bien mercii bien pour votre aide !!

    0 1 mikroCPIC1618.exe -MSF -DBG -pP18F4550 -DL -O11111114 -fo4 -N"C:\Users\Public\Documents\Mi kroelektronika\mikroC PRO for PIC\Examples\Development Systems\EASYPIC6\Led Blinking\MyProject.mcppi" -SP"C:\Users\Public\Documents\M ikroelektronika\mikroC PRO for PIC\defs\" -SP"C:\Users\Public\Documents\M ikroelektronika\mikroC PRO for PIC\uses\P18\" -SP"C:\Users\Public\Documents\M ikroelektronika\mikroC PRO for PIC\Examples\Development Systems\EASYPIC6\Led Blinking\" "MyProject.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_MemManager.mcl" "__Lib_Conversions.mcl" "__Lib_Sprintf.mcl" "__Lib_PrintOut.mcl" "__Lib_Sprinti.mcl" "__Lib_Sprintl.mcl" "__Lib_Time.mcl" "__Lib_Trigonometry.mcl" "__Lib_Button.mcl" "__Lib_Keypad4x4.mcl" "__Lib_Manchester.mcl" "__Lib_OneWire.mcl" "__Lib_PS2.mcl" "__Lib_Sound.mcl" "__Lib_SoftI2C.mcl" "__Lib_SoftSPI.mcl" "__Lib_SoftUART.mcl" "__Lib_ADC_A_D.mcl" "__Lib_EEPROM_256.mcl" "__Lib_FLASH_w32_e64.mcl" "__Lib_I2C_b10.mcl" "__Lib_PWM_c21.mcl" "__Lib_SPI_b10c7.mcl" "__Lib_UART_c67.mcl" "__Lib_USB_genHID.mcl" "__Lib_PortExpander.mcl" "__Lib_CANSPI.mcl" "__Lib_CF.mcl" "__Lib_CFFat16.mcl" "__Lib_GlcdFonts.mcl" "__Lib_Glcd.mcl" "__Lib_LcdConsts.mcl" "__Lib_Lcd.mcl" "__Lib_Mmc.mcl" "__Lib_MmcFat16.mcl" "__Lib_RS485.mcl" "__Lib_S1D13700.mcl" "__Lib_T6963C.mcl" "__Lib_SPIGlcd.mcl" "__Lib_SPILcd.mcl" "__Lib_SPILcd8.mcl" "__Lib_SPIT6963C.mcl" "__Lib_EthEnc28j60.mcl" "__Lib_TFT.mcl" "__Lib_TouchPanel_TFT.mcl" "__Lib_EthEnc24j600.mcl" "__Lib_TouchPanel.mcl"
    0 1139 Available RAM: 2027 [bytes], Available ROM: 32768 [bytes]
    0 126 All files Preprocessed in 47 ms
    0 122 Compilation Started MyProject.c
    36 123 Compiled Successfully MyProject.c
    0 127 All files Compiled in 46 ms
    0 1144 Used RAM (bytes): 66 (3%) Free RAM (bytes): 1961 (97%) Used RAM (bytes): 66 (3%) Free RAM (bytes): 1961 (97%)
    0 1144 Used ROM (bytes): 578 (2%) Free ROM (bytes): 32190 (98%) Used ROM (bytes): 578 (2%) Free ROM (bytes): 32190 (98%)
    0 125 Project Linked Successfully MyProject.mcppi
    0 128 Linked in 609 ms
    0 129 Project 'MyProject.mcppi' completed: 827 ms
    0 103 Finished successfully: 19 mars 2015, 17:41:48 MyProject.mcppi

    Je vous remercie énormément!

  7. #67
    invitec4b4e47b

    Re : programmation avec mikroC for pic

    Il reste ces 2 questions si vous pouvez m'aider je serais contente :
    1/ comment je peux configurer avec mikroC for pic le code lu par douchette transmis avec USB vers le pic.
    2/ Comment je peut programmer pour afficher sur LCD le message délivré par le pic18f4550 (code à barres).
    Merci d'avance.

  8. #68
    invitec4b4e47b

    Re : programmation avec mikroC for pic

    J'ai compilée avec ISIS mais l'LCD n'affiche rien !
    j'ai eu ce message 600 fois dans la pièce jointe:
    Nom : simulation.png
Affichages : 735
Taille : 75,5 Ko
    J'ai pas compris :/

  9. #69
    invite1d577638

    Re : programmation avec mikroC for pic

    Citation Envoyé par mirachou Voir le message
    1/ comment je peux configurer avec mikroC for pic le code lu par douchette transmis avec USB vers le pic.
    2/ Comment je peut programmer pour afficher sur LCD le message délivré par le pic18f4550 (code à barres).
    Tu sais programmer de façon générale ou pas ? Au vu de tes précédentes interventions, c'est pas gagné... Commence par un algorithme de ce que ton programme doit faire.

    J'ai compilée avec ISIS mais l'LCD n'affiche rien !
    Schéma ?

  10. #70
    invitec4b4e47b

    Re : programmation avec mikroC for pic

    Bonjour,
    J'ai dit dés le début que je suis débutantes en programmation c'est la première fois que j'utilise mikroc, c'est pour cela que je demande votre aide..
    mon problème c'est comment peut-on afficher le contenu des ports de pic sur LCD? j'ai pas trouvée l'instruction!
    et deuxièmement comment peut-on faire la transmission de données de USB <-> PIC (vue que l'USB ne porte que D+ et D- et le pic contient 8 ports )
    voici le montage avec isis :
    isis.png
    et les messages :
    messages.png

    Merci d'avance..

  11. #71
    invite1d577638

    Re : programmation avec mikroC for pic

    Citation Envoyé par mirachou Voir le message
    mon problème c'est comment peut-on afficher le contenu des ports de pic sur LCD? j'ai pas trouvée l'instruction!
    Tu veux faire quoi exactement ? Pour visualiser l'état d'une sortie, le plus simple est une led...

    et deuxièmement comment peut-on faire la transmission de données de USB <-> PIC (vue que l'USB ne porte que D+ et D- et le pic contient 8 ports )
    Il te faut un convertisseur USB <-> TTL, que tu viens ensuite brancher sur l'UART de ton PIC.

    Il n'y a pas l'air d'avoir d'erreurs dans tes messages...?

  12. #72
    invitec4b4e47b

    Re : programmation avec mikroC for pic

    Mon but c'est d'avoir programmer la lecture de code à barres avec un pic184550 et l'afficher sur LCD.
    Oui, je sais que j'ai pas d'erreur mais je sais pas pourquoi il n'affiche rien pourtant j'ai vérifiée tout les connexions des pins de pic..
    Pardon, j'ai bien compris concernant le convertisseur usb<->TTL, vous pouvez m'expliquer ?

  13. #73
    invite1d577638

    Re : programmation avec mikroC for pic

    J'ai du mal à voir le câblage de l'alim de ton LCD.

    programmer la lecture de code à barres
    donne la doc technique de ce truc

    Pardon, j'ai bien compris concernant le convertisseur usb<->TTL, vous pouvez m'expliquer ?
    Le port série de ton PIC (pins TX et RX) travaillent avec des niveaux TTL (0..5V). Si tu veux communiquer avec un PC, il faut "adapter" ces niveaux pour qu'ils soient compatibles avec le protocole USB. Mais ça, c'est pour relier ton PIC à un PC. Relier ton pic à ton lecteur de code barre, c'est différent. Mais sans doc...

  14. #74
    invitec4b4e47b

    Re : programmation avec mikroC for pic

    voici une autre image :
    Nom : isis.png
Affichages : 483
Taille : 52,4 Ko
    Oui, je doit relier: mon lecteur code barres <-> usb<->pic184550<->LCD

  15. #75
    invite11398957

    Re : programmation avec mikroC for pic

    Bonjour,

    le 18F4550 possède un port usb (RC5 (pin 24)et RC4(pin 23)) voir par ex ici : http://www.rakeshmondal.info/pic18f4...ial-part-1-USB

    A+

  16. #76
    adipie

    Re : programmation avec mikroC for pic

    Ce qu'il faut faire, c'est commencer par programmer l'exemple LCD qui se trouve dans le répertoire exemple de MikroC et ensuite faite la même chose pour la liaison USB.
    Voir exemple de code ci-dessous

    http://www.mikroe.com/download/eng/d...cd_library.htm
    http://www.mikroe.com/download/eng/d...id_library.htm

  17. #77
    paulfjujo

    Re : programmation avec mikroC for pic

    comment peut-on afficher le contenu des ports de pic sur LCD?

    on peut l'afficher en binaire, en decimal ou en hexadecimal...

    Code:
    char txt[17];
    
    
    // en hexa
    sprintf(txt,"PORTD= %02X      ",PORTD);
    Lcd8_Out(1,1,txt);
    delay_ms(2000);
    // en binaire 
    sprintf(txt,"PORTD= %08b",PORTD);
    Lcd8_Out(2,1,txt);
    delay_ms(2000);
    // en decimal 
    sprintf(txt,"PORTD= % 3d      ",PORTD);
    Lcd8_Out(1,1,txt);
    delay_ms(2000);

  18. #78
    invite11398957

    Re : programmation avec mikroC for pic

    Bonjour,

    Ne pas oublier de mettre toutes les pins en digital, pour cela rajouter cette ligne :

    ADCON1 = 0b00001111;

    Penser à supprimer dans le programme les déclarations concernant les pin D0 à D3, la librairie fonctionne en mode 4 bits, sur le schéma il est possible de supprimer les connexions entre ces pins et le 18f4550.


    A+

  19. #79
    invitec4b4e47b

    Re : programmation avec mikroC for pic

    Bonsoir,
    Je vous remercie tous énormément, j'arrive à afficher en fin le texte sur LCD. Mais, j'ai d'autre problème concernant l'affichage de contenu des pins de pic..
    voici code:
    Code:
     // LCD pinout setting
      sbit LCD_RS at RE1_bit;
      sbit LCD_EN at RE2_bit;
      sbit LCD_D0 at RD0_bit;
      sbit LCD_D1 at RD1_bit;
      sbit LCD_D2 at RD2_bit;
      sbit LCD_D3 at RD3_bit;
      sbit LCD_D4 at RD4_bit;
      sbit LCD_D5 at RD5_bit;
      sbit LCD_D6 at RD6_bit;
      sbit LCD_D7 at RD7_bit;
      // Pin Direction;
      sbit LCD_RS_Direction at TRISE.B1;
      sbit LCD_EN_Direction at TRISE.B2;
      sbit LCD_D0_Direction at TRISD.B0;
      sbit LCD_D1_Direction at TRISD.B1;
      sbit LCD_D2_Direction at TRISD.B2;
      sbit LCD_D3_Direction at TRISD.B3;
      sbit LCD_D4_Direction at TRISD.B4;
      sbit LCD_D5_Direction at TRISD.B5;
      sbit LCD_D6_Direction at TRISD.B6;
      sbit LCD_D7_Direction at TRISD.B7;
      // End LCD module connections
     char txt[17];
    void main()
    {  ADCON1 = 0b00001111;
       Lcd_Init();
       /*lcd_out(1,1,"hello");
       lcd_out(2,1,"wold");*/
    
    // en binaire
    sprintf(txt,"PORTD= %08b",PORTD);
    Lcd_Out(2,1,txt);
    delay_ms(2000);
    Lcd_cmd(_Lcd_cursor_off) ;
    }
    Les erreurs :
    0 1 mikroCPIC1618.exe -MSF -DBG -pP18F4550 -DL -O11111114 -fo4 -N"C:\Users\Public\Documents\Mi kroelektronika\mikroC PRO for PIC\Examples\Development Systems\EASYPIC6\Led Blinking\MyProject.mcppi" -SP"C:\Users\Public\Documents\M ikroelektronika\mikroC PRO for PIC\defs\" -SP"C:\Users\Public\Documents\M ikroelektronika\mikroC PRO for PIC\uses\P18\" -SP"C:\Users\Public\Documents\M ikroelektronika\mikroC PRO for PIC\Examples\Development Systems\EASYPIC6\Led Blinking\" "MyProject.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_MemManager.mcl" "__Lib_Conversions.mcl" "__Lib_Sprintf.mcl" "__Lib_PrintOut.mcl" "__Lib_Sprinti.mcl" "__Lib_Sprintl.mcl" "__Lib_Time.mcl" "__Lib_Trigonometry.mcl" "__Lib_Button.mcl" "__Lib_Keypad4x4.mcl" "__Lib_Manchester.mcl" "__Lib_OneWire.mcl" "__Lib_PS2.mcl" "__Lib_Sound.mcl" "__Lib_SoftI2C.mcl" "__Lib_SoftSPI.mcl" "__Lib_SoftUART.mcl" "__Lib_ADC_A_D.mcl" "__Lib_EEPROM_256.mcl" "__Lib_FLASH_w32_e64.mcl" "__Lib_I2C_b10.mcl" "__Lib_PWM_c21.mcl" "__Lib_SPI_b10c7.mcl" "__Lib_UART_c67.mcl" "__Lib_USB_genHID.mcl" "__Lib_PortExpander.mcl" "__Lib_CANSPI.mcl" "__Lib_CF.mcl" "__Lib_CFFat16.mcl" "__Lib_GlcdFonts.mcl" "__Lib_Glcd.mcl" "__Lib_LcdConsts.mcl" "__Lib_Lcd.mcl" "__Lib_Mmc.mcl" "__Lib_MmcFat16.mcl" "__Lib_RS485.mcl" "__Lib_S1D13700.mcl" "__Lib_T6963C.mcl" "__Lib_SPIGlcd.mcl" "__Lib_SPILcd.mcl" "__Lib_SPILcd8.mcl" "__Lib_SPIT6963C.mcl" "__Lib_EthEnc28j60.mcl" "__Lib_TFT.mcl" "__Lib_TouchPanel_TFT.mcl" "__Lib_EthEnc24j600.mcl" "__Lib_TouchPanel.mcl"
    0 1139 Available RAM: 2027 [bytes], Available ROM: 32768 [bytes]
    0 126 All files Preprocessed in 31 ms
    0 122 Compilation Started MyProject.c
    44 123 Compiled Successfully MyProject.c
    0 127 All files Compiled in 62 ms
    0 434 Demo Limit Demo Limit
    0 102 Finished (with errors): 21 mars 2015, 21:22:18 MyProject.mcppi

    J'ai trouvée qu'il faut la licence du logiciel :/ c'est vrai? Il y a pas d'autres solutions ??

  20. #80
    invitec4b4e47b

    Re : programmation avec mikroC for pic

    Bonsoir une autre fois,
    Un deuxième problème au niveau du programme suivant :
    Code:
    unsigned char RD_buffer[64] absolute 0x500;   // Buffers should be in USB RAM, please consult datasheet
    unsigned char WR_buffer[64] absolute 0x540;
    
    void interrupt(){
       USB_Interrupt_Proc();                   // USB servicing is done inside the interrupt
    }
    
    char receb;
    void main ()
    {
    
     TRISA=0b00000000;
     ADCON1=0b00001111;
     
     HID_Enable(&RD_buffer,&WR_buffer);
     while(1)
       {
           receb=hid_read ();
           if (receb!=0)
           {
               if(RD_buffer[0]='1')
                  PORTA.RA1=1;
    
               if(RD_buffer[0]='0')
                  PORTA.RA1=0;
           }
       }
    Voici les erreurs:
    0 1 mikroCPIC1618.exe -MSF -DBG -pP18F4550 -DL -O11111114 -fo8 -N"C:\Users\Public\Documents\Mi kroelektronika\mikroC PRO for PIC\Examples\Development Systems\EASYPIC6\Led Blinking\lcd8bit.mcppi" -SP"C:\Users\Public\Documents\M ikroelektronika\mikroC PRO for PIC\defs\" -SP"C:\Users\Public\Documents\M ikroelektronika\mikroC PRO for PIC\uses\P18\" -SP"C:\Users\Public\Documents\M ikroelektronika\mikroC PRO for PIC\Examples\Development Systems\EASYPIC6\Led Blinking\" -SP"C:\" "lcd8bit.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_MemManager.mcl" "__Lib_Conversions.mcl" "__Lib_Sprintf.mcl" "__Lib_PrintOut.mcl" "__Lib_Sprinti.mcl" "__Lib_Sprintl.mcl" "__Lib_Time.mcl" "__Lib_Trigonometry.mcl" "__Lib_Button.mcl" "__Lib_Keypad4x4.mcl" "__Lib_Manchester.mcl" "__Lib_OneWire.mcl" "__Lib_PS2.mcl" "__Lib_Sound.mcl" "__Lib_SoftI2C.mcl" "__Lib_SoftSPI.mcl" "__Lib_SoftUART.mcl" "__Lib_ADC_A_D.mcl" "__Lib_EEPROM_256.mcl" "__Lib_FLASH_w32_e64.mcl" "__Lib_I2C_b10.mcl" "__Lib_PWM_c21.mcl" "__Lib_SPI_b10c7.mcl" "__Lib_UART_c67.mcl" "__Lib_USB_genHID.mcl" "__Lib_PortExpander.mcl" "__Lib_CANSPI.mcl" "__Lib_CF.mcl" "__Lib_CFFat16.mcl" "__Lib_GlcdFonts.mcl" "__Lib_Glcd.mcl" "__Lib_LcdConsts.mcl" "__Lib_Lcd.mcl" "__Lib_Mmc.mcl" "__Lib_MmcFat16.mcl" "__Lib_RS485.mcl" "__Lib_S1D13700.mcl" "__Lib_T6963C.mcl" "__Lib_SPIGlcd.mcl" "__Lib_SPILcd.mcl" "__Lib_SPILcd8.mcl" "__Lib_SPIT6963C.mcl" "__Lib_EthEnc28j60.mcl" "__Lib_TFT.mcl" "__Lib_TouchPanel_TFT.mcl" "__Lib_EthEnc24j600.mcl" "__Lib_TouchPanel.mcl"
    0 1139 Available RAM: 2027 [bytes], Available ROM: 32768 [bytes]
    0 126 All files Preprocessed in 31 ms
    0 122 Compilation Started lcd8bit.c
    54 123 Compiled Successfully lcd8bit.c
    0 127 All files Compiled in 31 ms
    0 360 Unresolved extern 'USB_Init_Desc' __Lib_USB_genHID.c
    0 360 Unresolved extern 'USB_Init_Desc' __Lib_USB_genHID.c
    0 360 Unresolved extern 'USB_Init_Desc' __Lib_USB_genHID.c
    0 360 Unresolved extern 'USB_Init_Desc' __Lib_USB_genHID.c
    0 360 Unresolved extern 'USB_Init_Desc' __Lib_USB_genHID.c
    2429 438 Call signature does not match the function definition signature 'USB_Init_Desc' __Lib_USB_genHID.c
    0 360 Unresolved extern 'configDescriptor1' __Lib_USB_genHID.c
    0 360 Unresolved extern 'hid_rpt_desc' __Lib_USB_genHID.c
    0 360 Unresolved extern 'USB_Init_Desc' __Lib_USB_genHID.c
    2367 438 Call signature does not match the function definition signature 'USB_Init_Desc' __Lib_USB_genHID.c
    0 360 Unresolved extern 'device_dsc' __Lib_USB_genHID.c
    0 360 Unresolved extern 'USB_config_dsc_ptr' __Lib_USB_genHID.c
    0 360 Unresolved extern 'USB_string_dsc_ptr' __Lib_USB_genHID.c
    0 102 Finished (with errors): 22 mars 2015, 00:48:40 lcd8bit.mcppi

    Aidez_moi SVP!

  21. #81
    adipie

    Re : programmation avec mikroC for pic

    Bonjour,
    Avec ce message: 0 434 Demo Limit Demo Limit, tu es mal partie, ceci indique que tu utilises une version limitée de démonstration de MikroC.
    Cette version est limitée en taille mémoire, c'est bon pour faire clignoter une led mais pas pour utiliser l'Usb..
    0 360 Unresolved extern 'configDescriptor1' __Lib_USB_genHID.c: Ou est le fichier descriptor?
    Dernière modification par adipie ; 22/03/2015 à 06h24.

  22. #82
    adipie

    Re : programmation avec mikroC for pic

    Regarde si tu trouves un fichier USBdsc.C, qui est le fichier de description et qui doit se trouver dans le même projet.

    Ce que dit la doc. MikroC:

    Descriptor File

    Each project based on the USB library should include a descriptor source file which contains vendor id and name, product id and name, report length, and other relevant information. To create a descriptor file, use the integrated USB HID terminal of mikroC PRO for PIC (Tools › USB HID Terminal). The default name for descriptor file is USBdsc.c, but you may rename it.

  23. #83
    invitec4b4e47b

    Re : programmation avec mikroC for pic

    Bonjour, merci bien pour votre aide normalement, j'ai terminée tout le programme mais à cause du problème signalé ci dessus, j'arrive pas à compiler.
    A vos avis, c'est correcte?
    voici code:
    Code:
     // LCD pinout setting
     sbit LCD_RS at RE1_bit;
     sbit LCD_EN at RE2_bit;
     sbit LCD_D0 at RD0_bit;
     sbit LCD_D1 at RD1_bit;
     sbit LCD_D2 at RD2_bit;
     sbit LCD_D3 at RD3_bit;
     sbit LCD_D4 at RD4_bit;
     sbit LCD_D5 at RD5_bit;
     sbit LCD_D6 at RD6_bit;
     sbit LCD_D7 at RD7_bit;
     // Pin Direction;
     sbit LCD_RS_Direction at TRISE.B1;
     sbit LCD_EN_Direction at TRISE.B2;
     sbit LCD_D0_Direction at TRISD.B0;
     sbit LCD_D1_Direction at TRISD.B1;
     sbit LCD_D2_Direction at TRISD.B2;
     sbit LCD_D3_Direction at TRISD.B3;
     sbit LCD_D4_Direction at TRISD.B4;
     sbit LCD_D5_Direction at TRISD.B5;
     sbit LCD_D6_Direction at TRISD.B6;
     sbit LCD_D7_Direction at TRISD.B7;
     // End LCD module connections
     
     // Buffers should be in USB RAM, please consult datasheet
     unsigned char RD_buffer[64] absolute 0x500;
     unsigned char WR_buffer[64] absolute 0x540;
    
     // USB servicing is done inside the interrupt
     void interrupt()
     {
       USB_Interrupt_Proc();
     }
    
     char receb;
     char txt[17];
     
     void main ()
    {
    
     TRISC=0b00000000;
     ADCON1=0b00001111;
    
     HID_Enable(&RD_buffer,&WR_buffer);
     while(1)
       {
           receb=hid_read ();
           if (receb!=0)
           {
               if(RD_buffer[0]='1')
                  PORTC.RC5=1;
    
               if(RD_buffer[0]='0')
                  PORTC.RC5=0;
           }
       }
    
       ADCON1 = 0b00001111;
       Lcd_Init();
       /*lcd_out(1,1,"hello");
       lcd_out(2,1,"wold");*/
    
      
      // en binaire
      sprintf(txt,"PORTD= %08b",PORTD);
      Lcd_Out(2,1,txt);
      delay_ms(2000);
    
      Lcd_cmd(_Lcd_cursor_off) ;
      
    }

  24. #84
    paulfjujo

    Re : programmation avec mikroC for pic

    Citation Envoyé par mirachou Voir le message
    ...... Mais, j'ai d'autre problème concernant l'affichage de contenu des pins de pic..
    en effet le compilateur MikroC n'accecpte pas le format binaire %08b

    contre mesure :
    ( il suffira de remplacer UART1_Write ... par le Lcd_Chr ... qui va bien)

    Code:
    void Decompile_byte(unsigned char un)
    {
     unsigned char masque;
     masque = 0x80;
     while (masque > 0u )
     {
       if (un & masque)
           UART1_Write(49u);  //  '1'
        else
           UART1_Write(48u);  //  '0'
        masque =masque >>1;
      }
    }
    
    void Octet2Hex(unsigned char number)
    {
     char high,low;
     // high nibble
     high = ((number & 0xF0) >> 4) + 48; // + '0'
     if (high > '9') high =high + 7;
     // low  nibble
     low = (number & 0x0F) + 48;          // +'0' low nibble
     if (low > '9')                       // '9'= 57u
      low += 7;                         // > '9'
      UART1_Write(high);  UART1_Write(low); UART1_Write('h');
     }
    
    
      dH=33; // 0x21;
      dL=252; // 0xFC;
      sprintf(txt, " Representation de 33 et 252 En hexa et en Binaire\r\n");  UART1_Write_Text(txt);
      sprintf(txt, " En hexadecimal : \r\n");  UART1_Write_Text(txt);
      Octet2Hex(dH); UART1_Write(' '); Octet2Hex(dL) ; CRLF();
      sprintf(txt, " en Binaire : \r\n");UART1_Write_Text(txt);
      Decompile_byte(dH); UART1_Write(' ');  Decompile_byte(dL); CRLF();
      sprintf(txt, "33 decimal -> %02X   252 decimal -> %02X \r\n",(int) dH,(int)dL);
      UART1_Write_Text(txt);
      Delay_ms(3000);
    resultat sur terminal

    Representation de 33 et 252 En hexa et en Binaire
    En hexadecimal :
    21h FCh
    en Binaire :
    00100001 11111100
    33 decimal -> 21 252 decimal -> FC
    nota , pour afficher un octet en hexadecimal avec sprintf .. il faut que l'argument passé soit un entier !
    d'ou le cast (int) dH

  25. #85
    invitec4b4e47b

    Re : programmation avec mikroC for pic

    Bonsoir,
    Merci pour votre aide , mais il me semble un peu compliquer ce code là , j'ai pas bien compris, est ce que mon dernier code est incorrecte? Vous pouvez m'expliquer?

  26. #86
    paulfjujo

    Re : programmation avec mikroC for pic

    bonsoir,

    ceci ne devrait pas fonctionner !

    // en binaire
    sprintf(txt,"PORTD= %08b",PORTD);
    Lcd_Out(2,1,txt);
    donc utiliser cette fonction ,qui retourne un string

    Code:
    char * Bin2Ascii(unsigned char untel)
    {
     unsigned char masque=0x80;
     int indice=0;
     unsigned char Binary[9];
     while (masque >0)
     {
        Binary[indice]='0';
       if (untel & masque)  Binary[indice]='1';
        masque =masque>>1;
        indice++;
      }
      Binary[8]=0; // string terminator
      return (Binary);
    }

    ce qui doit donner (je ne l'ai testé qu'avec l'UART , car pas de LCD)

    Code:
    // en binaire
      Lcd_Out(2,1,Bin2Ascii(PORTD));

  27. #87
    invitec4b4e47b

    Re : programmation avec mikroC for pic

    Bonsoir,
    Désolé, mais j'ai pas compris cette fonction (les instructions c.a.d) est ce que vous pouvez m'expliquer (par des commentaires dans le code par exemple)
    de plus j'ai remplacée la fonction comme vous m'avez dit, mais ça ne marche pas :
    code:
    Code:
    // LCD pinout setting
     sbit LCD_RS at RE1_bit;
     sbit LCD_EN at RE2_bit;
     sbit LCD_D0 at RD0_bit;
     sbit LCD_D1 at RD1_bit;
     sbit LCD_D2 at RD2_bit;
     sbit LCD_D3 at RD3_bit;
     sbit LCD_D4 at RD4_bit;
     sbit LCD_D5 at RD5_bit;
     sbit LCD_D6 at RD6_bit;
     sbit LCD_D7 at RD7_bit;
     // Pin Direction;
     sbit LCD_RS_Direction at TRISE.B1;
     sbit LCD_EN_Direction at TRISE.B2;
     sbit LCD_D0_Direction at TRISD.B0;
     sbit LCD_D1_Direction at TRISD.B1;
     sbit LCD_D2_Direction at TRISD.B2;
     sbit LCD_D3_Direction at TRISD.B3;
     sbit LCD_D4_Direction at TRISD.B4;
     sbit LCD_D5_Direction at TRISD.B5;
     sbit LCD_D6_Direction at TRISD.B6;
     sbit LCD_D7_Direction at TRISD.B7;
     // End LCD module connections
    
     // Buffers should be in USB RAM, please consult datasheet
     unsigned char RD_buffer[64] absolute 0x500;
     unsigned char WR_buffer[64] absolute 0x540;
    
     // USB servicing is done inside the interrupt
     void interrupt()
     {
       USB_Interrupt_Proc();
     }
    
    char * Bin2Ascii(unsigned char untel) ;
    
     unsigned char masque=0x80;
     int indice=0;
     unsigned char Binary[9];
     while (masque > 0)
     {
        Binary[indice]='0';
       if (untel & masque)  Binary[indice]='1';
        masque = masque >> 1;
        indice++;
      }
      Binary[8]=0; // string terminator
      return (Binary);
    }
     char receb;
     char txt[17];
    
    
     void main ()
    {
    
     TRISC=0b00000000;
     ADCON1=0b00001111;
    
     HID_Enable(&RD_buffer,&WR_buffer);
     while(1)
       {
           receb=hid_read ();
           if (receb!=0)
           {
               if(RD_buffer[0]='1')
                  PORTC.RC5=1;
    
               if(RD_buffer[0]='0')
                  PORTC.RC5=0;
           }
       }
    
       ADCON1 = 0b00001111;
       Lcd_Init();
    
     // en binaire
      Lcd_Out(2,1,Bin2Ascii(PORTD));
      Lcd_cmd(_Lcd_cursor_off) ;
    
    }
    erreur:
    0 1 mikroCPIC1618.exe -MSF -DBG -pP18F4550 -DL -O11111114 -fo8 -N"C:\Users\Public\Documents\Mi kroelektronika\mikroC PRO for PIC\Examples\Development Systems\EASYPIC6\Led Blinking\afficheurpic.mcppi" -SP"C:\Users\Public\Documents\M ikroelektronika\mikroC PRO for PIC\defs\" -SP"C:\Users\Public\Documents\M ikroelektronika\mikroC PRO for PIC\uses\P18\" -SP"C:\Users\Public\Documents\M ikroelektronika\mikroC PRO for PIC\Examples\Development Systems\EASYPIC6\Led Blinking\" "afficheurpic.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_MemManager.mcl" "__Lib_Conversions.mcl" "__Lib_Sprintf.mcl" "__Lib_PrintOut.mcl" "__Lib_Sprinti.mcl" "__Lib_Sprintl.mcl" "__Lib_Time.mcl" "__Lib_Trigonometry.mcl" "__Lib_Button.mcl" "__Lib_Keypad4x4.mcl" "__Lib_Manchester.mcl" "__Lib_OneWire.mcl" "__Lib_PS2.mcl" "__Lib_Sound.mcl" "__Lib_SoftI2C.mcl" "__Lib_SoftSPI.mcl" "__Lib_SoftUART.mcl" "__Lib_ADC_A_D.mcl" "__Lib_EEPROM_256.mcl" "__Lib_FLASH_w32_e64.mcl" "__Lib_I2C_b10.mcl" "__Lib_PWM_c21.mcl" "__Lib_SPI_b10c7.mcl" "__Lib_UART_c67.mcl" "__Lib_USB_genHID.mcl" "__Lib_PortExpander.mcl" "__Lib_CANSPI.mcl" "__Lib_CF.mcl" "__Lib_CFFat16.mcl" "__Lib_GlcdFonts.mcl" "__Lib_Glcd.mcl" "__Lib_LcdConsts.mcl" "__Lib_Lcd.mcl" "__Lib_Mmc.mcl" "__Lib_MmcFat16.mcl" "__Lib_RS485.mcl" "__Lib_S1D13700.mcl" "__Lib_T6963C.mcl" "__Lib_SPIGlcd.mcl" "__Lib_SPILcd.mcl" "__Lib_SPILcd8.mcl" "__Lib_SPIT6963C.mcl" "__Lib_EthEnc28j60.mcl" "__Lib_TFT.mcl" "__Lib_TouchPanel_TFT.mcl" "__Lib_EthEnc24j600.mcl" "__Lib_TouchPanel.mcl"
    0 1139 Available RAM: 2027 [bytes], Available ROM: 32768 [bytes]
    0 126 All files Preprocessed in 31 ms
    0 122 Compilation Started afficheurpic.c
    40 371 Specifier needed afficheurpic.c
    40 396 Invalid declarator expected'(' or identifier afficheurpic.c
    40 300 Syntax Error: ')' expected, but '>' found afficheurpic.c
    43 371 Specifier needed afficheurpic.c
    43 396 Invalid declarator expected'(' or identifier afficheurpic.c
    43 300 Syntax Error: ')' expected, but '&' found afficheurpic.c
    44 402 ; expected, but '=' found afficheurpic.c
    44 393 'masque' Identifier redefined afficheurpic.c
    44 371 Specifier needed afficheurpic.c
    44 396 Invalid declarator expected'(' or identifier afficheurpic.c
    44 312 Internal error '' afficheurpic.c
    0 102 Finished (with errors): 24 mars 2015, 23:36:04 afficheurpic.mcppi


    qu'est ce que ça veut dire "Specifier needed" ?
    Merci d'avance.

  28. #88
    paulfjujo

    Re : programmation avec mikroC for pic

    bonjour,


    il ne faut pas travailler trop tard

    Explicage:
    au depart
    masque est initialisé à 0x80 soit en binaire 1000 0000 ou 128 en decimal ou MSB de l'octet
    un AND logique avec la valeur à convertir "unte"l et la valeur du" masqu"e , isole le bit masqué ..
    si il est à 1, on utilisera '1' sinon '0' pour remplir la table de destination Binary[indice]
    indice valant 0 pour le 1er bit significatif cadré à gauche ( de poids 128)..
    ensuite on divise par 2 la valeur du masque via un decalage à droite
    on a alors 0x40 dans le masque ou en binaire 0100 0000
    indice est incrementé
    on recommence l'operation de test AND pour isoler le bit de poids 64 ....
    et on range '1' ou '0' dans la table Binary
    ainsi de suite jusqu'à ce que masque=0
    on met un 0 dans le dernier indice de la table pour TERMINER le string.
    On dispose alors du resultat sous la forme d'un pointeur sur cette chaine de caractere

    Code:
    char * Bin2Ascii(unsigned char untel)   //  ";" remplacé par accolade ouvrante 
    {
     unsigned char masque=0x80; //1000 0000
     int indice=0;
     unsigned char Binary[9];
     while (masque > 0)
     {
        Binary[indice]='0';
       if (untel & masque)  Binary[indice]='1';  // si resultat du AND >0 on range '1' ( ou 0x49)
        masque = masque >> 1; // divise par 2
        indice++;
      }
      Binary[8]=0; // string terminator
      return (Binary);
    }
    Dernière modification par paulfjujo ; 25/03/2015 à 10h10.

  29. #89
    invitec4b4e47b

    Re : programmation avec mikroC for pic

    Bonsoir,
    Merci énormément pour votre aide j'ai bien compris la fonction de conversion, sauf que, la variable UNTEL j'ai pas compris de quoi elle s'agit?
    De plus comment je vais affecter cette fonction aux contenus de pins de pic? Je vois pas une relation :/

  30. #90
    paulfjujo

    Re : programmation avec mikroC for pic

    Le PORTx est passé en parametre dans la fonction !
    la variable "Untel" represente donc le contenu du PORT passé dans l'appel de la fonction

    exemple avec la fonction
    Decompile_byte(PORTC) ; où PORTC est passé en parametre

    Utiliser de preference la fonction Decompile_byte..

    car la fonction sprintf de mikroC a un comportement assez bizarre,
    avec "char * Bin2Asc(unsigned char untel)"
    par rapport à la meme fonction sprintf sous C18 MPLAB ,
    qui a l'avantage de supporter le format binaire ! (NON supporté par MikroC)

    Code:
      
    // exemple sur un nokia LCD en C18 MPLAB
    Nokia_Erase_Ligne(4);
    k=sprinf(LCDbuffer,"PorA %02X %08b",PORTA,PORTA);
    Nokia_PutRamString(LCDBuffer);
    exemple , sous MikroC , usage sur LCD pour l'affichae Hexadecimal et Binaire du PORTC
    Code:
    	Lcd_Out(1,1,"Etat  PORTC  ");
    	Octet2Hex(PORTC); 
    	Lcd_Out(1,2,"binaire: ");
    	Decompile_byte(PORTC) ;

    TEST avec UART (terminal PC)

    Code:
    // les variables dL et dH ,unsigned char, sont utilisée ici pour simuler l'etat d' un PORT du PIC
     // plus pratique pour imposer une valeur connue
     dL=0x57;
     dH=0x75;
    
     UART1_Write_CText("1ere methode: \r\n");
     sprintf(txt,"%02X donne ",(int)dL);
     UART1_Write_Text(txt);
     UART1_Write_Text(Bin2Asc(dL));
     CRLF();
    
     sprintf(txt,"%02X   =>  ",(int)dH);
     UART1_Write_Text(txt);
     UART1_Write_Text(Bin2Asc(dH));CRLF();
     CRLF();
    
     UART1_Write_CText("2em methode (simple!): \r\n");
     Octet2Hex(dL); UART1_Write(TAB);Decompile_byte(dL) ;  CRLF();
     Octet2Hex(dH); UART1_Write(TAB); Decompile_byte(dH); CRLF();
     CRLF();
     
     UART1_Write_CText("Etat des port A et PORTC: \r\n");
     Octet2Hex(PORTA); UART1_Write(TAB);Decompile_byte(PORTA) ;  CRLF();
     Octet2Hex(PORTC); UART1_Write(TAB); Decompile_byte(PORTC); CRLF();
     CRLF();
    qui donne cet affichage
    1ere methode:
    57 donne 01010111
    75 => 01110101

    2em methode (simple!):
    57h 01010111
    75h 01110101

    Etat des port A et PORTC:
    00h 00000000
    D8h 11011000

    les fonctions :

    Code:
    void Decompile_byte(unsigned char un)
    {
     unsigned char masque;
     masque = 0x80;
     while (masque > 0u )
     {
       if ((un & masque)>0)
           UART1_Write(49u);  //  '1'
          // Lcd_Chr_Cp(('1');
        else
           UART1_Write(48u);  //  '0'
         //  Lcd_Chr_Cp(('0');
        masque =masque >>1;
      }
    }
    
    
    
    
    void Octet2Hex(unsigned char number)
    {
     char high,low;
     // high nibble
     high = ((number & 0xF0) >> 4) + 48; // + '0'
     if (high > '9') high =high + 7;
     // low  nibble
     low = (number & 0x0F) + 48;          // +'0' low nibble
     if (low > '9')                       // '9'= 57u
      low += 7;                         // > '9'
      UART1_Write(high);  UART1_Write(low); UART1_Write('h');
    // avec LCD
     // Lcd_Chr_Cp(high) ;Lcd_Chr_Cp(low); Lcd_Chr_Cp('h');
     }
    
    
    char  * Bin2Asc(unsigned char untel)
    {
     unsigned char masque;
     unsigned char *p1;
     char Binaire[9];
     int indice=0;
     masque=0x80;
     //p1=Binaire;
     while (indice <8)
     {
      if ((untel & masque) >0) 
      Binaire[indice]='1';
      else
        Binaire[indice]='0';
        masque =masque>>1;
        indice++;
      }
      Binaire[8]=0; // string terminator
      return(Binaire);
    }

Page 3 sur 4 PremièrePremière 3 DernièreDernière

Discussions similaires

  1. programmation avec MIKROC d'un PIC16F877A
    Par invite85ca9d20 dans le forum Électronique
    Réponses: 6
    Dernier message: 24/03/2014, 21h58
  2. programmation en C avec MikroC
    Par invite736476bb dans le forum Électronique
    Réponses: 4
    Dernier message: 09/03/2012, 22h37
  3. programmation du pic 16F84A avec mikroc
    Par invite184126ed dans le forum Électronique
    Réponses: 3
    Dernier message: 14/03/2010, 16h05
  4. Programmation PIC 16F84A avec MIKROC:AIDE SVP
    Par invite9ef4aa12 dans le forum Électronique
    Réponses: 8
    Dernier message: 09/10/2009, 18h08
  5. programmation des PICs avec mikroc
    Par invite5207145e dans le forum Logiciel - Software - Open Source
    Réponses: 4
    Dernier message: 27/05/2009, 07h53
Dans la rubrique Tech de Futura, découvrez nos comparatifs produits sur l'informatique et les technologies : imprimantes laser couleur, casques audio, chaises gamer...