Installation du compilateur dans l’environnement MPLAB

 

Installer le compilateur HI-TECH C18 sur le disque dur.

Pour le réinstaller :

Desintaller PICC8 HI-TECH

Editer la base de registre par menu démarrer -> executer ->  regedit

Rechercher et effacer l'entrée HKEY_LOCAL_MACHINE\SOFTWARE\HI-TECH

Réinstaller PICC18 .... C18 fonctionne 20 jours

Sous WIN2000 ou XP il n’est utile de redémarrer l’ordinateur

Exécuter MPLAB

Dans le menu PROJECT cliquer INSTALL LANGUAGE TOOLS

Dans la suite HI-TECH PICC18 inscrire le même chemin d’installation de PICC18.EXE pour les trois outils Compiler, Assembler, Linker.

 

Le compilateur C inclut la notion de projet qui permet entre autre de compiler ensemble et avec des paramètres communs des fichiers d’origines différentes (C, ASM)

MPLAB offre la possibilité de ne compiler qu’un seul fichier source (ASM ou C) (ALT-F10) et donc de ne pas construire systématiquement un projet.

 

La librairie PIC18.h (et librairies associées pic18fxx2.h)

Elle contient toutes les définitions des registres et bits des PIC18.

Exemples de définitions dans pic18fxx2.h :  @ retourne une adresse

static        near unsigned char  TRISC        @ 0xF94;

static              near unsigned char  TRISB        @ 0xF93;

static       near unsigned char  TRISA        @ 0xF92;

static       near unsigned char  LATC         @ 0xF8B;

static              near unsigned char  LATB         @ 0xF8A;

static       near unsigned char  LATA         @ 0xF89;

static volatile near unsigned char      PORTC        @ 0xF82;

static volatile near unsigned char      PORTB        @ 0xF81;

static volatile near unsigned char      PORTA        @ 0xF80;

#if defined(_18F442) || defined(_18F452)

static volatile near unsigned char      TRISE        @ 0xF96;

static       near unsigned char  TRISD        @ 0xF95;

static       near unsigned char  LATE         @ 0xF8D;

static       near unsigned char  LATD         @ 0xF8C;

static volatile near unsigned char      PORTE        @ 0xF84;

static volatile near unsigned char      PORTD        @ 0xF83;

#endif

//Latch B LATB

static              near bit     LB0           @ ((unsigned)&LATB*8)+0;

static              near bit     LB1          @ ((unsigned)&LATB*8)+1;

static              near bit     LB2          @ ((unsigned)&LATB*8)+2;

static              near bit     LB3          @ ((unsigned)&LATB*8)+3;

static              near bit     LB4          @ ((unsigned)&LATB*8)+4;

static              near bit     LB5          @ ((unsigned)&LATB*8)+5;

static              near bit     LB6          @ ((unsigned)&LATB*8)+6;

static              near bit     LB7          @ ((unsigned)&LATB*8)+7;

//Alternate definitions

static              near bit     LATB0        @ ((unsigned)&LATB*8)+0;

static              near bit     LATB1        @ ((unsigned)&LATB*8)+1;

static              near bit     LATB2        @ ((unsigned)&LATB*8)+2;

static              near bit     LATB3        @ ((unsigned)&LATB*8)+3;

static              near bit     LATB4        @ ((unsigned)&LATB*8)+4;

static              near bit     LATB5        @ ((unsigned)&LATB*8)+5;

static              near bit     LATB6        @ ((unsigned)&LATB*8)+6;

static              near bit     LATB7        @ ((unsigned)&LATB*8)+7;

 

 

 Genelaix - IUFM - Académie d'Aix-Marseille-août 2006