 So, now for today's class we will start with a new topic on microcontroller architecture and in that we will particularly look from the perspective of interfacing sensors and actuators and like no different kinds of microcontroller that we will need to know, so that we can choose appropriate ones for the application that we are looking for, okay. So I am presuming for this class that you already have some exposure to the microcontroller programming and some kind of idea about how things go and we will build on those ideas now to kind of get to like more advanced versions of microcontrollers and one of them is Teeba board which is ARM Cortex M4 series microcontroller board that we will take up for programming in this class, okay and we will build some of the experimental understanding based on that syntax, okay. So now for a couple of classes like we will look at this microcontrollers, it's programming details, some of the details and I will post lot of material for that and you will get to kind of understand. Once your microcontroller boards are there with you, maybe we can run through to resolve some of the issues that you might be facing in one of their discussion classes, okay. So that is how our journey going to be for next couple of lectures now, okay. So let's begin. Now let me get the pointer right here, okay. Now let's move on, okay. So see for microcontroller, you need to be having this skill to look at the microcontroller architecture and understand some of the details of the architecture. Now there can be different levels of this architecture, okay. I will explain you what it means. So usually there is lot of information that will be given in terms of what this microcontroller can do and cannot do. These are given in terms of this kind of block diagrams or like some architectural understanding will be there, okay. So we should have that ability to kind of get to see this block diagrams and figure out what it means for us. So we will look at some of these kind of data sheets of the microcontroller and then figure out. So this exercise we will do as we go along with the different microcontrollers and some of the things that we discussed in today's class also. So typically like the bit accuracy of processing these calculations. It is 8-bit microcontroller or 16-bit or 32-bit kind of accuracy is there. Then what all interfaces are provided by this microcontroller. So if you start off with one of the base 8085 microcontroller, I mean microprocessor actually, it was like a, I mean the basic computer chip to begin with when Pentium chip can 586 kind of a thing, it is you can go back in history and see this 8085 was one of the first computers that was developed. And it's still like a good academic kind of understanding purpose. It is good to kind of see how that microcontroller really works. So some of the basic understanding of how the commands are executed in microprocessor or computer or microcontroller, they are similar kind of a ways the commands are executed. So that all we will see based on the architecture and the block diagrams. So I will post these data sheets of like 8085, then like some modern kind of microcontrollers and our ARM context. So you can kind of compare these data sheets and see and kind of try to make sense of some of the things. Some part of the thing that is there we will try to go through some of the important aspects that we look for. So for example, like this interfaces in terms of interfaces, the 8085 will not have any interfaces to be provided. It will have just some kind of a ports that will be available as parallel ports or serial ports and things like that. And then one has to have some additional peripheral chips interfaced with this microprocessor to kind of make in microcontrollers. So that is a basic difference to make it like a hardware interface for exchange of the data, not really microcontroller. So there is a difference between the word used as a microprocessor and word used as a microcontroller. So when you have a microprocessor like your Pentium chips and other kind of a computer chips are all like your microprocessors actually. And they typically will have to be interfaced with the external peripheral chips to talk to any hardware or environment or like pinouts and things like that. But microcontroller will have all those peripheral also will be a part of the chip. So microcontroller chip will be a very tiny kind of chip in which like everything is there. Like you have your ADC-DAC interface or like you name it whatever interface is that that microcontroller provides that are all already there on the chip itself. And only the pinouts terminals are out actually. But microprocessor you will have only the processing part on the chip and then all the control part like or the interfaces, peripheral devices, peripheral interfaces basically, there will be a part of additional chips that are provided on board. So the board will form entire control unit but the chip by itself cannot form entire control unit by itself. So that is the difference between microprocessor and microcontroller and you should be aware about that. So let us move ahead for this basic architecture of 8085 system. Typically it is given in this kind of a form. This is like a base level architecture and the elements which are there in the microcontroller. So typically you will have this data bus indicated this represents like a bi-directional data bus. In some places there is a unidirectional data bus. It is not bi-directional. So this arithmetic logic unit is a small kind of a processing unit in which these registers can transfer data through this data bus. And the data from output of the LU can be transferred to this other data bus. So these are like typically given kind of a block diagrams one can read through this kind of a block diagrams. Okay what all things this microcontroller has inside. So this is not a microcontroller. This is in this case it is 8085 microprocessor kind of a chip and it has this typically internal register arrays will be there. Okay so this 8 number indicates that it is 8 bit register BCD some names will be given to the register and typically it will have a stack pointer program counter. These are kind of some of the standard registers will be there in every microprocessor or microcontroller. And of course there will be this timing and control unit. Okay so this is a architecture block diagram with a basic level kind of a block diagram of 8085. Nowadays like modern microcontrollers you don't see this kind of block diagrams. They will give like more you know next layer of the block diagrams in the sense they may not give you like know all these registers they will kind of I will show you some of the block diagrams. I mean you will get clear more clarity based on that. Okay so when you say this is address bus like you know typically this data bus if you see this 8 bit data bus is there then address bus address buffer is there address bus is like you know AD 17 to AD 15 okay or address AD 15 is like a 16 bit address bus is there for example for 8085 system of architecture. But like you know these kind of a detailed specifications may not be there in the modern data sheets for modern microcontrollers. Okay we will see some of the things there. So see that you know there are no extra interfaces you can see in this 8085. Okay so that's why it is microprocessor and not microcontroller as we saw in the definition. Okay then like that you know you can read these all the things that I talked about on the last slide. Okay there are many kind of things you can make sense about and you know the instructions when they are given for such a microcontroller then they will be given in terms of these registers. Okay so say there is a move instruction. Okay contents of say move BC. Okay so contents of register like you know C or move to register B. Like that some kind of a commands will be given and their explanation will be given. If you don't know the structure of this architecture then you will not make sense of those commands. Okay so if this diagram is not given and I'm just giving this like no explanation of this command move BC it's very difficult to kind of see what is what is going to happen in the system. Okay so these architecture diagrams are kind of quite important for many microcontroller systems. Typically there will be these registers which are like you know indicating some kind of operation done or not done. Okay so this is called a flag register. Okay flag is like you know something that you show when you know something is done or not done or something like that. Okay so this flag register also has this kind of a sense of notion that okay it has some kind of a you know bits which are made to zero or one depending upon the operation that that happens. So so for example like no zero flag will be set when the some result of operation is zero. Okay so so this can be used for like no further for looping operations. Say for example if you have a variable which is decremented and like no many bits become zero this flag is automatically set and then like no one can read the flag register and like no take the control of the loop like okay I need to exit this loop after that flag zero happens there. So that is like a base level that is what happens in the microcontroller or microprocessor. Okay so so this flag register is used for many of these control commands that you typically see if while loops. Okay so those kind of like you know breaking or like you know looping or like you know coming out of the loop or conditional kind of operation execution that all depend upon this kind of a flag register. So flag register plays a very important role in any microcontroller it will have it I mean you may not be able to see as a part of the architecture it may not show that in modern microcontroller diagrams but it is it is anyway there. So like that there are many different kind of things that you can read through and make sense of okay how this is what happens like that. Okay so see there is some other notes will be given like no operations outside ALU okay such as this move command okay move the contents of other register that will not affect the flag like that something will be given. Okay so each command okay reference or whatever this instruction set it is called commands or like you know commands of microcontroller that typically called instruction sets. Okay these instructions sets give you the details of like you know what that instruction does in the microcontroller and typically while giving that details they'll refer to like say okay the flag register is it some some bit in the flag register is set or is it or like no nothing is changed something like that will be will be given as part of the command instruction details okay. Now let's come to a little more modern microcontroller if you see the data sheet I'll I'll share with you the data sheet okay so this this if you see it will be like lot more complex microcontroller as compared to 8085 there are several I mean many many different registers in fact for each of the interface you'll have a different kind of architecture block diagrams okay so we you know as a user should not need not know like you know functionality of each of the registers we are not interested in that we what we need to understand is okay how these things are and from programming perspective how I can make use of this information that is given as a part of the architecture okay that is what we are concerned with we are not really interested in like you know how this microcontroller is designed or how it is working inside no we are not interested in knowing how it is working inside okay although I mean you know as a curiosity we may go into like know a little bit more more details of some of the things but I mean really it is not needed to know what I mean or how things are working like that so something is given like okay if you if you move if you adjust the contents of this register to this value then this means this will happen like that it will be given so you feel you just believe that it will happen you don't need to kind of like know how it happens exactly okay there are a lot more details about architecture up to the register level needs to be known to kind of really figure that out okay so we are not going to get into those details and like no that is not an intention of this class okay so we our intention is to kind of like you know see these block diagrams and figure out okay how can I program these to kind of achieve what I want to achieve with this microcontroller okay so that is what we are like no looking at these all these diagrams from that perspective and generally to know what are the limits that this microcontroller can be stretched to okay knowing the block diagrams one can say okay oh this cannot be possible with this microcontroller okay this is absolutely like no given the block diagrams in reading the block diagram you can come to that conclusion okay this particular thing cannot be possible or this is up to this extent it can be possible okay those kind of conclusions can be can be drawn very easily by by by looking at these architectural block diagrams and some of the data sheets of of these and in except 100 for example there are several interfaces and modules for enhanced functionality like you know you have digital IOs then PWMs then periodic interrupt timers ADCs okay these are like now kind of for a lot of modern microcontrollers this this will be definitely their kind of interfaces okay the digital IOs will be definitely there PWMs will be definitely there so so you know what we are talking about is is now like this series of microcontrollers which are in the class of you know used as a as a as a some kind of a mechatronics application okay there is another class of these microcontrollers or micro processors which are used for mobile platforms okay so mobile or display applications you know so there are many different series of our families of microprocessors the companies would have developed catering to different different kind of needs of application okay so these are so so except 100 for example I've been designed for automobile kind of a controlling applications okay so it will have the interfaces and other kind of you know these modules which are like specifically needed for those kind of applications okay motion control applications okay so so those we are we will look at some of the microcontrollers or architectures of only those where like you know we have need for this motion control or mechatronics kind of a application okay so this is how like these microcontrollers will be there and now see if you see at 8085 like you know these commands here are going to be of this kind like you know what we saw this move command for example to move these contents of this register these are like you know basic assembly language kind of programs okay so so for example here like you know we have this move command we mentioned here so they are like no these are more like assembly language kind of a programs so like you know the microcontrollers like cp you don't kind of like no start writing those assembly level commands to to do the programming what you do is like you know you do these programming in c rather than the assembly level and compiler okay typically like you know there will be an environment will be there development environment integrated development environment okay so that environment in this xcp for case we have this code warrior kind of a software environment which will compile this c code and convert it into the into the assembly language and actually carry out the operation of like you know dumping this assembly language code into memory of microcontroller to execute okay so this is these all things are now done at a much higher level okay so a user doesn't need to know what are the opcodes are like you know this assembly language commands that are used for executing your your program you just need to write your program in as if you're writing in c and then like know your your job is done so we'll get into programming aspects pretty soon just hold on for a while um but this is important to know see because uh now the the efficacy of what you are using in c program um and what gets converted into into assembly language lies with this code warrior or whatever you know code component studio in diva case and so so that compiler okay is is determining okay although whatever you have written in c how faithfully it is getting converted into code that microcontroller can understand or execute very easily okay why i'm saying that is is because see in c or c plus plus there are like no same thing can be done many different ways okay and uh not all of those ways would have been uh like no they're in the compiler to compile and like no produce the output for uh the the the assembly level program okay so it may not be get compiled and nicely uh it depend upon compiler specifications though uh it may or may not get compiled and it may not kind of pop out also a major errors but you'll wonder okay why i'm like no see everything looks fine but but it's still why it is not executing okay if that kind of a situation comes it's probably like no time to change the logic that you are using in c to some simpler kind of a logic uh if you are using some kind of a you know complex logic you can change it to some simpler logic and try again and see so uh many times like no there are no uh like no unique or straightforward answers to some of the some of these things okay why it appears that i'm doing everything right in c but uh you know somehow it is not getting executed and in microcontroller that scenario is not really uh uncommon in in microcontroller programming we'll come to the programming aspects uh sometime soon uh so this is a you see this is a kind of a block diagram for architecture of uh this xcp100 microcontroller and uh here there is some memory blocks that are written like you know so there's a flash memory ram e prom no it's a lot of the different kinds of memories are written in voltage regulator there are some kind of a pin outs and pin ins one can like no read through the data sheet to to get understand like no more more things but one can see there are these um some registers here like no pte these are like all seems like you know input output registers here okay so that can exchange the data uh in the digital format okay with the outside environment then on this side you'll have this uh some some 80 d this is like uh another digital converters uh so so some some interface for an 80 another digital conversion so like that you'll find see this is a pwm interface here synchronous serial interfaces scan interfaces you know so these are a kind of different different kinds of interfaces so so this scan for example is control area network interface this is like a serial communication protocol only but only for like no short distance kind of a communication so these are developed like no uh for specific application for example can interface is is developed for the the automobile kind of application okay germany comes from germany in german uh world manufacturers they they introduced this for the first time and like no it became there's some kind of a standard the way you have the serial interface you are as standard now okay like that you'll you'll find like a lot of these interfaces that are produced provided by this except the hundred kind of a microphone okay um so so for example if you want to say okay oh look can i have uh uh say 20 kind of uh you know analog sensors interface with my microphone how do you kind of answer this question think about this okay so 20 sensors i want to uh which are producing analog output i want to interface with this microphone is it possible okay but it's looking at this diagram like no you need to look at where you'll like no give this analog input will give this analog input to the a2d converters here okay so this you see like no this is a 16 channel a2d conversion okay so uh so this 16 bit thing is there and then there is a uh 16 there is a 16 channel another a2d converter is there so no this this these two are seem seems to be same although they are like no given some some technology different here uh you see the the numbers here 16 to zero channels are there there are only 16 channels in this uh uh in this microcontroller okay uh so what are these and what are these there'll be some small difference between these these two cases so one has to kind of see in like more detail in their thing but there are zero to 16 channels are there for uh this another converter so i cannot interface 20 sensors i cannot use this microcontroller now those kind of conclusions one can kind of draw okay so so if you get in this kind of confusion okay oh no these are like no seems like 32 channels no but then like no you need to look at little more details in the my data sheet and you'll get to know that okay oh no there are actually only 16 channels that are that can be programmed okay um like that one can see okay there are only eight motors that can i can run maximum through this xcp one type okay so there are eight pwm channels to kind of run my eight motors like that one can kind of like no um conclude some of the things based on the architectural problems and then one can go in like no more detail block diagram of each of the interfaces which i have not included here i mean to kind of understand okay how that particular interface was so how like no what are the different registers that are controlling that interface outputs okay so those kind of details will be given in that uh architectural diagram of each of the interfaces and that is important to know like no from programming perspective okay so when we talk about programming like no we'll we'll we'll deal with this in little more details okay so let's move on from here uh so this is another kind of important aspect to consider that you know the pins may have different functioning okay so pin details will be given like no which pin is connected to uh this pin number is connected to what its function will be given okay so this pin diagram details will be given in in uh detail of each of the macro that's the xcp100 for example uh so so this is a pin vss okay so if you want to find out this uh like no this is a supply voltage there are there's no other function for this pin okay but for some of the other pins like no there are some some functions like you know this pt5 okay has some other functions here okay so how these functions uh so the pin functions can change okay one can program and change the pin functions okay so that is what is important concept here to know okay pin is not kind of like having a fixed function all the time that is possibility in the new new model microcontrollers see older microcontrollers if you go for there will be like no fixed pin um functionality okay so gpio pin will just do only digital input output there is no other kind of a function that that pin can do but uh now these modern microcontrollers will have this possibility of pins having multiple functions and um depending upon the package this is like no different kinds of packages okay this like no low profile quad flat package okay or qfp you know that that those packages are are like no where this um how this chip is packaged and like no this pins terminals are coming out this is what uh is it says so this lq fp 144 means it has 144 144 pins that are coming out of this this thing so this is like uh 112 lq fp so 112 pins are there from from these numbers from here to here we'll have 112 pins that are uh given by this kind of a package okay so each of the package some package may may be missing some pinouts so you need to see okay what is the intention for you to program and then like no you can select appropriate kind of a package for for the for the microcontroller okay so uh this is about like no little bit more about this xcp100 so see if we are not looking at like no all the entire information of xcp100 and then moving on to next it's it's impossible to do that um if you see the data sheet of xcp100 it will be like about 1000 page data sheet okay you cannot expect yourself to go through the entire data sheet and then like no then only like no you're qualified to go for like no higher level you know no that's not that's not a way to understand microcontrollers it will take humongous amount of time and then even then like no you will not be sure whether uh you know we'll be able to be skilled enough to to uh do what we want to do out of that microcontroller so uh this the strategy or philosophy of um using this information is is what we need to understand here okay so see that's why like no we want this uh your background in the microcontroller domain any microcontroller domain is okay and didn't say that okay you you should have the syntax of some microcontroller known no that is not required requirement for the for this basic requirement for this course because uh you know this philosophy of like no how do you kind of look for what in the in this what is important and that will come based on like no you have some small experience that you had uh had before uh in in mac lab or like no your own kind of a microcontroller programming uh experience okay so so that experience is is is valuable because it gives you some kind of a philosophical understanding of of things okay so when you are now switching to new microcontroller you know what to look for okay or what not to look for okay both both ways like you know so so that is where like no your experience would be valuable here and uh we we understand some part and then like no we say okay this part is not understood completely but like no if we need that for some something we'll kind of get into more depth of that and come back to that like that we should understand so so if you are able to kind of like no understand this architectural diagrams well like no lot of things will be immediately very clear okay so uh you can practice to go through some of the this kind of diagrams of xcp100 i'll just post these data sheets there or like no your 8085 of course is very simple but xcp100 some of the block diagrams you can go through and understand okay oh look i need to set some registers to get some meaningful operation done out of this microcontroller and this this all this what commands i should look for i can look at this register details of this microcontroller uh block diagrams and and from there like no i can figure that figure that out okay so so uh you know you don't start reading the data sheet as a as if you are reading a book no the way to read data sheet is okay what you what is your intention what do you want to do okay say i say okay oh my intention is to just program like you know some digital input outputs so from that perspective i'll look at only that interface which is a digital input output interface for this microcontroller okay so so so so that is how like no you you uh you look for you know appropriate things in the appropriate microcontroller data sheet okay and then like no some some names that will be given for these interfaces also will be different so digital input output interface i say but like you know if you see in um uh t-bar board it is given a general general purpose input outputs okay GPIO kind of a terminology that is used in xcp100 i think there is some different terminology that i have used uh board integration module or some something like that is is given PIT or something like that okay so so those names also will be different okay so you need to look for those names look for like you know your digital input outputs and then like no appropriately look for that particular interface and then like you know you go into that detail so you should be open in some way to to see that okay oh this digital input output is i'm searching for but it is not there in this or this kind of a thing may happen like no i see the entire content there is nothing written as digital input output and there is nothing written as GPIO in one of the one of microcontroller data sheet impossible okay microcontroller should have some kind of a digital input of interface so then that then its name you need to look at that might be i might have been different okay so so this is how like no some some things may differ from one family to other family and uh we need to hook on to the philosophy very firmly that philosophy is is mostly same in one multiple across multiple platforms and look for things that that we want to do okay so so we'll we'll have this opportunity to kind of like you already have some whatever microcontroller you have gone before through but we'll have this opportunity to go through little more details and actually program this arm controller you know cortex kind of a series kind of M4 series controller