Programme DCF77
Répondre à la discussion
Affichage des résultats 1 à 3 sur 3

Programme DCF77



  1. #1
    invitee9e0f92f

    Programme DCF77


    ------

    Bonjour
    après de multiple arrachage de cheveux je me permet de poster
    Voila je doit décoder le Sginal DCF77 avec un ATMEGA32
    j'ai fait mon code mais sa ne donne rien ( ça fait la 3 eme méthode que j'essaie )
    voici mon code si quelqu'un pourrait éclairé ma lanterne
    Code:
    /*****************************************************
    This program was produced by the
    CodeWizardAVR V2.04.2a Evaluation
    Automatic Program Generator
    © Copyright 1998-2009 Pavel Haiduc, HP InfoTech s.r.l.
    http://www.hpinfotech.com
    
    Project : 
    Version : 
    Date    : 08/06/2009
    Author  : Freeware, for evaluation and non-commercial use only
    Company : 
    Comments: 
    
    
    Chip type               : ATmega32
    Program type            : Application
    AVR Core Clock frequency: 8,000000 MHz
    Memory model            : Small
    External RAM size       : 0
    Data Stack size         : 512
    *****************************************************/
    
    #include <mega32.h>
    
    // External Interrupt 0 service routine
    interrupt [EXT_INT0] void ext_int0_isr(void)
    {
    TCCR1B=0x04;     // Start du timer 
    
    }
    
    // External Interrupt 1 service routine
    interrupt [EXT_INT1] void ext_int1_isr(void)
    {
    TCCR1B=0x00;        // Arret du timer
    if ( TCNT1H == 0x18 )    // Si Temps ~= 800 ms (0.8*7813)
    {
    donne[i] = 1 ;        // c'est alors un 1 
    i++ ;                 // incrémentation de i 
    TCNT1H=0;             //remise a 0 des registre 
    TCNT1L=0;
    }
    else if ( TCNT1H == 0x1B )    // Si Temps ~= 900 ms (0.9*7813)
    {
    donne[i] = 0 ;        // c'est alors un 0 
    i++ ;                 // incrémentation de i 
    TCNT1H=0;             //remise a 0 des registre 
    TCNT1L=0;
    }
    else if ( TCNT1H > 0x1E)   // Si Temps ~= 1seconde (1/*7813)   = Début trame
    {
    i=0;                            // i = 0
    v=1;                            // v = 0 ( validation)
    TCNT1H=0;             //remise a 0 des registre 
    TCNT1L=0;
    }
    }
    
    // Timer1 overflow interrupt service routine
    interrupt [TIM1_OVF] void timer1_ovf_isr(void)
    {
    // Ici ce trouvera le programme de l'horloge en cas de non reception du signal DCF77
    
    }
    
    int i=0;
    int v=0;
    int donne[59];
    
    void main(void)
    {
    // Declare your local variables here
    
    // Input/Output Ports initialization
    // Port A initialization
    // Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In 
    // State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T 
    PORTA=0x00;
    DDRA=0x00;
    
    // Port B initialization
    // Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In 
    // State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T 
    PORTB=0x00;
    DDRB=0x00;
    
    // Port C initialization
    // Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In 
    // State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T 
    PORTC=0x00;
    DDRC=0xFF;
    
    // Port D initialization
    // Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In 
    // State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T 
    PORTD=0x00;
    DDRD=0x00;
    
    // Timer/Counter 0 initialization
    // Clock source: System Clock
    // Clock value: Timer 0 Stopped
    // Mode: Normal top=FFh
    // OC0 output: Disconnected
    TCCR0=0x00;
    TCNT0=0x00;
    OCR0=0x00;
    
    // Timer/Counter 1 initialization
    // Clock source: System Clock
    // Clock value: 7813 Hz
    // Mode: Normal top=FFFFh
    // OC1A output: Discon.
    // OC1B output: Discon.
    // Noise Canceler: Off
    // Input Capture on Falling Edge
    // Timer1 Overflow Interrupt: On
    // Input Capture Interrupt: Off
    // Compare A Match Interrupt: Off
    // Compare B Match Interrupt: Off
    TCCR1A=0x00;
    TCCR1B=0x05;
    TCNT1H=0x00;
    TCNT1L=0x00;
    ICR1H=0x00;
    ICR1L=0x00;
    OCR1AH=0x00;
    OCR1AL=0x00;
    OCR1BH=0x00;
    OCR1BL=0x00;
    
    // Timer/Counter 2 initialization
    // Clock source: System Clock
    // Clock value: Timer2 Stopped
    // Mode: Normal top=FFh
    // OC2 output: Disconnected
    ASSR=0x00;
    TCCR2=0x00;
    TCNT2=0x00;
    OCR2=0x00;
    
    // External Interrupt(s) initialization
    // INT0: On
    // INT0 Mode: Falling Edge
    // INT1: On
    // INT1 Mode: Rising Edge
    // INT2: Off
    GICR|=0xC0;
    MCUCR=0x0E;
    MCUCSR=0x00;
    GIFR=0xC0;
    
    // Timer(s)/Counter(s) Interrupt(s) initialization
    TIMSK=0x04;
    
    // Analog Comparator initialization
    // Analog Comparator: Off
    // Analog Comparator Input Capture by Timer/Counter 1: Off
    ACSR=0x80;
    SFIOR=0x00;
    
    // Global enable interrupts
    #asm("sei")
    
    while (1)
          { 
          if (v == 1 )                          //si validation = 1
          {
          PORTC=donne[21]+donne[22]*2+donne[23]*4+donne[24]*8+donne[25]*16+donne[26]*32+donne[27]*33 // Minute codé en BCD ( pour affichag sur LED ) 
          v=0; 
          }
    
          };
    }
    Merci
    Cordialement

    -----

  2. #2
    invitee9e0f92f

    Re : Programme DCF77

    Personne n'a de solution ?

  3. #3
    invitee9e0f92f

    Re : Programme DCF77

    Bonjour
    après divers mesure nous nous somme rendu compte que le TCNT1H ne s'incrémente pas alors que le TCNT1L s'incrémente !
    Nous avons aussi tester l'owerflow , il ne s'active pas non plus ! d'où peut venir le problème ?
    Merci cordialement

Discussions similaires

  1. dcf77
    Par invite09ccbdeb dans le forum Électronique
    Réponses: 1
    Dernier message: 13/03/2009, 11h03
  2. besoin d'aide pour un programme pour un DCF77
    Par invite09ccbdeb dans le forum Électronique
    Réponses: 0
    Dernier message: 17/02/2009, 09h24
  3. besoin d'aide pour un programme pour un DCF77
    Par invite09ccbdeb dans le forum Électronique
    Réponses: 0
    Dernier message: 10/02/2009, 07h49
  4. Dcf77
    Par katmai dans le forum Électronique
    Réponses: 8
    Dernier message: 15/05/2008, 20h42
  5. signal DCF77
    Par invite39a1e8a8 dans le forum Électronique
    Réponses: 3
    Dernier message: 20/11/2007, 20h15
Découvrez nos comparatifs produits sur l'informatique et les technologies.