Oscillator and Timers 🔴 PIC Microcontroller Programming Tutorial #6 MPLAB in C

Поделиться
HTML-код
  • Опубликовано: 17 окт 2024

Комментарии • 39

  • @BinderTronics
    @BinderTronics  4 года назад

    Full playlist on the PIC microcontroller Programming ruclips.net/video/KSI6fzOPVz0/видео.html
    If there is anything you would like to see let me know.

    • @lorenrus
      @lorenrus 4 года назад

      HI. With INTCONbits.GIEH/GIEL = 1 you are ENABLING the global interrupt priority high and low. But when you explain isr you say that : with GIEH = 0 is for ENABLE and GIEH = 1 is for DISABLE. Why ?
      second answer: why in isr low priority are setting GIEH bit and not GIEL ? Thank you

    • @BinderTronics
      @BinderTronics  4 года назад +2

      ​@@lorenrus Don't know where I say GIEH = 1 is for DISABLE. Can you maybe give me a timestamp? As for the why I'm not using GIEL. I don't want the code to jump from the low to high isr while the low isr is doing its thing. GIEH = 0 serves as a disable all interrupts. Please refer to here: ruclips.net/video/MiPxVmj_nHI/видео.html

    • @lorenrus
      @lorenrus 4 года назад +1

      Binder Tronics Now i understand . Thank you:)

  • @L2.Lagrange
    @L2.Lagrange 2 года назад

    This series looks super helpful. I have a microcontrollers exam on PICs tomorrow

  • @lorenrus
    @lorenrus 4 года назад +1

    Hi :)
    if i want to enable PLL to generate F = 32 MHz, on your code i have to add only the line PLLEN = 1, correct ?
    Another question, if i have to calculate the Tcycle for timer = 4/Fosc * Prescaler * 255(with 8 bit), in your example you have to enable clock freq equal to 8 Mhz and Fosc is 8 Mhz, but if i enable PLL the clock freq will begin 32 Mhz and to calculate the value 4/Fosc have i to consider Fosc = 32 Mhz ?
    Thank you

    • @BinderTronics
      @BinderTronics  4 года назад +1

      You are correct in both cases. Watch the heat on the chip when using PLL. Also you need to change the _XTAL_FREQ define to 32000000

  • @orvillepike1370
    @orvillepike1370 4 года назад +1

    Great explanation of the code. Thanks.

  • @keydarkman
    @keydarkman 6 лет назад +2

    Muchas gracias por el video, esta bueno el tutorial, continua subiendo videos.

  • @stanholmes4293
    @stanholmes4293 4 года назад +1

    Again an excelent explination. Thanks

  • @lubdar
    @lubdar 2 года назад

    Great video series!! Do you have any suggestions on how to implement a pushbutton counter with debounce?

    • @BinderTronics
      @BinderTronics  2 года назад +1

      Thing is the code can very wildly depending on the situation.
      Here is the basic principal.
      digilent.com/reference/learn/microprocessor/tutorials/debouncing-via-software/start

    • @lubdar
      @lubdar 2 года назад

      @@BinderTronics thanks so much!!! I was able to understand some of this ha, and i messed around, struggled a bit, and then i figured something out!! Keep up the great content!

  • @usualguy7583
    @usualguy7583 3 года назад

    This might be a dumb question. Could you specify the resistance values used here? Thanks in advancec

    • @BinderTronics
      @BinderTronics  3 года назад

      330R for the LEDs (~20mA @ 5V). 1k for the switch.
      Some extra stuff.
      bindertronics.com/tutorials/pic-programming/hardware-connections
      Not a dumb question. I did not specify it. These are rule of thumb values. You will often see the values 1k 10k 100k 1M in digital design. LEDs generally want to have about 20mA passing though them.

  • @lukagacnik3093
    @lukagacnik3093 3 года назад

    Any particular reason for resetting GIEH at beginning of ISR and setting it back on at end of ti?

    • @BinderTronics
      @BinderTronics  3 года назад +1

      Execution insurance. Not necessary on this particular PIC microcontroller but some do not have ISR guards that prevent interrupts from trigging while running a ISR. Basically just forcing the ISR to finish running before it can process another interrupt(s).

    • @lukagacnik3093
      @lukagacnik3093 3 года назад

      @@BinderTronics But that would be in the case of single ISR? If you had multiple interrupt sources/routines, then I assume touching GIE in ISR wouldn't be wise.

    • @BinderTronics
      @BinderTronics  3 года назад +1

      Have you had a look at this ruclips.net/video/MiPxVmj_nHI/видео.html ?
      This is the case for multiple ISR routines. The flag is the trigger for a interrupt. If a interrupt flag is set before GIE is enable then the interrupt will trigger only after GIE is enabled.
      In shot. I prefer to manually disable interrupts when doing ISRs. When one vector can service more than one interrupt. At the end if the day the application and documentation determine the function of how you use GIE.

  • @danielwaters5523
    @danielwaters5523 4 года назад

    Nice video! The counter variable overflowed at 255 instead of being reset at 200, thats why it “worked”. Error was not really noticeable.

    • @BinderTronics
      @BinderTronics  4 года назад

      Witch counter are you referring too? I am assuming the blink_count. Cause the led will never blink if the counter overflows.

    • @JohnSmithZen
      @JohnSmithZen 2 года назад

      @@BinderTronics Yeah blink_count @15:00. uint8_t is one byte wide, so it flips back to zero when it = 255 and gets incremented.

    • @BinderTronics
      @BinderTronics  2 года назад +1

      @@JohnSmithZen Yeah I am aware of it by now. Just never bother to update the comment.

  • @pol.kraine7890
    @pol.kraine7890 4 года назад

    For me I am not getting an output, I followed most of the code with a PIC18F45K20 (64MHz). Except no prescalar, and every time the timer overflows it increments a two dimensional array variable to output. I have transistors that control the colors on PORTA and the base to activate it is on PORTCbits.RC0. Neither give an output even when hardcoded in before,/during infinite loop or ISR.

    • @BinderTronics
      @BinderTronics  4 года назад

      Best i can tell you is to step debug the code. ruclips.net/video/O4IpwgWhqLY/видео.html

  • @adrianlluveras1882
    @adrianlluveras1882 6 лет назад

    Nicely explained, really helpful

  • @hiteshkumar5204
    @hiteshkumar5204 4 года назад

    how to generate a PWM for some limited Time?

    • @BinderTronics
      @BinderTronics  4 года назад

      ruclips.net/video/Zjv3fNCcVsII/видео.html

  • @daniejcbs261
    @daniejcbs261 3 года назад +1

    Klink of jy Afrikaans kan praat :-). Great videos!

    • @BinderTronics
      @BinderTronics  3 года назад +1

      Dis omdat ek kan.

    • @daniejcbs261
      @daniejcbs261 3 года назад +1

      @@BinderTronics Wou sê daai aksent klink bekend. Ek het oldschool 8085 assembler geprogrameer. Leer nou eers om in C te programmeer . Jou videos maak dit sommer maklik, dankie. Ek fokus tans op die PIC 16f88

    • @BinderTronics
      @BinderTronics  3 года назад

      @@daniejcbs261 Dryg nou al a ruk om n reeks te doen op die PIC16F887A in assembler maar die voel soos tanne trek om van C af trug na assembler toe te gaan. Baie goed wat C net vir jou handle in die agtergrond.

    • @daniejcbs261
      @daniejcbs261 3 года назад

      @@BinderTronics Nee jis C maak die lewe baie makliker soos met die Arduino's. libraries is klaar daar al wat nodig is is om te include. Wens ek het dit lankal al geleer. In die ou dae met assembler, soos met die 8085 CPU, moes 'n mens meeste subroutines self sryf en daar was altyd 'n horde foute wat met die saamgekom het. Maar dit sal nice wees as jy daai reeks kan doen vir mense wat nog nie in assembler geprogrameer het nie.

    • @daniejcbs261
      @daniejcbs261 3 года назад

      @@BinderTronics Sal nice wees as jy die reeks kan doen. Lyk my PIC16F887 is nogal groot in die PIC gemeenskap, ek sien communica het darm van hulle so gaan solank vir my 'n paar aanskaf vir as jy besluit om die reeks te doen.

  • @afroslime7370
    @afroslime7370 4 года назад

    Is jy afrikaans