General introduction to 8051, AVR, PIC, SPI, I2C, CAN

hey welcome everyone in this video I am going to describe some overview of microcontroller some basic concepts of microcontrollers so I will explain that what is microcontroller and some of its applications and the three major microcontroller families that are Intel’s 8:05 1 equals AVR microchip pic at last I will explain that how microcontroller communicate with the peripheral devices the devices like your sensors your a 2 D converters your D to D to a converters but any other similar device that you want to interface with your microcontroller so in this part I will cover the UART and use our spi I to see and kin protocols so let’s just begin with buddies microcontroller a microcontroller is a small computer built on a single integrated circuit or chip and it contains the core processor the memory and the input/output peripherals and memory in the microcontroller is divided into two parts one is your RAM which is used during the execution of the code and other one is the flash memory in which your program code resides so whenever you burn your program code into your microcontroller it will go directly into the flash memory of your microcontroller I guess most of you know what is the basic difference between a microprocessor and a microcontroller the microprocessor come the has no on-chip memory and input/output peripherals so microcontrollers are used everywhere where you want a task to be automated they are used in your home appliances like your washing machines your microwave ovens your air conditioners your mobile phones and they are also used in Automation industrial automation artificial intelligence robotics and some years ago they are not used for high voltage applications like home or industrial automation where we have to control the high voltages like 220 volt or above 220 volt because our generic relays or the electromechanical relays have a disadvantage of producing back EMF net can damage our microcontroller but as a time passed the solid-state relays come into the picture the solid-state relays means the semiconductor relays in which MOSFETs and Fe DS are used for controlling the switching operation and the solid-state relays provides the optical isolation that optically isolates the high voltage and microcontroller so they are preferred over the electromechanical relays so there are some other applications of microcontrollers they are also used in satellites missiles radars they are playing a very important role in the technological development so here is a general environment of microcontroller here some input devices are shown and some output devices are shown like a keypad switches push buttons and it is controlling the motors LEDs some displays here is one example of using the microcontroller these are it is a LED dot matrix LED dot matrix are very popular means of displaying information as it allows both static and animated text and images here in LED dot matrix multiple LEDs are wired together in rows and column structure in actual the dot matrix does not know that how to display a character like your LCD LCD has a on chip microcontroller to understand the ASCII value ASCII value that you are giving to your LCD through microcontroller so LCD understands the ASCII value and display the character but in LED dot matrix there is no such microcontroller that can receive directly the ASCII value and display the character so in the LED dot-matrix we control the

LEDs and make the process so faster by using the microcontrollers that it looks like that the characters are moving I will explain the functioning of LED dot matrix in more detail in some another video here is a second example of using the microcontroller in your home appliances like refrigerator here microcontroller is used for controlling the different operations of refrigerator it is getting the temperature from some temperature sensor I see and by reading the temperature it is controlling your compressor now it is taking decision that whether to drive whether to run the compressor or not depending among the temperature inside inside temperature of the refrigerator it is also used to generate some voices or alarms if the temperature gets high like in case you have opened the door of a refrigerator for a long time or it can display the internal temperature of the refrigerator on some LCD device further you can connect it to some GSM modem device where it can send some SMS alerts to the user so it can do multiple tasks here is another example of using microcontrollers in your home automation there are some sensors interface to the microcontroller like LPG gas sensor temperature sensor the infrared sensors the light sensors video or image sensor and by reading this data the microcontroller will process the input data and control some output operations like sending SMS alerts to the user through GSM or controlling the lights and fans by using the relays or generating some alarms or displaying the displaying some values on the LCD display so here is our first microcontroller that is Intel’s 8:05 one that is based on a Howard architecture and RISC instruction set the a 0 Phi 1 chips are used in a wide variety of control systems telecom applications robotics as well in the automotive industry and it is one of the most popular general-purpose microcontroller that we use today and here is some basic information about the h0y 1 microcontroller and as it has 8 bit ALU and 16 bit address verse and 8 bit data bus 4 kilobytes of on-chip program memory which is 8 kilobytes in 8:05 to 128 bytes of on chip ram 32 input/output lines and full duplex UART and 6 interrupt sources the 8:05 on microcontroller is produced by many manufacturers some of them are at mal Intel Philips which is an XP and sharp Texas Instruments maximum Dallas here is a general architecture of T is 0 Phi 1 microcontroller these are the two most widely used microcontrollers of the ages of AI one family or one is the 88 9 c5 – that is form Akmal and another is p89 v5 1 r d2 which is from an XP philippson one special feature of p8 9 v 5 1 r d2 is x2 mod operation normally all the micro controllers in 8:05 in microcontrollers the clock rate is 12 clocks per machine cycle but by selecting the X 2 mode we can reduce it to 6 clocks per machine cycle so although the 8:05 one microcontrollers are very popular and they are good but they are more advanced microcontrollers available from the Atwell Atmel AVR AVR is a risk microcontroller based on modified however architecture so it was developed by Atmel in 1996 and it is better than

the AIDS of a 5-1 microcontroller in many aspects firstly in the 8:05 and microcontroller you cannot set your input/output pins easily in 8:05 on microcontroller if you are if you are giving a high logic to any pin you are simply declaring it as input pin or if we are giving a logic 0 to any pin you are declaring a it has output pin but in the AVR microcontrollers there there is a some special resistors to control the direction of the input/output pins and for giving the output value and reading the input value there are two different resistors so it makes the operation easy and also most instructions in the AVR microcontrollers take just one or two clock cycles which makes the AVR microcontrollers fast among the present 8-bit microcontrollers has some features of the AVR microcontrollers that it has a internal power on reset circuit internal calibrated oscillators on chip Ram flash EEPROM or non-volatile memory and some resistors on chip a to D converter analog comparator compatible with the SPI you sought and I Square protocol scan protocol and and it also supports TJ tag it is the architecture of the Atmel AVR the AVR has an orthogonal instruction set orthogonal means that all the instructions can use all the addressing modes we can apply any operation on any resistor unit using any addressing mode these are the families of AVR tiny AVR mega AVR and X mega AVR so here is the third major microcontroller that is pic microcontroller pic stands for the peripheral interface controllers or programmable interface controllers these are produced by the microchip technology these are also based on the power architecture and RISC instruction set and it also sports the orthogonal instruction set like at once AVR the pic microcontroller also has separate resistors for controlling the direction of input/output ports and giving the values at the output or reading the input values here are some important features of Dybbuk microcontrollers which are very similar to the atmosphere we are that is architecture of the microcontroller it is a little bit different from the other microcontrollers that are available today here instead of the accumulator resistor the W resistor is used the difference between the accumulator and DW resistor is its position it is positioned in a different way than the accumulator in other microcontrollers accumulator is placed at the output of the ALU so the result of ALU is always stored into into the accumulator however in pic microcontrollers we can store the result either in W resistor or in any other resistor of the data memory also the arrangement of stack memories different in pic microcontrollers here stack is not a part of data memory or your RAM stack memory has its own independent space therefore it has some finite size and this finite size of stack memory depends upon the different weak models that are available one

another different feature of pic is that they do not have the stack pointer resistor as it is commonly available in most microcontrollers pic microcontrollers and AVR microcontrollers use the pipelining technique for the execution of instructions in pipelining technique the next instruction is fetched during the current instruction is being executed so it makes the operation faster these are some families of the pic microcontrollers they are divided into three categories the low end microcontrollers medium and microcontrollers and the high end microcontrollers they can also be classified as in thus in the form of series like pic 10 series pick 12 pic 16 18 advanced pic 18 pic 24 pic 32 these are the 24 and 32 cities available from the microchip technology the pic32 is a very very advanced microcontroller it has a five stage pipeline process and the operating frequency is 40 megahertz to 200 megahertz and sports cryptography audio and graphic interface in some applications they are used with the Artaud’s real-time operating systems so it is a second part of this presentation and in this I will explain that how the microcontroller communicate with peripherals so as you can as you can see in this picture here microcontroller 88 9 C 5 2 is interfaced with the LCD which is 20 cross 4 it means it has 4 lines and it can display 20 characters in each line here Dell city is interfaced with microcontroller by connecting the 8 data lines and three control lines which is resistor select read and write and enable pin so 80s a 2 D converters and D to a converters are also interfaced with the microcontroller in this way like by connecting the all the data pins with the microcontroller but in but in today’s market the a 2 DS are available like 32-bit ADCs and 48 bit ADC s so we cannot connect these addresses with the microcontroller by connecting all the data pins that’s why some protocols are introduced to reduce the pin count so our first microcontrollers 8:05 one microcontrollers has one serial communication channel that is you art Universal Austin con receiver and transmitter as communication is not synchronous the receiver and transmitter operate at same speed or same baud rate and the data byte is framed between these start and stop bits to indicate the start of data byte and end of data byte and you cannot connect more than two channels on on the UART bus if we want a secure transmission and the another is the juice art which over it means that Universal synchronous or synchronous receiver transmitter it supports T both synchronous and asynchronous operation here is another protocol spi serial peripheral interface used for interfacing the peripheral devices as I described the ADC STS or any other sensors in SPI protocol the communication can be either between two devices or it can be between multiple devices like one is master and others are slave generally microcontroller act as a master it uses four vyas for its communication and has a separate clock and data lines along with the Select line with the help of select line the microcontroller chooses that device to which it wants to communicate prior to the invention of SPI n is kisi

protocols the engineers were generally using rs-232 communication but in rs-232 the TXN are expens are not synchronized with the same clock however they use start and stop bits and same baud rate on both sides to achieve some synchronization but our modern protocols like spi and is plc use separate data lines and clock signals to achieve better synchronization so the SPI protocol has four pins SCL Capon is used for clock and clock is always controlled by the master and the mo SI means the master out slave in M ISO means the master in slave out and SS for selecting the slave to which the microcontroller wants to communicate so in the SPI protocol and this is the some disadvantage of this protocol that if you have number of slaves you have to increase the Select lines so it will also increase the pin count this disadvantage of the SPI protocol is overcome in the icrc protocol so I scuzzy was originally developed by the flips semiconductor in contrast to the SPI IC RC requires only two wires or two lines for its operation and it also sports the multi-master mode it means that there can be multiple masters on the same bus in IC RC protocol the devices are identified as either master or slave or most of the times Master is microcontroller and slave are the other devices like your ADC and DAC s the master is a device which starts the data transfer and generates clock signals for the transfer we can connect snap several masters at it sports team ultimate or mod so I square C protocol uses the two lines for its operation that is sta serial data bin and SCLC real clock pin and these both pins are opened drain lines you have to connect a pull-up resistance for using the ICRC protocol here is the frame format of ICRC protocol when master is writing to slave or when slave is writing to the master here every frame is sandwiched between the start and stop conditions firstly start condition and the seven bit slave address plus the read/write bit then acknowledgment then the command byte then acknowledgment data byte acknowledgment and the stop condition you can read the icrc tutorial in more detail on our website so here comes the can protocol the controller area network the can originally started by the robot borscht it is a peer-to-peer network it means that there is no master in the can network every node has an access to read and write around the canvas when the when an individual node is ready to transmit the data it checks that if the bus is busy or not and if it if the bus is not busy then it simply writes the can frame into the network and if the multiple nodes are trying to transmit a message on the canvas at the same time the node with the highest priority automatically gets the bus success and the canned frames later transmitted in the canvas does not contain the address of either the transmitting node or the receiving node instead of the any

address and arbitration ID is used all the nodes on the care network can receive the frame and depending on the arbitration ID of the transmitted frame each can node on the network decide each can’t node on the network decides whether to accept the frame were not so understanding this protocol is little bit difficult from the other like you are sue a user and SPI and i2c another thing about can is that it’s ports to message to message frame formats and the difference between the two message frame formats is the length of the identifier the first can frame is a standard frame also known as scan 2.0 a and it has has a length or length of 11 bits for the identifier and second is he can extended frame also known as can 2.0 which has a length of 29 bits for the identifier so here you can see that how different can nodes are connected on the canvas and it is the frame format for the controller area network here are some companies that manufacture microcontroller the famous companies like HTML freescale Intel Panasonic dalla semiconductor microchip analog devices and the Texas Instruments stmicroelectronics thanks for watching the video you can comment if you have any question