PIC microcontrollers are one the popular and basic microcontrollers and are suitable for small projects and products. Based on importance and usability, I started this series of tutorials on ‘Learning PIC Microcontrollers Programming in C’. This series will cover from A-Z to learning both PIC microcontrollers and programming in an easy way. In this chapter, we’ll learn the basic knowledge to know before starting microcontrollers.
Disclaimer:
Handling electricity carries inherent risks. It’s essential to have the appropriate skills to manage it safely. Proceed at your own risk, as the author disclaims responsibility for any misuse, harm, or errors. All content on this website is unique and copyrighted; please avoid unauthorized copying. While most articles are open-source for your benefit, feel free to use the knowledge provided. If you find our resources helpful, consider purchasing available materials to support our work.
For assistance or guidance, leave a comment below; the author is committed to helping. Some articles may contain affiliate links that support the author with a commission at no additional cost to you. Thank you for your understanding and support.
Table of Contents
Introduction:
To start Learning PIC Microcontrollers Programming in C, we must know Microcontrollers first. Microcontrollers are controlling from small switches to submarines nowadays. In short, you may ask, where there are no microcontrollers in electronics? In almost every device, there is some kind of microcontroller of its brothers or sisters doing their duties.
A microcontroller or short MCU (microcontroller Unit) is a small computer that has different types of circuit/module blocks inside and is suitable for doing different types of tasks that an electronics system or circuit needs. We can do calculations, can control timings, can operate switches, can show something on display, and so on. What we can not do with microcontrollers is a matter of fact nowadays.
There are different types of microcontrollers from small to big in size power and feature. Among these, PIC microcontrollers are one of the most popular and basic microcontrollers which are suitable for a small range of products. So learning PIC microcontrollers will really help you to start with microcontrollers.
About microcontrollers:
Most of the new guys think that the microcontroller is the same as the microprocessor. That is not true in fact. The difference is, in a microprocessor, there is only one processor unit of one or multi-core, and all other peripherals like RAM, ROM, ADC, etc are externally connected. But in microcontrollers, all the necessary peripherals are all built-in.
the difference between a microprocessor and microcontrollers are as follows:
Microprocessor | Microcontroller |
---|---|
Designed for general-purpose computing | Designed for specific embedded applications |
Typically requires additional components to perform specific tasks | Includes CPU, memory, I/O interfaces, and other peripherals on a single chip |
Used in personal computers, servers, and other computing devices | Used in automotive, industrial, and consumer electronics applications |
Performs complex tasks such as running an operating system or executing complex programs | Performs simple tasks such as controlling a motor, reading data from a sensor, or managing a simple embedded system |
Higher power consumption and cost | Lower power consumption and cost |
Larger size and footprint | Smaller size and footprint |
I think you have a clear vision of a microprocessor and a microcontroller now. To start learning PIC microcontrollers, you still need to know some basic things.
More about microprocessors & more about microcontrollers.
Numbering:
Numbers are very common to us, but in microcontroller programming, you must know them in detail. The basic what we know as 1,2,3… are actually decimal numbers. You may know the binary of these numbers, but you also need to know the HEX or hexadecimal numbers to work with microcontrollers. Because, in microcontroller programming, we frequently use hexadecimal numbers rather than binary or decimal. Take a look at this chart:
Marking:
To mark what is what in programming, you need to use some kind of prefix symbols or characters. For decimal, there is nothing used. But for hex, 0x or $ signs are used. The most common is 0x. And in some cases, the suffix h is used to mark a Hex number. on the other hand, binary % or 0b is used. and if any number has no suffix or prefix, then it’s a decimal.
Bits & Bytes:
You must know this before starting any kind of microcontroller programming. Bits are the most fraction and bytes are a bunch of bits that you can keep in mind permanently. In basic, we normally use an 8-bit system. In this case, 8 bits make a byte. Check this image:
As there are 8 digits in a byte, the maximum possible arrangement or in short the maximum range of this 8bit is 28 or 256. So, you may count from 0 to 255 which is actually 256 different numbers as the range of 8bit MCUs.
Logic gates:
After numbers, logic gates or logical operations are the most important things in microcontroller programming. You may read about this in the classroom. The AND gates, NAND Gates, OR Gates, etc.
AND Gate:
The most basic gate is AND Gate. AND itself says the logic of it. Whatever the input pins, if all those are ANDs I mean all the inputs are the same then there is a positive result for this.
It shows a basic AND gate of 2 inputs, but in programming, there can be many of inputs. And only if all those are ANDs, then the condition will be executed. we will see this later on don’t worry.
OR Gate:
OR itself says its operation. That means, if any of the input is true, the output is true. Just like this image.
We’ll also see this later on while we do the programming, but these two are the most common and frequently used in microcontroller programming.
Registers:
Not Resistors, yes it’s Registers. Registeres are a kind of selective operational command to the microcontrollers. Say, you need to select a configuration of a specific task, then there are Registers to set the values which actually sets the microcontroller according to the specific task for you.
We’ll also learn and see these later while we are programming the microcontrollers.
Input / Outputs of the microcontroller:
In order to use any microcontroller, we need to give some inputs to it and take some outputs from it. And in microcontrollers, there are pins for different purposes but those are actually arranged under ports. Say, in a seaport, there can be multiple ships. Some ships are coming in some are going out. This is for one port, and there can be multiple ports like this. You can imagine the same scenario for microcontrollers. Under a port, there are several pins. And those pins can be used for input or output purposes or even all the ports can be used for input or output purposes.
These are all the basic knowledge you must know to start learning microcontrollers. And the rest of the partial theory, we can learn when it’s needed later on in different chapters when we will start the practical thing.
Up Next:
In the next chapter, we will see what are the necessary materials including the hardware and software we need, and how to get prepared to start the learning course. So do not forget to check that out soon. Stay connected.
Read more on:
- PICKit2 colon Simplified
- PICKit2 PCB Design Download
- Learning PIC Microcontrollers Programming in C: Chapter 2
For Professional Designs or Help:
2 Comments
kumaravel M · 19/09/2023 at 12:51 pm
Hai , very very use full to learn….thank you..
MKDas · 19/09/2023 at 8:26 pm
You are Welcome