Untitled

Transcription

Untitled
1
COMPILATEUR CCS V2.XX .............................................................................................................................................. 3
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.7.1
1.7.2
2
COMPILATEUR CCS V3.XX .............................................................................................................................................. 4
2.1
2.2
3
PROCEDURE D'INSTALLATION ........................................................................................................................................... 5
PROCEDURE DE TRAVAIL. ................................................................................................................................................. 6
EXAMPLE PROGRAMME CCS......................................................................................................................................... 8
4.1
4.2
4.3
4.4
5
INSTALLATION VERSION 1.55. .......................................................................................................................................... 4
PAS DE COMPILATION ....................................................................................................................................................... 4
COMPILATEUR CCS V4 POUR WINDOWS XP. ............................................................................................................. 5
3.1
3.2
4
REPERTOIRES .................................................................................................................................................................. 3
PLUS DE RUN POSSIBLE EN MPLAB V5.11.00. ................................................................................................................ 3
ESSAI D'UNE NOUVELLE VERSION : PCMDLL.DLL IMPOSSIBLE A CHANGER........................................................................ 3
PLUS DE RECEPTION. ........................................................................................................................................................ 3
PLUS DE TRANSMITION RS232.......................................................................................................................................... 3
EXPECTING AN IDENTIFIER. .............................................................................................................................................. 3
IIC.................................................................................................................................................................................. 3
Plus de lecture sur PCF8574. .................................................................................................................................... 3
Force SW................................................................................................................................................................... 4
POW. ............................................................................................................................................................................. 8
MATRICE DE BIT. ............................................................................................................................................................ 8
EXEMPLE 1...................................................................................................................................................................... 8
MATRICE DE BIT : ........................................................................................................................................................... 8
PROBLEMES...................................................................................................................................................................... 10
5.1
5.2
BLOCAGE PIC ET INSTABILITE ........................................................................................................................................ 10
DIVERS .......................................................................................................................................................................... 10
1 Compilateur CCS V2.XX
1.1 Répertoires
Les fichier *.C sont dans le répertoire "c:\fichiers\CCS\ nomduprojet\ *.c"
1.2 Plus de RUN Possible en MPLAB V5.11.00.
Il n'est plus possible de faire un RUN et le DEBUG s'arrête sur HALT. Il faut arrêter MPLAB et recopier le
fichier mplab.ini et relancer. Il faut donc faire une sauvegarde de ce fichier quand cela fonctionne.
1.3 Essai d'une nouvelle version : PCMDLL.DLL impossible à changer.
When I want switch back and forth between different versions of PCM, I find that I cannot replace the
file PCMDLL.DLL, because Win98 still has it loaded. One solution is to restart Win98, but there is another way.
There is a program called DLL Master that allows you to unload a DLL. This program is available at
http://www.hotfiles.com. Search for DLL Master.Download the 32 bit version. You can install it
by using WinZip. When you run DLL Master, you can setup the selections so it only shows 16-bit DLL files.
Then select PCMDLL.DLL and press the button with lightning bolt on it.This will unload the DLL.
When you exit the program, it has a shareware nag screen. Just click on the X in the upper right corner.
1.4 Plus de reception.
Dans programme TW, plus de réception. En emetttant spontannément un string au début de PGM, la réception
est possible ⇒
delay_ms(100);
printf("\r\nMODBUS2");
En fait, le pbm se passait en RS485 ⇒ il faut mettre la PIN B1 à l'état bas au début du pgm ( sens de
communication 75176 ).
1.5 Plus de transmition RS232
Lors d'un essai d'une nouvelle plaquette, il n'y avait plus de transmission via RC7. Lorsque RC5 étatit utilisé,
alors transmition OK.
Le problème venait du compilateur (V2698). Un retour vers la version 2.694 a résolu le problème.
1.6 Expecting an identifier.
Une variable "byte message_brol" ou une definition "#define MESSAGE" existe.
Il ne faut pas déclarer une autres variable commencant avec message ⇒ "byte message"
1.7
IIC
1.7.1
Plus de lecture sur PCF8574.
Si utlisation de deux IN() à la suite alors plus de lecture sur une des deux ou les deux???
ReadInput=IN(IN_8574);
⇒ plus de lecture
ReadOutput=IN(CMD_8574);
• Option FAST,SLOW ⇒ pas de changement
Voici les essais effectués :
ReadInput=IN(IN_8574);
ReadOutput=IN(CMD_8574);
//
OUT(CMD_8574,0xff);
OUT(IN_8574,0xff);
ReadInput est mis à jour si un OUT (n'importe lequel) est présent
J'ai donc décidé de modifié la fonction IN() en rajoutant un write(0xff) avant de faire le STOP ⇒ OK celà
fonctionne et n'aura pas d'influence sur la lecture. En attendant mieux.
I2C_start();
I2C_write((adr<<1)|0x41);
datain=I2C_read();
// I2C_stop();
I2C_write((adr<<1)|0x41);
I2C_write(0xff);
I2C_stop();
return(datain);
1.7.2
Force SW
#use delay(clock=4000000)
#use rs232(baud=4800, xmit=PIN_C6, rcv=PIN_C7) ,FORCE_SW)
• ne fonctionne pas ⇒ caractère aléatoire.
• 2400 et 4800 baud testé
• reste bloqué.
Message du : 18/07/00
I have already contacted ccs about the problem. They are aware of, that the ccs compiler doesnt work with the
pic as a "hardware" master. They are working on the problem. Untill
then leave the noforce_sw out, and use the software i2c interface...
2 Compilateur CCS V3.XX
2.1 Installation version 1.55.
• Installer d'abord la version 1.148 : Net_Microchips\compiler\CcsV3155\PCWH3.148\PCWH3.148.exe
• Installer 'update 1.155 : \Net_Microchips\compiler\CcsV3155\PCW_V3155\PcWHUpd3155.exe
• Installer ICD : \Net_Microchips\compiler\CcsV3155\icds\icds2.exe
Tester sous W2K.
2.2 Pas de compilation
Dans une fenêtre DOS , lancer CCSC.EXE test.c ( simple programme de test ou Tu_noio.c en dessous de
tutorial ) ⇒ pas de compilation.
Les fichiers *.CRG n'ont pas étés copiés dans le répertoire lors de l'installation ⇒ simplement les copier.
PS : si on met une ancienne version *.REG ( CCS V2 ) , ca marche aussi.
3 Compilateur CCS V4 pour Windows XP.
3.1 Procédure d'installation
Lancer pcwhupd.exe
Lancer ideutilsupd.exe
Lancer KeyFileGen.exe
3.2 Procédure de travail.
Lancer PIC C Compiler ⇒ Deux façons d'ouvrir un projet :
- via Projet
- via RECENT FILES ( icône Rond à l'extrème gauche représentant un Folder )
- Choisir Open ⇒ Projet
⇒
Le projet est ouvert avec le fichier C ( et pas les autres fichier H )
Pour ouvir les autres fichiers facilement : Projet ⇒ Open All Files
Pour compiler : F9
Maintenant, il faut charger le PIC.
Pour charger : j'ai programmer F10 via Option ⇒ TOOLBAR
Il est possible de programmer ICD, de telle faon qu'une fois lancé , il programme automatiquement le PIC.
Ceci n'est pas le plus rapide, car ensuite, il faut encore retirer la fiche RJ45 pour faire tourner le PGM.
Ce que je fais : je lance ICD et je le laisse tourner (Shotcut "C:\Program Files\PICC\Icd.exe" )
Pour lancer ICD :
⇒
Ensuite, choisir Download Target ⇒
Une fois le répertoire choisi, il sufira de resélectionner l'HEX ( peut-être n'est ce plus nécessaire )
Ensuite ⇒ RUN Program
Version Firmware ICD :
4 Example programme CCS
4.1
POW.
float AEB(float A,float B)
{
return (signe=exp(B*log(A)));
}
4.2
Matrice de BIT.
4.3 Exemple 1
Voici un exemple de matrice de BIT, mais je crois que lea meilleur solution consiste à utiliser des BYTE et à
faire des manipulations sur ces variables.
• int x;
x=5;
bit_set(x,3)
• x.3 ⇒ bit 3 de x
4.4
Matrice de BIT :
#define BOOLEAN short
typedef union
{
BYTE asByte;
struct
{
BOOLEAN bit0;
BOOLEAN bit1;
BOOLEAN bit2;
BOOLEAN bit3;
BOOLEAN bit4;
BOOLEAN bit5;
BOOLEAN bit6;
BOOLEAN bit7;
} asBits;
} BITMAPPEDBYTE;
BITMAPPEDBYTE myArrayOfBits[numBits / 8];
void SetBitInArray(BYTE index)
{
BYTE byteNumber, bitNumber;
realIndex = index / 8;
bitNumber = index & 7;
switch (bitNumber)
{
case 0: bit_set(myArrayOfBits[byteNumber], 0); break;
...
case 7: bit_set(myArrayOfBits[byteNumber], 0); break;
}
}
... and a similar ClearBitInArray() based on bit_clear() and IsBitInArray() based on bit_test() which would return
TRUE or FALSE as a BOOLEAN.
You could also add a ToggleBitInArray() function if that would be useful in your application.
Then you'd have all the capabilities you'd have with a Boolean array object in an object-oriented
environment, and in the body of your code it would be transparent that bit array objects
don't actually exist natively (ie, you could pass array indexes just as if bit arrays existed).
Now, having said all that: PCM probably doesn't support arrays of bits because it would have to
generate all of the above code maybe even more code (depending on which operators it allowed
on bit arrays) internally to do it, because the PIC16 doesn't have an instruction to set, clear,
or test a variable bit, only a bit hardcoded into the instruction. (If you try to use a
bit_xxx() function in PCM that takes a variable bit number, you'll get a TON of instructions
generated for that one function!)
5 Problèmes
5.1 blocage PIC et instabilité
• il faut mettre les Fuses pour 20 Mhz et No LowVoltageProgramming:
#fuses HS,NOLVP.
• Le 07/12/06 :
Avec un PI16F88 et un Quartz de 4Mhz de marque CMAC CCSV3.249 et FUSE XT.
Le PIC était très instable dès que je met mon doigt sur le Quartz. ⇒ blocage ou ralentissement. J'ai donc
suspecté le Quartz et remplacé par un de 20Mhz et le FUSe en HS ⇒ plus de problème.
Lorsque je remet le Quartz de 4 Mhz, plus de pbm ⇒ en r&éalité, c'est le FUSE en mode XT qui apporte cette
instabilité.⇒ conclusion, toujours mettre le FUSE en mode HS même sur Quartz de 4Mhz
Lire le très bon article sur les oscillateur : osilator.pdf ou
http://ww1.microchip.com/downloads/en/DeviceDoc/osilator.pdf
5.2
divers
Unerasable PIC-Chips - If you are using a UV-erasable PIC microcontroller, and inadvertently program it with
the code-protection bits set, then you can never erase the chip
again (we've spent a few $$$ learning this one).
Fried -MCLR Line (this is probably a new one on everybody) - If you tie an electrolytic capacitor directly to the
reset pin (-MCLR) of a PIC UV-erasable microcontroller (as
is common practice in microcontroller reset circuits in order to guarantee a slow risetime on the pin), you can
damage the internal circuitry, such that, the chip will appear to erase
and appear to program correctly, but some of the code will not run correctly. We've found that code space above
the 2K boundary is most commonly affected, but there seems to
be no repeatability as to what specific memory areas are affected. The giveaway that the internal circuitry has
been damaged in these chips is twofold: (a) a large leakage current into
the -MCLR pin is measured (up to 100s of uA, instead of < 1 uA), and (b) the erasure time of the chips increases
dramatically, compared to chips without damage (we've spent a
few $$$ learning this one, too).
The Microchip datasheet DOES mention using a 100-1000 ohm series resistor in the -MCLR line to limit current
flowing from an external capacitor "in the event of MCLR pin
breakdown due to ESD or EOS" - so Microchip appears to be aware of the general susceptibility of this pin, but
their use of the term "in the event of" is some kind of doubletalk. In fact, tying a capacitor directly to the pin is
the source of the electical overstress.
Flukey PIC Execution (somehow related to previous item) - again, for UV-erasable chips, we have found that
sometimes "perfectly good" chips will appear to erase and
appear to program correctly, as indicated by the programmer, but some of the code will not run correctly. The
usual first guess, of course, is there is a bug in the code, but this
situation occurs with code that ran perfectly fine the time before. In this case, the chips are apparently not
completely erased, even though the programmer indicates as much, and
allows reprogramming and re-verifying of the chip. A longer erasure period usually solves the problem.

Documents pareils