How to Blink an LED - Part 6 Microcontroller Basics (PIC10F200)

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

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

  • @tedbastwock3810
    @tedbastwock3810 7 หลายเดือนก่อน

    Your videos are a fantastic compliment to Sergey's written tutorials. Thank you and him so very much for doing this!!!

  • @W1RMD
    @W1RMD 2 ปีที่แล้ว

    You're very smart to be able to remember all of this. Thanks for this series. You're an excellent instructor who doesn't over complicate what I would consider something like this complicated. I can wait to get a controller and follow along!

    • @CircuitBread
      @CircuitBread  2 ปีที่แล้ว

      Thanks Ryan, though all the kudos go to Sergey who created the written tutorials these are based off of. We do try and keep these videos straightforward but if you have more complicated questions, I highly recommend checking out the written portions of these tutorials on the CircuitBread.com website - Sergey goes into great detail explaining every line and concept. It is extremely helpful! Good luck and have fun with your microcontroller adventure!

  • @OtherDalfite
    @OtherDalfite 3 ปีที่แล้ว +1

    This is such an amazing series. I'm binge watching it right now and wow, such a refresher from my electronics courses at K-state. Even more clear than my professors were. Thank you SO much!

    • @CircuitBread
      @CircuitBread  3 ปีที่แล้ว +1

      Awesome, thanks for your feedback, it's very motivational!

  • @CircuitBread
    @CircuitBread  3 ปีที่แล้ว +1

    Hi everyone! I hope that this video was helpful - as always, if you want a more detailed breakdown of each step and command, or just overall depth, go check out Sergey's tutorial that this is based on: www.circuitbread.com/tutorials/how-to-blink-an-led-part-6-microcontroller-basics-pic10f200 Have a great day!
    A reminder that MPASM is now becoming obsolete, but there is XC8 ported code on the site, as well as a process of how to port the code if you are interested: www.circuitbread.com/tutorials/mpasm-to-mplab-xc8-pic-assembler The structure, logic, and MOST commands will remain the same but there are some minor variations.

  • @chainhonglim1281
    @chainhonglim1281 4 ปีที่แล้ว

    This is really a great tutorial, came from arduino world, feels like we take things for granted. Thank you !

    • @CircuitBread
      @CircuitBread  4 ปีที่แล้ว +1

      Glad you enjoyed it! It is interesting getting in under the hood and seeing what happens. It also makes me appreciate the ease of Arduinos as well 😂

  • @Inquire98
    @Inquire98 4 ปีที่แล้ว +4

    "Thank GOD", and thank you very much for your support and time 😉 This is REALLY Really really good 😉

    • @CircuitBread
      @CircuitBread  4 ปีที่แล้ว +1

      That's great to hear! I'll let Sergey know - he loves it when his tutorials are able to help people.

    • @Inquire98
      @Inquire98 4 ปีที่แล้ว +1

      @@CircuitBread Is there a way to download this entire class 🙄

    • @CircuitBread
      @CircuitBread  4 ปีที่แล้ว +1

      Sorry, we hadn't even thought of doing that, so it's not setup for it. We did try and make it so that it's really easy to transition between the classes on circuitbread.com, though. Hopefully the interface there is convenient enough that downloading isn't necessary!

    • @CircuitBread
      @CircuitBread  4 ปีที่แล้ว +1

      Sorry, we hadn't even thought of doing that, so it's not setup for it. We did try and make it so that it's really easy to transition between the classes on circuitbread.com, though. Hopefully the interface there is convenient enough that downloading isn't necessary!

  • @ronen124
    @ronen124 4 ปีที่แล้ว

    7:50 exactly!
    you are realy a good teacher Sir

  • @PulishYuro
    @PulishYuro ปีที่แล้ว

    5:05 So basically a FOR loop but with a lot of extra steps?

    • @CircuitBread
      @CircuitBread  ปีที่แล้ว

      That's the joy of Assembly. Once you're familiar with the tips and tricks, you can optimize things quite aggressively from the MCU's point of view but it can seem very laborious from our point of view. However, even a FOR loop in C, when compiled, ends up using a very similar process to this in the machine code.

  • @sweekarkhadka4595
    @sweekarkhadka4595 4 ปีที่แล้ว +1

    Why is the line
    MOVLW ~(1

    • @CircuitBread
      @CircuitBread  4 ปีที่แล้ว +1

      Hey there! I recommend checking out Sergey's written tutorial - he discusses this difference between tutorials 5 and 6 explicitly: www.circuitbread.com/tutorials/how-to-blink-an-led-part-6-microcontroller-basics-pic10f200

  • @edinfific2576
    @edinfific2576 3 ปีที่แล้ว +1

    Seeing how complex the code looks just for blinking an LED, I am reminded why I stayed away from programming for such a long time.
    It takes time to process all this new information.
    Maybe it would help if you mentioned how many different commands exist in the assembly, and explain the absolute most basic ones.
    Our minds have hard time grasping something they don't see the whole picture of.

    • @CircuitBread
      @CircuitBread  3 ปีที่แล้ว +1

      I highly recommend going through the written tutorials that Sergey has put together, he goes into that level of detail. I'm not going to lie, though, this is still a fairly complicated topic. But if you take your time and go through both the video and the written tutorials, it should help a lot with your understanding and retention.

    • @edinfific2576
      @edinfific2576 3 ปีที่แล้ว +1

      @@CircuitBread Yes, thank you.
      I am aware that everything takes time and practice, programming even more so. I will check the written tutorials out.

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

      The PIC10 used here has only a tiny number of instructions: just over 30. The real complexity comes from interacting with the various registers, understanding what they do and how they interact, and so on. The datasheet is worth reading and is only 88 pages long (you don't need to read the whole thing at all), and most of that is about the various control registers. There's no substitute for getting your hands dirty though, and there's a lot you can do based on just this blink example, such as maybe replacing the busy loop in the delay with something based on the on-board timer (good for figuring out how to conserve power with the SLEEP instruction), or getting it to fade in and out with pulse width modulation.

  • @danielnaicker2142
    @danielnaicker2142 4 ปีที่แล้ว +1

    Best tutorial ever! Please do videos on PIC18F45K22

    • @CircuitBread
      @CircuitBread  4 ปีที่แล้ว +2

      Thanks Daniel! We've been talking about this and once we wrap-up this set of tutorials, we were going to move away from Assembly and focus on a higher-level language. I'm not sure what platform Sergey is planning on basing the tutorials on, but I'm doubtful it'll be the PIC18F45K22 specifically. Hopefully the concepts and tools will still apply, though!

  • @Shrivanurag
    @Shrivanurag 5 ปีที่แล้ว +3

    Great tutorial, Very very well explained! I personally am a beginner with PIC mcus and for some reason, really interested specially in the PIC10F* series. Have been doing my research for a month and your tutorials are the best I have encountered in the assembly language space.
    As the next parts of this series, can you please teach us the following three things?
    1). Using assembly language, how to take an input from a button or sensor and blink an LED accordingly? Would taking inputs from sensors cause a lot of code and hence making it inappropriate for PIC10F200 implementation, providing it has tiny memory?
    2). If it is possible to run a small C program instead of assembly, for blinking an LED OR taking input from button and then light the LED using PIC10F200? Again, given the small memory it has, will it be able to accommodate the C programs. I keep getting error when I try to upload, but may be its because I am simply a beginner. Hence trying to understand where the issue lies.
    3). How to solder wires to the small PIC10F200 MCUs (without using adapters or PCB boards) which are in SOT format and have the size of a rice grain?
    Thanks again ! Please keep the good work going.

    • @CircuitBread
      @CircuitBread  5 ปีที่แล้ว +3

      Thanks for the feedback, Shrivanurag! I'll pass this message on to Sergey to see if these are things he can implement in a future tutorial. Let me see if I can answer them on a higher-level really quick, though.
      1) Getting sensor data could take a lot of code, it depends on the sensor. The PIC doesn't have a built-in ADC or any hardware communication (like serial, I2C) so you'd either have to have some creative hardware solutions and bit bang the communication, which can be code intensive. That being said, simpler inputs like buttons, particularly if they're binary in input, should be relatively simple. For buttons, we shot the tutorial on how to read buttons earlier this week and should have that published... soon? Probably a week from Tuesday. I need to check with the video guys.
      2) Yes! We chose assembly not because that's the only thing the PIC10F200 uses but because we thought it would be a good opportunity to teach assembly. You should be able to easily program in C with the PIC10F200, even though it may (or may not!) be as code efficient. I'm not sure what is causing your issue but it theoretically should work. Sergey is already thinking of doing another series similar to this but in C instead of Assembly.
      3) Oooh... soldering is a different issue. I've found that SOT is not too hard on a PCB and Sergey can even solder QFN's without a microscope (the guy is a maniac) but the key is simply relaxing, breathing calmly, and moving your hands gently. Once you get one leg soldered down on a PCB, the rest are straightforward. But soldering that first leg can be a real pain. In the past I've used silicon glue to hold it down (takes a long time and doesn't work great), have someone provide a third hand to hold it down while doing the first one (very nice but requires a second person), trying to hold the part down with a very dense object I have on hand (my most common and effective method, honestly - I use my PE stamp, it's heavy and has a good small leg to put on things), or just realize it's going to take some patience. This, admittedly, is all on a PCB. If you're trying to air-wire it... good luck, I've found I don't have the patience for that. :-)
      Hopefully this helps!

    • @Shrivanurag
      @Shrivanurag 5 ปีที่แล้ว +1

      @@CircuitBread Thanks for the quick reply !
      Yeah I am awaiting the next tutorial. I just subscribed to your channel as well. I feel it has good content.
      You are right, I also realize that the PIC10F* are not for well apt for sensors. I guess the most they can do are buttons.
      Regarding the C error, yes, I am beginning to start working on PIC10Fs so more likely, it's something I am doing wrong. I am still trying, it's slow progress as I am a hobbyist in electronics. I will let you know in case I am able to load a C program in one of the pic10f*. But future Sergei's C tutorials should also be a great help, provided you guys make such detailed tutorials.
      You are right, it shall need a lot of patience to solder something that small. Soldering SOT chips are far for me currently as I am just starting with PIC DIPs, but when the time comes, I will try the techniques you have mentioned.

    • @CircuitBread
      @CircuitBread  5 ปีที่แล้ว +2

      Hi Shrivanurag - I just checked, I forgot that we have a PWM tutorial before the button tutorial. JB is working through putting the written tutorials up on CircuitBread.com so he should get those up before the video tutorial is posted.

    • @Shrivanurag
      @Shrivanurag 5 ปีที่แล้ว +2

      ​@@CircuitBread Thanks for letting me know! The PWM tutorial should be helpful too to me as I was unsure if PWM is possible with PIC10F* series due to compact functionalities it has. So, I am awaiting both the next two.
      By the way, mimicking the assembly language techniques you shared in your last couple of programming vidoes, I am able to load a small C program in the PIC10F200 which takes button press event as an input and drives an LED as the output. So, yes, like you already mentioned, I found that C is possible too. I was earlier in doubt about it due to 10F200's small memory size. Anyway, I am still sure your next button with assembly should bring some more learning for me in the subject.

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

      PIC10F32x would probably be better choices than the PIC10F200 for more sophisticated projects, as they're externally quite similar to the PIC10F200, but internally are closer to the midrange chips, without much of an increase in cost. They support interrupts for a start! You'll still end up bitbanging to do anything like I²C or SPI though.

  • @Ariskaservices
    @Ariskaservices 3 ปีที่แล้ว +1

    How can I make microcontroller of inverter air conditioner ???? Please reply

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

      Sorry, I don't quite understand the question. What are you trying to do? Figure out how to use a microcontroller to create an inverter air conditioner? Meaning, are you trying to create a variable speed motor that is controlled by a microcontroller?

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

      @@CircuitBread I am talking about inverter air conditioner microcontroller

    • @edinfific2576
      @edinfific2576 3 ปีที่แล้ว +1

      That is much more complex than what you could learn here in a simple tutorial, and if he were to solve it for you, he would have to charge a nice amount of money for the engineering time and effort.

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

    Hi, I appreciate you for putting out such an awesome tutorial. Can you please prepare a similar tutorial series on any 32 bit microcontroller (eg. stm or nxp) explaining about how to write the linker script, object file, elf file, makefile etc. Thanks.

    • @CircuitBread
      @CircuitBread  3 ปีที่แล้ว +1

      Hey Manabesh! Sergey and I have talked about that and we definitely plan on doing it, we're just not sure when yet...

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

      @@CircuitBread Thanks. Hoping it soon 👍.

  • @mikes3801
    @mikes3801 4 ปีที่แล้ว

    Awesome video. Is it possible to set a long delay with this chip? Like 6hours duration every 18hours?

    • @CircuitBread
      @CircuitBread  4 ปีที่แล้ว +2

      Hey Mike! You can't get that long of a delay, not with this chip. Sergey goes pretty in-depth with how the delay works, what the limitation is, and *why* it is in the written tutorial: www.circuitbread.com/tutorials/how-to-blink-an-led-part-6-microcontroller-basics-pic10f200 It's nearly at the end of the tutorial, to save you some time scrolling through.

  • @marcello4258
    @marcello4258 4 ปีที่แล้ว +1

    can't belive only 2K people watched this.. Are we all a little bit geek?

    • @CircuitBread
      @CircuitBread  4 ปีที่แล้ว

      This is so niche, I admit, when Sergey first came up with the idea, I wasn't expecting it to be even this popular. 😂 But I have really enjoyed these, I feel I've learned way more from these than I did in an entire semester of microprocessors in college.

    • @marcello4258
      @marcello4258 4 ปีที่แล้ว

      @@CircuitBread hehe nice! Well for me it is to dig deeper into understanding computer science at a very low level. You basically do not need to be limited to ARM or x86 architecture. Too bad WiFi modules are nearly as expensive as a pi zero w, otherwise, you could build a complete smart home that cheap AND individual.

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

    Does MPLAB come with a breadboard simulator to emulate the chip pins, along with the resistors, swicthes, voltage, and assembly code?

    • @CircuitBread
      @CircuitBread  3 ปีที่แล้ว +1

      MPLAB does not, and, while I've never used it myself, I've heard of other people using this as an emulator that also includes simple parts as well: PICSimLab

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

      @@CircuitBread Thank you.

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

    Great explanations.
    Is that Mr.C?

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

      Thanks! But... who's Mr. C?

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

      @@CircuitBread I thought you were Michael Cheich

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

      Ah, nope, but he looks a lot like a friend of mine who works as a developer.

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

    hi, in your tutorials do you explain how to make the pic working without the programmer, with a power supply ?

    • @CircuitBread
      @CircuitBread  3 ปีที่แล้ว +1

      There are some tutorials later-on that need to have the programmer disconnected to work for one reason or another but it's never explicitly mentioned. It's pretty straightforward, though, simply hook your power supply up to VDD and ground, and the already-programmed microcontroller should work as normal.

  • @jeffreydijkstra3391
    @jeffreydijkstra3391 4 ปีที่แล้ว +1

    Amazing tutorials!! Only thing is, the debugger needed to upload code to the microcontroller is like 70 dollars lol while the microcontroller is like 50 cents

    • @CircuitBread
      @CircuitBread  4 ปีที่แล้ว +2

      I know, it's annoying, isn't it! There are cheaper debuggers and programmers out there (and some DIY ones that are super cheap) but the trade-off seems to be more compatibility issues - not working with as many PICs or being a little more sketchy.

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

    i have the same software as you and currently i am studying how to code a pic18f4520 but the language taught to me is a lot different than the one you are teaching... i am confused why are they not the same? we have to put tris and port for i/o but i don't see you doing that why so?

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

      Hey Dutch! Did you learn to code with C versus Assembly? When I was in college we used the 8080 (I think?) to learn Assembly in my microprocessor class, but when we we used a PIC18F series microcontroller in my embedded systems class, we used C. And the TRIS/port commands are in there, they're just done differently.

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

      Thanks for responding. My teacher also told me that what you are teaching is more on assembly style. He said we are being taught c language cause it easier for us to understand. Even though it's the same c language there is a lot of difference in the style in terms of the way you initiallise and blink an led.

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

      Yep, you're exactly right, the style is very different between the two. To be frank, for ease of use and understanding the code itself, C is the way to go. But with Assembly, you get to understand the inner workings of the microcontroller better and, sometimes, you get more streamlined code in terms of size and speed. As they're each ideal for different situations, I wouldn't put one above the other but C is going to be much more commonly used.

    • @dutch759
      @dutch759 3 ปีที่แล้ว +1

      @@CircuitBread I understand now, I think when I will get into university then they will teach me the assembly method.

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

      Small PICs such as this don't really have I/O ports, just individual pins you control. They're not the same because they use slightly different versions of the PIC instruction set to save resources: the PIC10s have less memory and I/O (so no ports), and so support fewer instructions, and use shorter versions of them; the PIC10 has 12-bit instructions compared to the PIC18's 16-bit ones, and that's a huge jump: it means comparable programs take up 1/3 more space on the PIC18s vs the PIC10s.
      In embedded systems, a difference in cost of a cent can make a massive difference in cost. If PIC10s had exactly the same instruction set as the PIC18s, they'd cost almost as much as them, and that would be wasteful, so they cut out any unnecessary features, which reduces cost.

  • @venuarco
    @venuarco 4 ปีที่แล้ว

    Are we using the same breadboard design we used for lighting the led?

    • @CircuitBread
      @CircuitBread  4 ปีที่แล้ว

      Hi Venu - yes, the schematic doesn't change between the previous tutorial and this tutorial. I highly recommend checking out the written tutorials - Sergey has all the schematics and there is more depth in the explanations. We made the videos and written tutorials not to replace each other but to complement each other.

  • @imrichmorvay2227
    @imrichmorvay2227 2 ปีที่แล้ว

    so super just not working on mplab 6

  • @mortenlund1418
    @mortenlund1418 4 ปีที่แล้ว

    Thanks alot

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

    Sadly i can't get the light to blink and i have been going at this for several hours. It has probably to do with the fact i'm working with XC8. I think i changed everything and i can set the GPIO. But it doesn't clear/delay i can't figure out the problem. Does someone maybe know what i'm doing wrong.
    And is there a easy way to debug like print in python or console.writeline in c#. Anything to show me what is and isn't running.
    This is my code:
    PROCESSOR 10F200
    #include
    config WDTE=OFF
    config CP=OFF
    config MCLRE=OFF
    PSECT code

    INIT:
    MOVLW GPIO_GP1_POSITION
    TRIS GPIO
    LOOP:
    BSF GPIO, GPIO_GP1_POSITION
    CALL DELAY
    BCF GPIO, GPIO_GP1_POSITION
    CALL DELAY
    GOTO LOOP
    DELAY:
    MOVLW 255
    MOVWF 0x10
    MOVWF 0x11
    DELAY_LOOP:
    DECFSZ 0x10, F
    GOTO DELAY_LOOP
    DECFSZ 0x11, F
    GOTO DELAY_LOOP
    RETLW 0x0
    END

  • @pa4761
    @pa4761 4 ปีที่แล้ว

    Is this C++, or C or assembly code?

    • @CircuitBread
      @CircuitBread  4 ปีที่แล้ว

      Hi! All the examples in this series are assembly code as we're trying to teach what's going on at the lower levels. Sergey wants to do a C-based tutorial series at some point but honestly, we have no idea when that'll be.

  • @ryanford8500
    @ryanford8500 4 ปีที่แล้ว +2

    Where is Sergey

    • @CircuitBread
      @CircuitBread  4 ปีที่แล้ว +2

      Hi Ryan! Sergey lives in Ukraine and while I've been able to visit him (we went backpacking in the Carpathians, almost two years ago) we haven't had the opportunity to get him over here to Boise. We discussed flying him in to do these videos and he said that 1) he enjoys developing the tutorials but doesn't really want to be in the videos and 2) if he were in Boise, he'd rather go backpacking in the Sawtooths with us than shoot videos anyway. 😃

  • @andyweb7779
    @andyweb7779 4 ปีที่แล้ว

    Is there no 'Wait' function you can use? I use 'Wait' sometimes in in Excel.

    • @CircuitBread
      @CircuitBread  4 ปีที่แล้ว +1

      Hi Andy! Nope - a 'Wait' function is something you'd find at a much higher level programming language. If you're working with Arduino, you have a 'delay()' function you can use but the trade-off for simplicity is usually code size and code speed.

  • @lecrammped9036
    @lecrammped9036 3 หลายเดือนก่อน

    Tremendo

  • @julianmercado5498
    @julianmercado5498 5 ปีที่แล้ว +3

    ¡Usted necesita subtítulos en español!

    • @CircuitBread
      @CircuitBread  5 ปีที่แล้ว +4

      Tiene razón, hemos hablado de esto. Yo (Josh) hablo español pero no lo hablo (ni escribo) muy bien. No estoy cómodo con la idea de hacer traducciones y no tenemos el dinero para pagar alguien más (ahorita, por lo menos). ¡Pero! Contribuciones de la comunidad sería magnifico y ayudaría muchísimo.

  • @bmjesus2
    @bmjesus2 2 ปีที่แล้ว

    Many thanks for this wonderful series! I’ve been learning a lot, the material is very well structured and the videos are great also. However, I have some difficulty understanding this instruction: MOVLW ~(1

    • @Gimbliv
      @Gimbliv 2 ปีที่แล้ว

      (1

  • @poweredbygeeko
    @poweredbygeeko 8 หลายเดือนก่อน

    665 likes lol! Spooky 😮