Hello, everyone. This is Kunal, and in today’s article, I’ll show you how simple and inexpensive it is to begin studying embedded systems. I’ll start by defining what an embedded system is, and then I’ll go over five key principles that you’ll need to know if you want to study embedded development. The first notion I’ll go over is GPIO, which stands for general purpose input output. In Embedded systems the second is going to be cut short. Timers will be the third option.
ADCs, or analog to digital converters, will be the fourth, and serial connections will be the fifth, but first and foremost, what is an embedded system? It has all of the features of a computer, including a processor unit, memory, and input and output ports, but it’s built into a mechanical or electrical system in embedded systems.
Also, because it isn’t designed to perform jobs as complicated as a PC, it typically has limited resources, which is a good thing because it drives the developer to make effective use of those resources before diving into embedded systems. it’s important to choose a platform as your starting platform so this would be a family of microcontrollers & embedded systems which has development boards available so you can get going really easily now there’s a lot of options out there.
If I were to start right now I would probably be confused as to which one to choose you can for example go for the texas instruments msp430 microchip PIC the Atmel AT mega family or many others but personally i’m going to recommend you the texas instruments msp 430 family because it has a great selection of microcontrollers in embedded system it has a great community online and also texas instruments offers a lot of documentation and great examples for each and every microcontroller and each and every peripheral that that microcontroller has and this includes code examples and also documentation now we’re going to talk about the five peripherals you need to understand if you want to start learning embedded systems.
I’m not going to go into formulas or implementations i’m just going to explain to you what each and every one of these peripherals does and how they can be useful if you want to build an application the first peripheral we are going to talk about is gpio or general purpose input output and these are basically ways for your microcontroller to connect to the outer world basically just like ports on your computer but they’re much simpler they can either output one of two values or read one of two of the same values and these values are logical zero which corresponds to zero volts and logical one which corresponds to usually about three to five volts which is basically the supply voltage of the microcontroller the way you would read or output the value to.
From a port which is basically just a physical pin is through registers and registers are really important if you want to understand peripherals because every time you’re going to work with peripherals you’re basically going to work with their registers all that registers are is location memories which are allocated to a specific peripheral so that you can actually interact with it set it up and take values from it so how would gpio be useful in a real life application well there’s a lot of things that you can use these for but some simple examples.
That could be to turn on or off a led or to signal to another system the fact that a process went through without an issue or that you have errors so you would basically output logical one if that process didn’t have an ever or logical zero if there were errors within the process the second concept we are going to talk about is going to be interrupts and these come in handy when you’re trying to run a block of code right after an event happens unlike polling which means you have to wait inside the loop for a condition to be met or for a flag to be set with interrupts All you have to do is write an interrupt handler as a function that is run immediately when an event occurs, saving you CPU cycles from waiting for an event to occur.
You only need to set the event that will cause the interrupt, and then you can execute other programs until the event occurs. I’ve assigned the next edge of that signal to be the source for the interrupt, as you can see in the diagram. So everytime that signal on that physical pin has a falling edge, the interrupt will be triggered again. It is assumed that you will send a signal to a physical pin on the microcontroller in this example, however this does not have to be a signal. It might be anything inside, such as from another peripheral; perhaps it has completed a procedure, made a mistake, or something similar.
It might be a variety of things. So you can use the timer to establish timeouts, count how long a process takes, or even make a real-time clock. You set a value in a register and the timer counts up to that value when you count up in embedded systems. When it hits that point, it resets to zero. Counting down, on the other hand, implies that your timer will count up to the figure you’ve just specified before starting to count back down to zero. Then everything will start all over again. When you count continuously, it doesn’t matter what value you choose; the timer will continue until it overflows, at which point it will reach its maximum value and then reset to zero.
The maximum value a timer may count up to, for example, is determined by the number of bits the timer is operating on. If we had a three-bit timer, for example, the most value it can count up to is seven, which is two to the power of three minus one. In addition to modulation modules, modern timers feature “ccp” (capture compare and pulse) modules. The capture mode allows us to time various processes by sending a signal to the module, which we can then use to calculate the time difference between two edges of that signal.
This is accomplished by recording a snapshot of the value that the timer has counted up to when one edge occurs and the other occurs, and then subtracting these two values and converting them to time since we know the frequency with which the timer counts up. In embedded systems the comparison mode is the polar opposite, allowing us to produce pulse width modulated signals or signals in which the duty factor is changed to achieve a set frequency and then we may pick how long the logical one or logical zero lasts inside one period.
This would be handy, for example, if we wanted to manage the speed at which a fan, which is essentially a DC motor, spins or how much light and led output a particular gadget generates. The comparison mode works by establishing a value in a register, and then the timer creating an edge on the output signal when the timer counts up to that value, and then the timer overflowing. The fourth peripheral is the adc, or analog to digital converter, which allows us to interact with analog inputs.
For example in embedded systems, if you want to measure a voltage, you can use this to convert it to a number that you can work with in software. This only works between two borders, as shown in the diagram, so you’d have a minimum and maximum voltage. This is because certain voltages are required as benchmarks, and they cannot be exceeded. You’ll also note that this peripheral only generates integer numbers in embedded systems. This implies that there will be a difference between the value you enter into the peripheral and the value you receive as an output.
This is known as the quantization error, and it will always be less than half of the quantization step. We have eight stages from zero to seven, as shown in the diagram, and these will be your outputs. The DAC, or digital to analog converter, is the polar opposite of the ADCP. This peripheral isn’t found on many microcontrollers, but it’s handy if you wish to produce a signal based on data stored in memory. Serial interfaces are the fifth and final peripheral we’ll discuss. These basically allow us to transmit data to other parts of our system or even to other systems. Today I’m going to talk about the three most basic ones, but there are actually quite a few out there.
The most basic one is wart, which stands for universal asynchronous receiver transmitter and only requires two data lines, though it does require setting up the baud rate. I2C, on the other hand, is slower than spi but only has two lines in total, one for data and the other for clock, and the method you actually pick which device you’re talking to is by an address, so you’ll transmit the address of the device you want to communicate to before sending data. This embedded systems, of course, means that each and every gadget on the bus will have its own address. Wow, this took a lot longer than I anticipated, but I hope it was useful to you. Just so you know, there’s a lot more going on beneath the hood that you’ll learn soon, but for now, if you understand or will comprehend these principles, you’ll be able to develop simple programs.
The reason I don’t suggest Arduino for beginners is that it has so many layers of software on top of the hardware that you’re not truly engaging with the hardware, which is what makes working with embedded systems so interesting. You’ll be able to utilize Arduino later on when you grasp all of these principles and just want to build a short and filthy prototype, but it’s not worth it right now. If you’d like to see more blogs like this one, please like this one and let me know in the comments area below what specific topic you’d want to see me write about next.
There will be links to purchase the development boards I specified in the description below, as well as some documentation to get you started in any case. Make sure to sign up for future updates. In the following blog, I’ll catch up with you. Goodbye, gentlemen.
For My Previous Article: https://www.tech-blogging.com/2022/04/the-future-of-ict-a-blog-post/
For more information visit my website: https:www.Tech-Blogging.com.