David's Lab: Using PIC Interrupt to Drive a LED Display

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 พ.ย. 2024

ความคิดเห็น • 28

  • @aqib2000
    @aqib2000 9 ปีที่แล้ว

    Nicely done. I enjoy learning your method of constructing the C program. Do make more videos like this, it's very helpful and interesting to watch.
    Could you make some video involving PWM with the PIC in the near future? For example taking an analogue input voltage and converting it to a a PWM output. Thanks

  • @okhaledtamimi
    @okhaledtamimi 5 ปีที่แล้ว

    Dear Hoffman
    I would to thank you so much for the great TH-cam tutorials on PIC programming. I have been watching one of your tutorial [Using PIC Interrupt to drive LED display] and was so amazed by the way you handled the programming of 7 segment display. I would greatly appreciate it, if I get hold of the source code.I just need it to further my knowledge in PIC programming. could you please post it somewhere i.e. on your youtube channel.
    Thanks very much in advance
    Best Regards
    Tamimi

  • @Alex-ik6pu
    @Alex-ik6pu 3 ปีที่แล้ว +1

    Do you can make zoom in the screen?

  • @ljay0778
    @ljay0778 9 ปีที่แล้ว

    That was right on. I am experimenting with interrupts also for the 8051 using MCU-8051 IDE... I wondered what compiler you are using for the PIC ??? it is not MPLAB. Thank you.

    • @magidavid
      @magidavid  9 ปีที่แล้ว

      +ljay0778 I'm using MPLAB X and XC8 (Microchip's C compiler) in free mode.

  • @kaypope1581
    @kaypope1581 8 ปีที่แล้ว

    Thanks David for the clarification!

  • @kaypope1581
    @kaypope1581 8 ปีที่แล้ว

    Thank you for posting a great video which shows how timer/interrupt can be used for updating LED 7 segment display.
    I have a question... I don't see in your code something like TMR0ON or TMR0EN to enable Timer 0. In this particular PIC, if TMR0CS is set to use internal oscillator, is that automatically enable timer 0?

    • @magidavid
      @magidavid  8 ปีที่แล้ว +1

      You don't specifically turn TMR0 on or off in the PIC16F88x family, so I guess in that sense it's always on. However, TMR0 won't increment until it's supplied with a clock source. So no clock would equate to the timer being off. So, yes, it's already on and all you need to do is configure TMR0 to operate the way you want.
      This statement only applies to TMR0 in the PIC16F88x family and other timers and other families will have different configuration settings, check the datasheet for timer configuration specifics.

  • @digitART30
    @digitART30 3 ปีที่แล้ว

    Thank you David !

    • @magidavid
      @magidavid  3 ปีที่แล้ว

      You're welcome :)

  • @Inquire98
    @Inquire98 8 ปีที่แล้ว

    "Thank You", thank you very much. That was very good, and informative. How and where can I find basic and beginning tutorials on PIC assembly language programming? Let me know 😎😃😂😎

    • @magidavid
      @magidavid  8 ปีที่แล้ว +1

      You're welcome, glad the video was of help. There are a couple books you might want to check out "123 PIC Microcontroller projects for the Evil Genius" and "Programming and Customizing PICmicro Microcontrollers". You can get them both off Amazon.

    • @Inquire98
      @Inquire98 7 ปีที่แล้ว

      Again, "Thank You", thank you very much...

  • @Avriox
    @Avriox 7 ปีที่แล้ว

    Nice video quality! you should make more videos! :)

  • @okhaledtamimi
    @okhaledtamimi 5 ปีที่แล้ว

    Thanks very much for the tutorial......could you please post the source code......

  • @hamad_shaikh
    @hamad_shaikh 6 ปีที่แล้ว

    How to display ADC value on this seven segment displays

    • @AhmedAhmed-jw4jr
      @AhmedAhmed-jw4jr 6 ปีที่แล้ว

      I have problem i want contact you Mr Hoffman

  • @pinto6942
    @pinto6942 8 ปีที่แล้ว

    It seems very simple but when I tried to do mine the digits became all messed up. I tried to look in the web the reason since when I simulated in ISIS proteus with went all good and it's problably due to MRW and i tried to fix it but no success.
    I am using a PIC16F628A with 4 MHZ external clock source and interrupting the timer0 as you in order to do a timer for a 7seg 4 digit display in common anode config.
    Is it possible for u to approach this kind of error in MCU's ? thanks in advance. Btw the link for more data on my issue with the project .

    • @magidavid
      @magidavid  8 ปีที่แล้ว +1

      Hello Goncola,
      I looked over your code and have the following suggestions:
      1) When you enter the interrupt service routine use the command GIE = 0 and before you leave use the command GIE = 1. This turns off global interrupts and prevents a interrupt service call from happening while you are servicing the current interrupt. Not usually a problem when you only have 1 interrupt, but can cause issues when you have multiple interrupts.
      2) I think the "if else" statements in the interrupt service routine might be the source of the problem. Try removing the "if else" statements and just straight "if" and at the end of the service routine increment "control" and test for it being over 4. So something like this:
      GIE = 0; // Turn off global interrupts so we aren't interrupted during interrupt service routine.
      if(control==1)
      {
      ...code here...
      }
      if(control==2)
      {
      ...code here...
      }
      if(control==3)
      {
      ...code here...
      }
      if(control==4)
      {
      ...code here...
      }
      if(++control > 4) control = 1;
      GIE = 1; // Turn global interrupts back on.

    • @pinto6942
      @pinto6942 8 ปีที่แล้ว

      Hey David
      Thanks for taking time to see my code and advise me!
      I tried doing what u said but no success again, I really think it's because that RMW problem because my code works in simulation. I have to try using a "shadow register" when assigning the ports(I reed about it on Microchip website ahaha). Not sure how to do it yet tough, do you have any experience applying this method ? Thanks in advance

    • @magidavid
      @magidavid  8 ปีที่แล้ว +1

      Possibly, but I don't think so. You're not running the MCU super fast and from what I saw in the code you're not writing to a port register and then reading right back from it (which can cause issues).
      What I'll do in a situation like this is to comment out as much code as possible to get to bare bones operation. You could comment out all the code that updates the digits and just leave one operational, this can help track down wiring errors. And as each segment of code is confirmed as working correctly, slowly add the others back in.
      Another trick is to slow down the refresh rate of the display so you can actually see each digit turn on and off, this will help determine exactly what the circuit is really doing.

    • @pinto6942
      @pinto6942 8 ปีที่แล้ว

      Thanks for those advices I used max prescaler and watched the digits changing, only the first one is doing what it should the other have "garbage"...and have the same code cant really understand how's that possible... gonna try commenting step by step like u said

    • @pinto6942
      @pinto6942 8 ปีที่แล้ว

      I found the error, it was just a bad initialization because apperantly u cant declare and assign several variables in the same line.... jesus.... 1 week on this... thanks for the help David ur advises were gold on solving this problem. Looking forward for more videos on C for PIC, I am now using MikroC with IPE of MPLAB X to download the firmware trough PICKIT3 but I will try to follow ur videos anyway. All the best

  • @taofeekayodeji1714
    @taofeekayodeji1714 6 ปีที่แล้ว

    pls write the code in assembly

  • @nathaaladefadekemi3607
    @nathaaladefadekemi3607 6 ปีที่แล้ว

    can u pls write the code in assemble

  • @furo8931
    @furo8931 8 ปีที่แล้ว

    Hallo Mr.Hoffman , I'm useing MPLAB X XC8 C compiler . Im learning at the moment programing pic microcontrollers .
    I do it in my free time , I already learned a lot , but I got a lot of question to understand things about c programing, I alsow use google.com but its not the same like if sombody explain .so I would like to learn pic programing in c in a profesional level.I ask for a help from u , if u want to explain some stuff to me? i wolud be appreciate and fully thankfull.maby we can take a contact over Skype , or what ever u using. thx in advance. cincerly Jozsef Furo

    • @magidavid
      @magidavid  8 ปีที่แล้ว

      +Fu Ro Hello Jozsef, right now I've pretty busy but if you have specific questions feel free to send them to me and I'll answer what I can.