#3 -- Timer example code

Поділитися
Вставка
  • Опубліковано 24 гру 2024

КОМЕНТАРІ • 28

  • @zcxvasdfqwer1234
    @zcxvasdfqwer1234 8 років тому +12

    You're a great teacher Bruce. Live long and prosper.

  • @mohant143
    @mohant143 9 років тому +7

    Good Tip: Never put a print statement in your ISR. I learned it a hard way when I was trying to send data on Serial port in an ISR.

  • @douglasthomson2986
    @douglasthomson2986 6 років тому +1

    Hi Bruce. These are exactly what I've been looking for. Been trying to learn embedded software for a while, and badly needed these sort of lectures to listen to. Thanks.

    • @ece4760
      @ece4760  6 років тому +1

      Good to hear!

  • @Maryjanewotson
    @Maryjanewotson 2 роки тому

    Thanks, everything is clear but the " int time" variable to record time since boot. I didnt understand how it is initialized and how it calculates the time passed.

    • @ece4760
      @ece4760  2 роки тому +1

      in this code all timer variables are incremented by a hardware timer in an isr.

    • @Maryjanewotson
      @Maryjanewotson 2 роки тому

      @@ece4760 Thank you very much for the fast response. Now I understand. I guess a " time++;" instrucion in ISR is missed.

    • @ece4760
      @ece4760  2 роки тому +1

      @@Maryjanewotson The millisecond timer is hardware, not software. longer times increment software variables.

  • @ece4760
    @ece4760  11 років тому +1

    True, if any of the routines takes more than a mSec, but they are all quite short.

  • @ece4760
    @ece4760  11 років тому +1

    Link is now in the video comments.

  • @shamol5
    @shamol5 11 років тому

    Dear Bruce Land sir,
    In your lecture you mentioned that the code you have written in the blackboard is available online.I have searched but found none...it would be very nice if you mention the link...

  • @andraslibal
    @andraslibal 5 років тому

    Glad someone is teaching microcontrollers on a low level and it's on youtube.

  • @jasonbyme55
    @jasonbyme55 11 років тому

    I think the interrupt routine may have some clock ticks missed per this design. Because the ISR is waiting for the 3 timers to be set back to a non-zero value, its possible(likely) that the ISR will be entered, check that the value is zero, not do a decrement on the timer, and continue waiting until the next cycle of Main() to reset the timer(s).
    I think perhaps a better solution would be reset the timer once it hits zero in the ISR itself, and only use "Tmr_Done" flag in Main to be reset.

  • @lvanvan
    @lvanvan 2 роки тому

    Sorry for the stupid question in advance. Why task names you defined earlier are different from task names in main if statements? And tremendous thanks for the video avr lectures series. It is a rare treasure and as an engineer I fully appreciate the quality content and how it is presented and structured (sadly I am civil engineer design concrete structures and avr is just a hobby:)

    • @ece4760
      @ece4760  2 роки тому

      I am not sure what you are asking since this video is 10 years old. Can you give me a link the the exact code, or to time stamps in the video?

    • @lvanvan
      @lvanvan 2 роки тому

      @@ece4760 thank you for the replay i found what i was missing in the next video. thanks again

  • @H2CO3Szifon
    @H2CO3Szifon 8 років тому +2

    Instead of writing the "Yoda condition" (0 == x), you can just turn on the appropriate warning flag of the compiler (the AVR-GCC toolchain is being used in this course, right?) - for example, -Wall will do that among other (which is a good idea to use anyway). As to begin-end, students would benefit from increasing the font size too, instead. Picking some decent editor settings (including a big font size, a dark background and an easy-to-read font face) even has health implications.

  • @Steve_LSP
    @Steve_LSP 7 років тому

    Prof.Land , first thanks for sharing Us in a so fashinating way Your great knowledge. I have one question: since in task 3 we will check for a button press I suppose we will use an ISR(INT0_vect). (Maybe on INT0). Why didn't you have set in the initialization code before sei ( ); also:
    EIMSK |=(1

    • @ece4760
      @ece4760  7 років тому

      I do not use intrrrupts to read a keypad

    • @Steve_LSP
      @Steve_LSP 7 років тому

      Oh, sorry for the stupid question,Prof.Land. I am currently following lecture 4 and actually saw it just now in task 3. I was going to erase my comment but saw your answer. .. Luckily enough I made not the question in lecture... thanks alot. You inspire so many people. Regards

  • @oberoiddroidus2114
    @oberoiddroidus2114 4 роки тому

    17:41
    #define begin {
    #define end {
    FYI: accepted in IDE VSCode & PlatformIO.

  • @ece4760
    @ece4760  11 років тому +1

    google: Debugging C, the Mega, and the STK500
    and take the first link

    • @oberoiddroidus2114
      @oberoiddroidus2114 4 роки тому

      For the 328p (Arduino Uno) there is the Xplained mini board with integrated debugger. Around 13 euro. The ATAMEL ICE Basic debugger is 100 euro. Atmel should have made affordable debuggers available much earlier. Switching a led by tinkering with an IO register in a live setting is fun. Also stepping through the scheduler examples of this course would be a great demonstration how things actually work. I wait for my ordered debugger. I probably was fooled in the nineties by teachers with beards that said that programming in higher languages make debugging obsolete. Implicitly they said that C is not a genuine higher programming language. Interestingly this is stated in the RISC V course from Berkeley, "One of my personal goals in this class is for you to develop a rational hatred of C", Nicholas Weaver inst.eecs.berkeley.edu/~cs61c/sp19/lectures/lec01.pdf For a higher language on 8 bit's AVR, check out TinyGo, tinygo.org/

  • @grozaadrian4134
    @grozaadrian4134 4 роки тому

    very pascal-ish aproach with begin and end :D cool thing to do! would look funny tough if you wanna assign to an array some values :D

  • @MRKarthik
    @MRKarthik 10 років тому

    Dear Bruce land sir, you explain stuffs so well, thank you.

  • @Herdol90
    @Herdol90 11 років тому

    Very useful thank you.