Programmation d'un PIC16F88 (avec Proteus et Mikropascal)
Répondre à la discussion
Affichage des résultats 1 à 2 sur 2

Programmation d'un PIC16F88 (avec Proteus et Mikropascal)



  1. #1
    ELO13

    Programmation d'un PIC16F88 (avec Proteus et Mikropascal)


    ------

    Bonjour ,
    je souhaiterais simuler le fonctionnement d'un vélo a assistance électrique sur Proteus , j'ai donc écrit un programme sur Mikropascal (qui fait varier la fréquence du moteur en fonction des interrupteur actionnés ), j'ai réussis a le compiler mais lorsque je l'implante dnas le PIC16F88 Proteus m'affiche des erreurs que je ne comprend pas, j'espère que vous pourez m'aider a comprendre pour cela j'ai donc joint mon programme en pascal et le schéma que j'ai établi sur Proteus avec les erreurs signalées . Merci d'avance pour vos réponses.

    Mon programme :

    programme;

    var
    iADC: word;
    iPwmFreqConf: word;
    iPwmDutyNew, iPwmDutyOld: byte;

    procedure Main_Init;
    begin
    CMCON := CMCON or $07;
    CCP1CON := CCP1CON or %00001100;
    OPTION_REG := 0;
    OPTION_REG.NOT_RBPU := 0;
    INTCON := $00;
    TRISA := $FF;
    TRISB := %11111110;
    PORTA := $00;
    PORTB := %11111110;
    ANSEL := $00;
    ANSEL.ANS0 := 1;
    OSCCON := 0;
    OSCCON.IRCF2 := 1;
    OSCCON.IRCF1 := 1;
    OSCCON.IRCF0 := 1;
    {
    ANSEL.ANS1 := 0;
    ANSEL.ANS2 := 0;
    ANSEL.ANS3 := 0;
    ANSEL.ANS4 := 0;
    ANSEL.ANS5 := 0;
    ANSEL.ANS6 := 0;
    }


    ADC_Init;
    delay_ms(100);


    PWM1_Set_Duty(50);
    delay_ms(100);
    iPwmFreqConf := 0;

    end;

    procedure PWM_GetFreqValue;
    begin

    iPwmFreqConf := 0;
    if PORTB.1 then iPwmFreqConf := 0;
    if PORTB.2 then iPwmFreqConf := iPwmFreqConf + 2;
    if PORTB.3 then iPwmFreqConf := iPwmFreqConf + 4;
    if PORTB.4 then iPwmFreqConf := iPwmFreqConf + 6;
    if PORTB.5 then iPwmFreqConf := iPwmFreqConf + 1;

    {

    if iFreqConf = 0 then
    iFreqVal := 10000
    else
    iFreqVal := iPwmFreqConfNew * 256;
    }

    if ((PORTB.1) and (iPwmFreqConf > 0) and (iPwmFreqConf <= 2)) then PWM1_Init(500) // 500 Hz
    else if ((PORT.1) and (iPwmFreqConf > 2) and (iPwmFreqConf <= 3)) then PWM1_Init(1000) // 1 kHz
    else if ((PORT.1) and (iPwmFreqConf > 3) and (iPwmFreqConf <= 4)) then PWM1_Init(2000) // 2 kHz
    else if ((PORT.1) and (iPwmFreqConf > 4) and (iPwmFreqConf <= 5)) then PWM1_Init(3000) // 3 kHz
    else if ((PORT.1) and (iPwmFreqConf > 5) and (iPwmFreqConf <= 6)) then PWM1_Init(4000) // 4 kHz
    else if ((PORT.1) and (iPwmFreqConf > 6) and (iPwmFreqConf <= 7)) then PWM1_Init(5000) // 5 kHz
    else PWM1_Init(1000); // 1000 Hz
    PWM1_Start;
    PWM1_Set_Duty(50);
    iPwmDutyOld := 50;
    delay_ms(100);

    end;

    procedure PWM_GetDutyValue;
    begin
    iADC := ADC_Get_Sample(0);
    if iADC > 0 then
    iPwmDutyNew := iADC shr 2

    else
    iPwmDutyNew := 1;
    if iPwmDutyNew <> iPwmDutyOld then
    begin
    PWM1_Set_Duty(iPwmDutyNew);
    iPwmDutyOld := iPwmDutyNew;
    end;
    end;

    begin
    Main_Init;
    PWM_GetFreqValue;
    while true do
    begin
    PWM_GetDutyValue;
    delay_ms(50);
    end;
    end.

    -----
    Images attachées Images attachées  

  2. #2
    ELO13

    Re : Programmation d'un PIC16F88 (avec Proteus et Mikropascal)

    ??????????

Discussions similaires

  1. Pic16f88 pwm avec un seul moteur cc par l298n
    Par invitef49b442b dans le forum Électronique
    Réponses: 2
    Dernier message: 26/04/2011, 13h04
  2. Projet Afficher Image ecran GLCD avec PIC16f88
    Par invitee8461bae dans le forum Électronique
    Réponses: 0
    Dernier message: 23/01/2011, 14h00
  3. Programmation d'un PIC en ICSP avec PICKIT1
    Par michel5002 dans le forum Électronique
    Réponses: 2
    Dernier message: 08/06/2008, 20h39
  4. programmation Pic16F88
    Par invitee17aeca5 dans le forum Électronique
    Réponses: 9
    Dernier message: 19/11/2006, 20h30
Découvrez nos comparatifs produits sur l'informatique et les technologies.