Partage
  • Partager sur Facebook
  • Partager sur Twitter

Chronométrer un temps

    16 janvier 2019 à 16:15:05

    Bonjour,

    Je suis a la recherche d'aide ou d'un code pour pouvoir mesurer un temps sur un atmega8. Comme la fonction millis() sur arduino, que je puisse savoir pendant combien de temps un PORT est resté a un.

    Merci d'avance de votre aide 

    • Partager sur Facebook
    • Partager sur Twitter
      21 janvier 2019 à 9:44:37

      S'il vous plait toujours besoin d'aide
      • Partager sur Facebook
      • Partager sur Twitter
        24 janvier 2019 à 11:22:02

        What steps will reproduce the problem? 1. If you include the TLC5490 library the delay() and millis() function is not working anymore as expected. What version of the product are you using? On what operating system? Arduino UI + ATMEGA8 Please provide any additional information below. In the file Tlc5940.h is the Timer1 configured like this: /** Enables the Timer1 Overflow interrupt, which will fire after an XLAT pulse */ #define set_XLAT_interrupt() TIFR |= _BV(TOV1); TIMSK = _BV(TOIE1) /** Disables any Timer1 interrupts */ #define clear_XLAT_interrupt() TIMSK = 0 #else /** Enables the Timer1 Overflow interrupt, which will fire after an XLAT pulse */ #define set_XLAT_interrupt() TIFR1 |= _BV(TOV1); TIMSK1 = _BV(TOIE1) /** Disables any Timer1 interrupts */ #define clear_XLAT_interrupt() TIMSK1 = 0 #endif In the ATMEGA8 is TIMSK for all times. By setting the Enable overflow bit for timer1 the '=' should be changed by '|=' to leave the other bits in this register as they are. Also by disabling timer1 should only the TOIE1 bit cleared and not the whole register. Change: #define set_XLAT_interrupt() TIFR |= _BV(TOV1); TIMSK = _BV(TOIE1) #define clear_XLAT_interrupt() TIMSK = 0 to: #define set_XLAT_interrupt() TIFR |= _BV(TOV1); TIMSK |= _BV(TOIE1) #define clear_XLAT_interrupt() TIMSK &= ~(_BV(TOIE1)) then the TOIE0 will stay like it is and the delay and millis will work as expected. Greetings Walter
        • Partager sur Facebook
        • Partager sur Twitter

        Chronométrer un temps

        × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
        × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
        • Editeur
        • Markdown