Welcome to the first blog post on what I hope will be the road to learning a bit about how to work with PIC microcontrollers. Without a formal education on the subject, it can be daunting to take your electronics hobby to the level of embedded systems. There are many many books on the subject, some of which are very good, some of which are very poor, and many more than one person could ever read in a lifetime. I have "read" about 3 (more skimmed through as reference material than actually read) and I find them boring. Have you ever found yourself interested in something yet bored every time you try to read up on it? That's me when it comes to microcontrollers.
Why? Well because every book you pick up as a beginner starts with endless pages of the history of, the structure of, the architecture of, etc. When you finally get to the parts that could be useful, it's loaded with assumptions of things that you should know when you don't. Let me break it down for you. Some guy somewhere who has made a career in embedded systems decides to write a book for beginners. What they all seem to forget is that they've been doing this for 40 years, and you (the reader) have not. So all the little things they take for granted as being trivial are not so trivial to you and me. Where does that leave us? Well, here at this blog I guess, so read on young one, let's learn from the ground up together.
A Brief History
Is this guy serious? He just said he's bored with books because they all start off with "A Brief History". Okay, I did, but this isn't so much a history as it is a quick disclaimer about me, the author of this blog. I have been dabbling in electronics for about 8 years, about half of which has been in microcontrollers. Am I any good? No. I have built no grand inventions, am not rich from a grand career in embedded systems. I am a hobbyist. That being said, I have no formal schooling in programming, my methods may not be the "right way" or the "wrong way" for that matter, but they work. I do this for the personal education and satisfaction of saying "Hey, I did that". Take it or leave it buddy. I very much welcome corrections or alternatives if anyone has them, just leave a comment. We can all learn together.
I am learning at the same time you are, and we are learning by doing. By which I mean we will build simple projects to highlight certain features of the microcontrollers. We will tackle some things one at a time, and then put several things together to make something slightly more complex, but the point is, you're gonna need some hardware and software if you want to follow along.
My Expectations of You
The only things I expect from you are, a general understanding of electronics, and basic ones at that. We're not going to be building rockets to the moon. I expect that you know Ohm's law and how to select the proper current-limiting resistor for a LED. I expect that you know what a LED is. I expect that you know how to use a breadboard. I expect that you know how to use a computer. This blog will cover none of these things. If you don't know one or more of them, go learn those first, then come back. Lastly, I expect that if you don't like my blog, you leave. Don't sit and post comments about how my blog sucks, it does none of us any good. If you're so smart, go write your own blog instead of cutting down every one else's. We good? Okay, let's continue.
Requirements (Things you Need)
These items are minimal equipment to follow along:
MPLabX IDE - Free software from Microchip, Inc. An integrated Development Environment (more on this later).
MPLAB XC8 Compiler - Software from Microchip, Inc. A C language compiler (more on this later also). The link for the download is on the left side of the page (circa 2013) under XC8. This is a "costs money" software, but it has a free mode that is fully functional, with the exception that the code it generates isn't all that optimized, meaning it will take up more space on the microcontroller. For our purposes, it's not a big deal.
You will need a programmer. What does a programmer do? It takes the code (the software) that you write and puts it into the microcontroller. I use the Microchip Corporation PICKIT 2, but the current model is the PICKIT 3. Both PICKITs are available with a demo board, which I've never used but you might want. Have a look around the microchip website, see what you like. You can also probably nab one of these on the cheap at ebay.
If you don't have one, you'll need a breadboard. A quick search on amazon.com for "breadboard" will reveal many.
You'll need a PIC12F629 microcontroller, and later on a PIC16F628A. Both models are available on mouser.com and digikey.com. You should not buy microcontrollers on amazon, the prices are ridiculous.
Finally, download a copy each of the PICmicro Mid-Range MCU Family Reference Manual, the PIC12F629 Datasheet, and the PIC16F628A Datasheet.
Got all that? Ok good.
Conclusion
In the next post, we'll start learning about the microcontroller. While I did say earlier that a lot of texts go into depth about histories, and architectures, etc., and I said I thought that stuff was boring, we do need to learn a couple things about the chips themselves so that we can understand how to make them work. It's like saying, you don't need to know how a car is constructed in order to drive one, but you do need to know what the steering wheel does. We'll cover that stuff next.
Hi,
ReplyDeleteThanks for your efforts in trying to explain the concept of shadow RAM. Your lecture was not concluded. You promised to give one or two more lectures on it. How do I get these lectures to enable understand fully this concept?
Thanks.
Yusuf.
Hi! I appreciate deeply your efforts and I thank you for this lessons!
ReplyDelete