Deep Dive into DSP Interrupts and Watchdog Timers

Lecture: 5

Estimated read time: 1:20

    Summary

    In this enlightening lecture, the DSP Coding instructor discusses the intricate workings of interrupts within microcontrollers, focusing on how they can be controlled and managed. The session covers essential concepts like the function of interrupt enable registers and the global interrupt management system, discussing how to prevent malfunctions in microcontroller operations. Additionally, the lecture covers the use of watchdog timers, crucial for ensuring that algorithms are running correctly by resetting the system in case of failures.

      Highlights

      • The instructor explains the 14 maskable core interrupts and introduces global switches for management. πŸ€–
      • Discussion on how logical operations can enable or disable interrupts using registers. πŸ–₯️
      • Explore the use of 16-bit registers for storing values and managing nested interrupts. πŸ“
      • Understand the Peripheral Interrupt Expansion Model allowing up to 192 interrupts. πŸš€
      • Learn how to utilize PI vector tables for assigning groups and subgroups to interrupts. πŸ—‚οΈ
      • Delve into the Watchdog Timer module β€” your system's safety net against failures. πŸ”’

      Key Takeaways

      • Interrupts help manage complex processes in microcontrollers by pausing other activities. πŸ€“
      • Understanding interrupt registers like IER and IFR is vital for smooth operations. πŸ“š
      • Watchdog timers act as a safeguard, resetting systems if something goes wrong. ⏲️
      • APIs make life easier by abstracting complex configurations. πŸ› οΈ
      • Real-time debugging is your friendβ€”use it wisely to catch errors early. 🐞

      Overview

      In this lecture, DSP Coding takes a comprehensive look at how interrupts are managed in microcontroller systems. Starting with the 14 maskable core interrupts, the instructor delves into the use of global switches that control the activation and deactivation of these interrupts. There's a focus on understanding the importance of flag bits and interrupt enable registers, which help in managing nested interrupts and maintaining smooth operations.

        The session progresses to examining the Interrupt Enable Registers (IER) and how logical operations can be used to manage interrupts effectively. The expansion of interrupts through the Peripheral Interrupt Expansion Model, which allows up to 192 interrupts, is also discussed. Understanding these concepts is crucial for implementing efficient algorithms in embedded systems.

          Concluding with a practical exploration, the lecture covers the implementation of the Watchdog Timer. This module acts as a crucial fail-safe, ensuring algorithms run correctly by resetting the system if a failure occurs. The instructor emphasizes the importance of APIs (Application Programming Interfaces) for simplifying complex configurations and real-time debugging tools to identify and fix issues promptly.

            Chapters

            • 00:00 - 03:00: Introduction to Core Interrupts The chapter titled 'Introduction to Core Interrupts' discusses the 14 maskable core interrupts available in microcontrollers. It explains the operation of interrupts through a process involving a latch switch and a global switch for triggering specific interrupts. The chapter highlights the importance of a flag bit for storing particular values, and introduces the IER switch, which is crucial for preventing the nesting of interrupts. This ensures that during the execution of one interrupt service, other interrupts do not interfere, thus maintaining the system's stability.
            • 03:00 - 05:30: Interrupt Enable Register The chapter on the Interrupt Enable Register discusses how operations should be performed efficiently, specifically in terms of handling interrupts. It emphasizes that although parallel processing isn't feasible, after one task completes, another can proceed. The key focus is on the Interrupt Enable Register, which is a 16-bit register containing all interrupt bits. The chapter explores the usage of this register, especially through logical operations like OR.
            • 05:30 - 10:00: Global Switch and Peripheral Interrupt Expansion This chapter discusses the concept of using logical OR and logical AND operations to enable or disable interrupts in a computing context. By setting bits to ones or zeros within a register, you can control the activity of specific interrupts. You can input values into the register either in hexadecimal or decimal format, depending on its configuration. Additionally, the chapter mentions the use of counters, such as a 16-bit counter, which can store integer values up to 2 to the power of 16.
            • 10:00 - 15:00: Introduction to Interrupt Service Routine (ISR) The chapter 'Introduction to Interrupt Service Routine (ISR)' covers the basics of handling interrupts in a computational context. It discusses how registers work with ISRs, particularly focusing on how to program registers using binary (ones and zeros). A key concept is the global switch interrupt, specifically the interrupt enable and global mask bit, denoted as 'intm bar', which is active low. This means that setting it to 0 will enable the interrupt, whereas setting it to 1 will disable it. Further details include an exploration of the peripheral interrupt expansion model which breaks down the main 12 interrupts.
            • 15:00 - 21:00: Watchdog Timer and its Functionality The chapter 'Watchdog Timer and its Functionality' explores the concept of interrupt management via the Peripheral Interrupt Expansion Module, which enhances the system's capacity to handle up to 192 interrupts. This module utilizes a PI vector table, which categorizes interrupts into groups and subgroups. The chapter details the process of selecting specific groups and subgroups to choose particular interrupts, representing an extension of prior discussions on the topic.
            • 21:00 - 35:00: APIs Overview and System Control API This chapter provides an overview of APIs and delves into the System Control API. The discussion revolves around the concept of peripheral interrupt expansion, specifically focusing on the PI register, which concerns handling interrupts through the configuration of groups and subgroups. The PI register contains multiples of IFR resistors, ranging from x equal to 1 through 12 for 12 groups, with each group accommodating 16 subgroups. The aim is to illustrate how interrupts can be effectively triggered and managed using this grouping mechanism.
            • 35:00 - 46:40: GPIO and Interrupt APIs The chapter focuses on GPIO and Interrupt APIs, discussing how 16 subgroups can be utilized where setting a bit to 1 turns on a feature and setting it to 0 turns it off. It also emphasizes the importance of an acknowledge register which must be addressed after every interrupt service routine (ISR). The chapter points out the need to include an acknowledgment instruction in every ISR to ensure proper functionality. Additionally, the chapter introduces the concept of interrupt service routines and explains their role in handling interrupts effectively, though a detailed discussion on them was not covered previously.
            • 46:40 - 65:00: Timer Interrupts and Configuration This chapter discusses the concept of timer interrupts and their configuration. It explains the role of the Interrupt Service Routine (ISR), which is the function executed when an interrupt occurs. The ISR is compared to a switch that is triggered periodically, turning on specific functions at set intervals. This creates periodic events, similar to how switching is repeatedly done after certain intervals. Additional examples are suggested to further illustrate the concept.
            • 65:00 - 82:00: LED Blinking Code Explanation The chapter titled 'LED Blinking Code Explanation' explains the process of how an interrupt service routine (ISR) works in the context of programming a microcontroller for tasks such as blinking an LED. An ISR is compared to a routine task that gets executed regularly, similar to feeding a dog at the same time every day. The chapter emphasizes the role of the ISR loop, which handles the execution of specific code separate from the main loop, acting like a dedicated function that runs a particular algorithm alongside the main loop.
            • 82:00 - 94:30: Watchdog Timer Code Explanation The chapter 'Watchdog Timer Code Explanation' delves into the configuration of the peripheral interrupt expansion module in the context of enabling interrupts. It emphasizes the importance of having the proper register 'en pi' enabled for the peripheral interrupt expansion module to function. This module connects separately to the core interrupt logic, necessitating a distinct instruction to activate it. The explanation further discusses the flow of interrupt signals, highlighting that triggering an interrupt signal requires configuration of the flag and enable registers, which subsequently interact with the core interrupt logic.

            Lecture: 5 Transcription

            • 00:00 - 00:30 yesterday we saw that there are 14 maskable core interrupts particularly and it goes through a logic of latch switch and using a global switch for triggering in particular interrupt into your microcontroller and we saw that a flag bit is for storing your particular values and ier switch is there in order to prevent the nesting of interrupt so that if one interrupt service is a service is happening at the same time another interrupt should not be causing any trouble so that your main
            • 00:30 - 01:00 operation should performed in a better way so it does not clearly mean that you can service you know like uh only one interrupt and that's it it is not like that concurrent i mean after one task has done another task will happen since parallel processing is not possible over here so it's like that another thing we saw is interrupt enable register in this interrupt enable register we saw that it is a 16 bit register and all the interrupt bits are over here and we saw how we can use this uh you know or and
            • 01:00 - 01:30 logical or and logical and operation in order to enable any interrupt or in order to disable any interrupt by setting ones or zeros bits into this particular register so this is how any register is going to program like you can put your values into hexadecimal or decimal as well if that resistor is there to store value from your you know integer from zero to certain amount if it is a counter or right if any counter is there you can put your values from 0 to it that is 16 bit counter 2 to the power 16 that much integer that you can
            • 01:30 - 02:00 put into that register so uh but if it is a bit wise like this you have to program it into ones and zeros only so this we saw yesterday then we saw this is a global switch interrupt enable interrupt global mask bit that is intm bar it's active low uh particularly active low switch in which if you put 0 it will be another if you put one it will be disabled so there was a peripheral interrupt expansion model as we saw yesterday that the main 12 interrupts it is subdivided
            • 02:00 - 02:30 into 16 subgroups and it is connected through the same logic of ifr ier and global switch so right now we have 192 interrupts uh with the help of this peripheral interrupt expansion module and then we have looked at pi assignment table that is pi vector table in which there are certain groups and subgroups as well and then we saw how we can select particular group and subgroup in order to you know select particular interrupt okay and this was the extension of that
            • 02:30 - 03:00 particular table as we saw before in the first slide and 16 could not accommodate over here so they have shown it over here so we saw how to trigger this particular interrupts with the use of groups and sub groups that this was about the pi register that is peripheral interrupt expansion module resistors and in these registers we saw one is ifr resistor which is one which is varying from x equal to 1 to 12 for 12 groups uh i mean to say and there will be 16 sub groups over here so
            • 03:00 - 03:30 you can see that 16 subgroups you can trigger like this that if you put one into particular sub group it will be on if you put 0 it will be off and then we saw there was one acknowledge register which should be there after the every interrupt service routine has happened like if any interrupt service routine you are writing a code you need to write this acknowledge dot all instruction into that particular interrupt service routine so yesterday i did not talk about interrupt service routine interrupt service routine is a kind of
            • 03:30 - 04:00 function which is to be executed after interrupt has happened so whenever you are triggering any interrupt there will be one isr loop running that is interrupt service group learning so it's like it's like a switch button like after some time you are switching on something and then again it is happening you're switching on something and then again it is happening so it's like a periodic interval uh that your isr is running so you can say that you can say that it's certain uh or another example you can take into
            • 04:00 - 04:30 account that certain dog is coming to your house and you're feeding to him every day at the same time so it's kind of like that that your clock will be serving to the interrupt and whenever the interrupt is calling that particularly that isr will be executing that loop and the isr loop is responsible for writing any code or you know execution of any code so whatever you are writing in the isr loop okay that will be your one particular separate function and it will be running your algorithm ah along with your main loop okay so then
            • 04:30 - 05:00 you have en pi register that is enable pi it should be there because in order to enable your peripheral interrupt expansion module since it's a completely different module which is connected to your core interrupt logic you need to give a separate instruction that is enabled by in order to turn it on this was about yesterday and this is the overall flow of interrupt signal which we can see from here that if you trigger any interrupt to flag and enable register then you have a core interrupt
            • 05:00 - 05:30 logic after that any interrupt which is from x dot y group that is group and sub group is selected from this pi vector table and after that you can see that default isr dot c is a its kind of api application programming interface we will see in the code what is it exactly mean and uh why it is required so after that any interrupt will be served when this once this interrupt is called from this pi vector table your isr that is interrupt service routine will be served so whatever box you are
            • 05:30 - 06:00 seeing here it's a kind of interrupt service routine block which will be servicing this interrupt at every periodic interval so this information is very much required in order to generate any algorithm and once you understand this interrupt it will be very easy for you in order to model your own algorithms because once you know you can take an example like i can give you an example let's say you are injecting a certain signal uh into your board
            • 06:00 - 06:30 and uh it's a periodic signal okay with the help of adc so it is it is repeating after certain period of time and now you want to do certain operation into that signal so with the help of adc if you call an interrupt what will happen is after certain interval of time that interrupt will come and whatever operation you want to perform with that signal where you want to reduce your duty where you want to increase your duty that you will be able to do in your interrupt service routine so once you understand interrupt it will be very easy for you to model any one of
            • 06:30 - 07:00 your algorithm and many people have already worked on this controller so you know a lot of help will be available to you as well if you're going to code on your own like uh ti e2e forums as i said yesterday it is available and you can post your doubts onto that forum if you have any doubts while coding but make sure that you have read the technical reference manual throughout or you have attended any particular course so that you it will be easy for them as well to understand what exactly you're
            • 07:00 - 07:30 saying so this was about it then we saw about watchdog timer model as i told you watchdog is a kind of uh you know it's a kind of security guard which is watching whether your algorithm is working properly or not and there is one inbuilt counter 8 bit in belt counter that is it can count from 2 to you know 0 to 2 to the power 8 so it's a 8 bit counter so so in that counter you can see
            • 07:30 - 08:00 that uh you know you if your clock that particular your main clock of your cpu if it is servicing regularly to that counter then it's fine that counter will work well easy and fine but if certain issue is there with your main clock and it is not able to run then obviously your program will interrupt but in case if certain uh let's say certain issue is there in your algorithm as well this watchdog counter will not receive the clock from uh from your main cpu and then it will reset and it will not cause
            • 08:00 - 08:30 and it will not allow your main algorithm to run we'll see how this watchdog interrupt is triggering the example as well then you will understand better what i was saying so and then we'll look at look at the apis today okay why this apis are important and what is pi control pi vector okay so after that we'll go for epwm model as well so i hope this is clear to you all
            • 08:30 - 09:00 is there any doubt in this session till now what i said is there any doubt to anybody okay fine so i guess everything is clear to everybody and everybody has well understood what i've said so i'll consider this thing and i hope you have watched all the previous lectures as well so that whenever i'll be going to explain anything to you you guys would be clearly able to understand what i
            • 09:00 - 09:30 mean to say so so let's see the how you can import first all the examples if you do not have a board or if you do not have a resource explorer access like if you have resource explorer access we saw yesterday that you can download your examples from here sorry from here
            • 09:30 - 10:00 but if you do not have it then then also it is possible for you to import your example so that you can see if my screen is visible okay so from here you can see if you go to file as i said yesterday you can click on import after clicking on import if you go to code composer studio and you can see ccs projects if you go to ccs projects and browse then it will immediately take you to
            • 10:00 - 10:30 your workspace okay so instead of workspace you can go into c2000 via software and then you can go to okay from c2000 where software you can see all your examples will be listed over here so from device support if you go to f2 3790 and you can go to examples and if you go to cpu one you can see
            • 10:30 - 11:00 from here different examples are listed so you just have to select any particular folder and then click on select folder and you can import your example since i have already imported some of them you can see whether i can import it okay so adc so cpw i can import it like this okay so
            • 11:00 - 11:30 so it is kind of that you can see that you can easily import your example like this in ccs one more thing we saw yesterday how do we create a new project so if you go on new and click on ccs project you can create your new project but during with this process what will exactly happen is if you are creating your new project with this as well you have to do many things like you have to add your header files you have to add your main apis as well and after that if your header file's
            • 11:30 - 12:00 location is not proper what will happen is you will continuously face errors when you will be running your code so in that case i would suggest you to go with the resource explorer where what will happen is you will be provided with an empty project that empty project you can use in order to make your own algorithm like let's say if i go to this f2 3790 and this is the simple way in order to create your project
            • 12:00 - 12:30 if you want to create new project that is also possible but because of location error if your c2000 there is not a particular location or let's say what your cc studio is not at the same location you will get many errors your header file should be accessible from that particular project uh then your api should be proper then your out dot bar file should be created so to all that you know different errors you will face so in order to do that cca is provided with you f empty project so if you use
            • 12:30 - 13:00 this empty project and you import it since i have already imported it it's showing me error and i have used it for a blinky project so in this one blinky cpu01 is there i have renamed it or maybe this kind of example is there given to you and you can see all your apis over listed over here and in the main algorithm you have to make all the changes this is the main algorithm and this in this main algorithm you can see it's written void domain void your main function and
            • 13:00 - 13:30 everything else is empty so you can write your code here whatever you want to start variables you first declare you declare any function you call any function and you try to write your own code so before creating uh or before writing into this you know like barely it will be very difficult for you and i do not as well expect from you that you write your code like this only but first before learning into that you must understand the flow of any algorithm so
            • 13:30 - 14:00 uh how to understand the flow of that algorithm how does it flows and how exactly it happens that i'll explain in a bit uh kindly wait for two minutes this enter your search term this thing is coming in my laptop i'll just close it once
            • 14:00 - 14:30 yeah so i don't know why this enter your search term box is coming in my laptop
            • 14:30 - 15:00 so we will see today one api one by one what actually any application programming interface means what is your main code and how it is linked to certain other apis and then we will see
            • 15:00 - 15:30 an example of watchdog timer that i told you so this was one project that i created yesterday that is http and uh this is another project time delete link which is i imported from the c2000 there so this timed led blink was a toggling of any particular led and it
            • 15:30 - 16:00 was related to red led so i have created the same project named as http for triggering the blue led so we'll see that as well how exactly i have reached to that particular thing so from here first we'll see about this time led blink project from here
            • 16:00 - 16:30 yeah so uh before looking into this i will explain one by one what are all the apis mean okay so we'll start with system control so this system control api instead of showing into you into this presentation i will directly tell you over here this system control api is
            • 16:30 - 17:00 actually deals with all the clocks of your particular cpu whatever clock is there in particular in your particular microcontroller all the settings all the initialization of that particular clock is there into this system control code so from here you can see as i told you yesterday that there is your launch pad name f2 3790 then you have initialization of system phase lock loop in which your external oscillator this is the instruction in which your external oscillation oscillator is
            • 17:00 - 17:30 divided by a pll loop and it is dividing here by two so that your clock operates on off so that your microcontroller operates on particular clock of 200 megahertz as i said before that this particular microcontroller has two cores if ucp1 and cpu2 which works on 200 megahertz of clock frequency so it's uh you can see it's initialization for that particular thing after that you can see all the peripheral clocks peripheral clocks in the sense if your
            • 17:30 - 18:00 epwm peripheral is there if your eq peripheral is there if your recap peripheral is there so this is initialization of all that peripheral clock so it's a it's a predefined function like clear screen we saw so in this predefined function you can see what is return so in this particular function you can see from here if you just click if you just put your cursor on to that this thing will appear so from here you can see that your cpu timer 0 1 and 2 so all these clocks has been enabled this pcl
            • 18:00 - 18:30 kcr 0 is actually peripheral clock control register 0 bit of cla 1 control law accelerator which you are turning it on similarly this is peripheral clock control resistor 0 cpu timer resistor cpu timer 0 timer 1 and timer 2 3 timers are given see basic difference between your timer and counter if you understand well enough is that your counter will be serviced by your main clock of your cpu and your uh your
            • 18:30 - 19:00 timer will have its independent clock okay so it it it means that if your counter is there in your inbuilt module that has to be serviced by your cpu clock so with certain clock dividers or something and timers will be independently running of your main cpu clocks it will be it will be not dependent on your uh you know main controller clocks that's what i want to say after that you have hrbw module that is high resolution pulse width moduli set this is also a peripheral so it's peripheral
            • 19:00 - 19:30 clock control resistor zero after that you can see this is time back lock synchronization we'll see what this instruction exactly means okay it's used for uh all the time based module synchronization in a particular epw model like uh it's something like that that when you you have having multiple epw modules and you want all your pulse to start at the same time in order to prevent the you know face you you have to set a correct phase ship into two pwms right so what you want is you want
            • 19:30 - 20:00 all your pwms to start at the same time so for that synchronization is there so all that instructions are related to that you can see epwn peripherals as well ranging from 1 to 12 modules so that is in the control register 2 so it is also a peripheral clock so what i want to say basically is this initialization of system control it all deals with the clock signals of all your microcontroller abc's comparator tracks and every other model this is one of the api so this api is mandatory in your every algorithm
            • 20:00 - 20:30 whenever you run that you initialize all the clocks of your particular microcontroller so you can see in your main project as well if you go here this first instruction is there which initialize system controls which includes pll watchdog it will enable all your peripheral clocks and this example function is found in f283790 system control dot c5 so this example function in the sense this is the function that you're calling redefine function that you're calling
            • 20:30 - 21:00 and all the things related to this predefined function are into this particular api which is system control dot c so i hope you have understood this is it clear to all is it clear to everybody what i said yes sir yeah okay so i think you can understand now what i've said so through this what is exactly happening is through every particular instruction you
            • 21:00 - 21:30 will understand how exactly code flows and why we are writing these apis so there won't be any confusion regarding these apis in your mind that this application programming interface all these algorithms why we are necessarily running you know so this is a kind of system so every code whenever you are going to write you have to initialize all the system controls this will be your first code of your line okay and it will be mandatory for all your algorithms and this you have to write into your main main file main
            • 21:30 - 22:00 function that's what i'm going to say after that yeah after that we'll go into this pi control dot c register so pi control dot c is a peripheral interrupt expansion as i said yesterday so whatever the initialization
            • 22:00 - 22:30 of that particular pi control resistor okay it is necessary if you are using interrupt into your algorithm so this pi control resistor and your pi vector particular resistor this you need to initialize in order to run any particular interrupt first if you go to pi control dot c these are the header files header files has to be include as i told you before
            • 22:30 - 23:00 that header files include the uh declaration of any predefined functions if it is there like we saw that standard input output dot h and these are the header files in which the declaration of printf scanf and your get ch and clear screen function is there so those header files are necessary in order to you know run those predefined functions so these header files are also necessary in order to run your examples and uh you know if any uh other functions are there
            • 23:00 - 23:30 related to your device so those header files declaration will be over here so in this one you can see in this particular code you can see all the header files over here so if you just click on this you can see adc defines dot hr here can defines dot hr or epwm defines dot hr here so all the header files even if related to system control defines dot h if you go you can see from here that all the symbols which is related to your system control will be defined over here and
            • 23:30 - 24:00 if you go to epwm defines dot h so this is a header l related to epw so whatever inbuilt instructions are there for epwn model that will see so you can use this instruction which has this particular bits already stored if you use this instruction so whatever it is defined to or whatever it is assigned to do any tasks it will do that particular task like uh if you have to drip zone if you want to enable or disable you can use this particular rip zone is for protection of your epws if you know if you want to
            • 24:00 - 24:30 uh make your epwm calls to get off at certain period of time then you can use this trip zone as well we'll see what does it exactly mean then you have a chopper duty proper as i said yesterday it is used to uh you know okay we will go into that thing later so this is about control and this is about header files as i said so all the header files will be listed into this and it is necessary that you include all these header files into your project but one more thing i would like
            • 24:30 - 25:00 to tell you that this header files are nowhere but into your c2000 where software so you do your c2000 where if you go to device support and if two 3790 headers path is shown over here so it will be included over there so if you sometime create your new project or something and you want to include certain header files you can as well go to right click it you can go to show build setting and from this show build setting you can go to include option and from this include option if you want to include certain header files if the path is
            • 25:00 - 25:30 shown over here you just have to click plus sign after clicking this plus you have to go and browse or if you directly have a directory path which is from certain other algorithms that you have copied you can directly post it put it over here and you can put okay that is also fine okay so this was about including your header files so i do not recommend you to touch this portion because if you try to do this you know there will be many errors because what happens is this particular software is designated
            • 25:30 - 26:00 so that it will take the examples from c2000 where only and it is mostly related to c2000 where so whatever header path include path is there so it should be accessible for this particular software in order to get all those header files and include files from your c2000 where so so that's why their project they have given you this empty project which i told you before so that you can make your own code into that particular thing once you have done that you can what you can do is
            • 26:00 - 26:30 what you can do is i'll tell you one more way if you're really interested into this you just go to show in local terminal and you go to system explorer okay so if you go to system explorer it will tell you the location of this particular project now if you open this you can see there are certain files which is one is ccs project file dot c project file dot p project file this is cpu one ram file which is cpu one active this all the object files and everything is there object file we saw yesterday it is generated after once compiler has
            • 26:30 - 27:00 executed your code so all the files related to that particular code would be over here and uh let's say if you want to create any new project like i have created http yesterday so what i have done is i have just copy and pasted all the things from this time led link to my http folder and i have create created one new file into this and what that new file is what that new file is is just main.c
            • 27:00 - 27:30 all other apis if you just click on right click on this go in showing local terminal and if you go to system explorer so this is will show you the exact location of that particular api so if you click this you know it will directly take you to the c2000 so you can see here it's nothing but a text file in which all the codes are written so this has to directly come from your c2000 so that's why i do not recommend you to add any source file on your own and then try to run your algorithm it will be really difficult for you because it is
            • 27:30 - 28:00 designated to take the files from c2000 there okay so most of the people they read the manual and they try to create their project on their own and if they try to fail that they face many issues so one other way to go with this that to create with new project is you just create your new project from here let's name it anything
            • 28:00 - 28:30 click on empty project dot c and you finish it once you finish this what i suggest you is there is one already main file over here but you can see in hash include only compiler files are there it is not inherently taking c2000 verify so if you try to you know forcefully try to include that c2000 where it will face many errors why it is like that because i have downloaded this code composer studio into local disk local disk d and i have
            • 28:30 - 29:00 put c2000 there into local disk c so my workspace location and my downloaded location is different so that's why also it may happen or there are certain other issues as well so in this case what you do is you just go to your http and what you do is if this project is over here you can just control a ctrl c and you can just put it over here
            • 29:00 - 29:30 okay one main file is there related to ccs project and everything but you can see cpu one ram file is not here which was there for responsible for generating any particular code so you can just control it control v over here it's asking me to replace you can replace easily okay then those will be available into your main file okay so if i replace the points in the destination
            • 29:30 - 30:00 so if i click on this now you can see cpu one ram file is over here so now maybe i'll be able to run this code whatever if i write over here just like this i have created this http code yesterday okay right now i'll delete this as we don't need it
            • 30:00 - 30:30 so you can see over here that this is timed led blink code okay so from this code do not change any api if something happens then this api will also leads to an error so so we were talking about apis before so this was about pi vector table api in which you can see all the interrupt service routine uh all the all the predefined you know variables related to interrupt service routine are declared over here
            • 30:30 - 31:00 epwm1 to you know if wm12 then you have spi dma direct memory access then you have a ci adcs controller oscillators peripheral interrupt expansion interrupt ipc then you have pi over here so all the isr which you can you know use in order to run in order to cause any interrupt and run your particular code are listed over here so this api is also there if you are going to you know use interrupt this two apis which is pi control and pi vector dot 3 it is
            • 31:00 - 31:30 necessary then you have ipc dot c this api is not needed for this particular algorithm because it includes inter processor communication module support function so in this one you can see that if you want to uh you know use two or more microcontrollers together you can go for this this comes into this comes into that particular mode so let's not look into this right now after that we have gpio.c that is a gpio module support function
            • 31:30 - 32:00 general purpose input output in this one we saw yesterday like if you want to initialize all the gpio pin functions you can use this particular api or even if you are using any gpio okay you need to put this api into your code okay it is necessary because you are using any gpio pin like in this led blink code we are using a gpio pin because we saw yesterday from the presentation that uh
            • 32:00 - 32:30 from this you can saw it is a gpio 31 blue led and gpio 34 red led so this is a gpio pin only so in order to [Music] run your algorithm for that particular gpio pin you need to have this api as well after that you have interrupt service routine so this is necessary so i'll explain this a little bit you can see that the functions name which are there
            • 32:30 - 33:00 into this default isr block it's already it's already there the definition of these functions are already there so these functions are predefined functions you can see from here one is interrupt void timer to isr so it's a it's a text nothing returns nothing type of function and it belongs to a interrupt service routine serviced by timer 2 cpu timer 2. similarly there will be timer 0 and timer 1 as well you can see from here timer 1 is shown over here timer 2 is shown over here
            • 33:00 - 33:30 then you have other certain defined functions interrupt you can see these are the user one in the user one if you want to you know even change this function you can change it it's for your use and you can write your own function as well okay so once you able to uh once you will understand one code with interrupt you will able to understand what this exactly is so these are all predefined ap predefined functions are over here which are
            • 33:30 - 34:00 related to any particular interrupt so this default isr.c is an api in which all the functions related to your interrupt service routine are defined over here wake isr is there which is related to you know your watch break interrupt and you have epwm interrupt trip zone interrupt service routine so whenever any epwm is also causing any interrupt okay it will directly come into an interrupt service routine and you are allowed to write this interrupt service routine directly into your main code so
            • 34:00 - 34:30 that you can write your particular code or algorithm into this block okay so this should be your understanding whenever you are going for writing any algorithm so you can see all the interrupt service routine which are there it's listed into this particular api whether it is abc whether it is pi reserved whether it be cla whether it is auxiliary system clock or adc all the interrupts would be given over here so you understand interrupt service routine and interrupt as well
            • 34:30 - 35:00 next instruction is next instruction shown to us is dii interrupt di interrupt is given in order to disable all your interrupts as i said yesterday before setting all the interrupts you need to clear all the unnecessary bits if there are certain bits into certain registers of interrupt and you don't want that to cause any malfunction to your particular algorithm so what you will do is you will be a it is a core instruction d int so it will directly have access to all your
            • 35:00 - 35:30 interrupt registers and it will clear all your interrupts and it will initialize and in order to initialize your pi control you need to use this redefine instruction that is initialized pi control so this will be there in all your algorithms okay whatever procedure i am telling you into main till certain time i'll i'll tell till where it is so this should be all present in your main algorithm whenever you are writing your algorithm okay then to clear your core interrupt you have to uh you know as well clear your interrupt enable register enter a flag register so
            • 35:30 - 36:00 that if flag is having certain bit ones or zero it should be clear so writing zero to every register will clear all your interrupts and once your initialization and clearing is done you can as well initialize your pi vector mode because it is necessary as you know that why we are using pi vector module now so all this initialization is very necessary whenever you are running any code so whenever you are doing initialization means you are telling them that your algorithm is ready to on or you know you are going to execute something so that way you understand
            • 36:00 - 36:30 so that way that's why this initialization is necessary then this will talk about in the two minutes first before that this particular instruction is using cpu timer interrupt okay so why this cpu timer interrupt uh there is no particular reason as such okay you can use cpu timer 0 1 2 any interrupt for your own use okay since it is also doing a service to interrupt service
            • 36:30 - 37:00 routing you can use this interrupt but there is one particular instruction in order to you know cause this uh interrupt after certain period i guess some student is coming please hold on a minute okay so this instruction of initialization of cpu timers if you go to cputimers.cpa
            • 37:00 - 37:30 okay here you can see that all your timers have been initialized like uh cpu timer zero one and two as well so you can see here right now cpu timer zero interrupt count is zero okay we'll see key what does this means okay i just want to say you that this is the initialization of all the cpu timers so it is necessary that whenever you are using any interrupt which is triggered
            • 37:30 - 38:00 by your cpu timer you need to initialize all the cpu timers generally people use interrupts through epwm's adcs or cpu timers okay or trip zone whatever you want to use so cpu timers is a general way because cpu works at a 200 megahertz of clock frequency okay so whenever this 200 megahertz of clock you are working at it gives you maximum clock frequency so the time which is required in order to execute your isr it will be very less whenever you are using cpu timers as an
            • 38:00 - 38:30 interrupt because because you can maximum operate up to 200 megahertz clock frequency as well okay so uh it is like this another thing is uh i should have explained to you about cq timers before then it will be easy for you to understand okay best part we'll see first that thing will see in five minutes from here you can see
            • 38:30 - 39:00 that uh timer interrupt 0 in the pi module okay okay before that this instruction is there this we saw yesterday i guess i've explained this that if you are using port a max 2 okay then you can trigger to gpio 31 pin okay so for port a max 2 it will be ranging from 16 to 31 and for port b it will be from 30 to 2 onwards like 63
            • 39:00 - 39:30 another 30 pins as we saw and uh every port is divided into max 1 and max we saw yesterday and there is one direction resistor which is belonging to port a so this direction resistor what it is doing is it is setting that led to an output from here we saw so what we are doing here is we are setting an led to an output and we are initializing gpio 31 as a general purpose input output pin so this instruction is particularly to initialize
            • 39:30 - 40:00 initialize your gpio 31 as general purpose input output pin if you do certain other things over here if you put it one okay and if there is any epwm assigned to this particular gpio it will act as a pwlr so put it one here it won't be working as a gpio okay it will be working as an epwn if it is dedicated to that particular thing that we saw from yesterday into that presentation from here as you know
            • 40:00 - 40:30 that if any gpio is allocated to any other particular marks value so in that way you know it will be assigned to any particular peripheral so here we are operating it as a general purpose input output so i'm initializing it as general purpose input output after that this direction resistor as i said that is to set your led as output so that whatever is there you can see it from the uh your
            • 40:30 - 41:00 board okay then you have here interrupt enable register okay this is m is related to enable okay whenever you are using d it is related to disable whenever you are using m it is related to enable so what i am doing with this instruction is i am enabling this to interrupt one group okay so if you want to interrupt two groups if you want to interrupt three group you can do like this okay so you don't have to change anything over here i'll suggest you if you want to assign any particular interrupt to any particular core group which is from 1 to 14 you can directly
            • 41:00 - 41:30 put it over here so m stands for enabling your instruction and this is logical or operator which is saying that your interrupt enable register is enabled with this particular instruction okay so if you want to enable any particular group and sub group you can choose over here then you have a pi module as we saw yesterday that pi one it means core interrupt one and it is belonging to subgroup seven so main group is from pi after pi instruction main group is there and
            • 41:30 - 42:00 after this x7 it's a subgroup so 1 cross 7 we can see into the table so here yeah so from here you can see this one cross seven it belongs to timer interrupt zero okay so timer interrupt zero in the sense cpu timer zero so basically we are triggering
            • 42:00 - 42:30 basically we are triggering cpu timer zero interrupt with this particular instruction and this is to enable your interrupt one group i hope this is clear to everybody after that these two instructions are there so you are enabling your global interrupt with i e int and this is this two instruction should be there in order to enable your global interrupts which intm okay so you have to put it whenever you are you know writing your code so these instructions are there and it should be there
            • 42:30 - 43:00 whenever you are running your code because if you are triggering any interrupt you can just change your group and sub group okay all rest of the thing should be as it is you don't change anything else okay if you want to make any changes as well if you want to write your own functions as well you write it in sub functions main functions you are not allowed to do anything main function should include only initialization of timers and clocks and everything i hope this is clear to everybody is fine
            • 43:00 - 43:30 yes okay so how exactly this code is running okay so this is configure cpu timer see whenever anything you are writing into
            • 43:30 - 44:00 this particular microcontroller if it's coming in certain color let's say blue or you know anything else any color pink or whatever it is if it is coming in any color you always think that it is a predefined instruction predefined instruction in the sense like whenever you are writing scanf you have to write percentile d and then you have to declare amphison and then you have to write your variable that you are you know taking it from the user so basically it will be pre-defined the format of that particular instruction will be pre-defined similarly this
            • 44:00 - 44:30 instruction which is a predefined instruction that is configure cpu timer is related to related to your cpu timer configuration cpu timer zero con configuration in which you are writing amp sign and and then you are writing cpu timer zero it means you are calling cpu timer zero resistor which is working at sixty megahertz of clock you can put you can increase this up to 200 megahertz as well and it means that after every 500 milliseconds okay if you want to increase this if you want to decrease this you can change it but
            • 44:30 - 45:00 you can consider 500 into 10 to the power 3 okay so 10 to the power 3 you separate it and you just put 500 so if you want to put you know so basically this particular thing is in microseconds okay so whatever you will put over here it will be in microseconds so if you multiply it by 10 raised to power minus 6 and then it's for minus 3 if you keep aside what will happen is it will be resulting in 500 milliseconds simple mathematics so according to this after every 500
            • 45:00 - 45:30 millisecond your cpu timer zero interrupt should be serviced okay so in that way what will happen is at the clock rate of 60 megahertz at the clock rate of 60 megahertz where every clock will be having time period of 1 by 60 mega okay that will be the time period of that particular clock which is servicing this cpu timer and in that particular clock you can say after 500 millisecond you are servicing an interrupt it means certain clocks will
            • 45:30 - 46:00 be passed in that 500 millisecond time and after that one interrupt is servicing understood because 60 mega is a lot so for that your time period will be very less so your one clock will be of very less time and in 500 milli you can see there are numerous clocks will be served and after that particular 500 millisecond you are basically triggering an interrupt and that interrupt is calling which function your cpu timer zero function you can see amp design is for calling that particular function if you
            • 46:00 - 46:30 go to here you can see that your function named is as cpu timer 0 isr what does it mean is it is a cpu timer 0 predefined keyword so with this keyword it is calling this particular function so after every 500 millisecond this particular code will be served and your cpu timer zero interrupt count will go on increasing as you put plus and plus here okay and it will toggle your gpio 31 led and as i told you before it will acknowledge you need to acknowledge
            • 46:30 - 47:00 group one interrupt because you are servicing interrupt group one from here you can see m interrupt one so you are servicing your group one interrupt if you need to acknowledge group one interrupt so that your interrupt should keep on repeating okay so after running this code we'll see in life how this led is toggling and i will also show you key where you can see the output of your code
            • 47:00 - 47:30 if you just underscored this is a console window you can see if certain errors are there it will show over here so this is all about you know execution of your code you can see from here first your code branch dot asm which is actually this branch is
            • 47:30 - 48:00 necessary in order to connect your apis to your main code so this code branch dot assembly language is there this assembly has direct access to all the registers so your code will start connecting from this particular branch then it will call all the api cpu timers dot c default isr dot c global variable functions defines whatever function you have defined globally that particular gpio ipc whatever api it will call one by one if certain error is there it will show just like that here i
            • 48:00 - 48:30 can see that it is asking me to put my tmu hardware support for fp division in a relaxed mode but it's just uh it's not an error it's a warning to me that i can use it in a relaxed mode instead of strict mode i'll tell you where it is okay so but it is not necessary so i'm not concentrating onto that after that i will just build this code
            • 48:30 - 49:00 after building i'll just debug it by using this you know insect like button what is showing over here and it will start running once it is dumped onto that particular board it will show you green button over here you just have to click on that button if you click on that button and if i put here in this expression window
            • 49:00 - 49:30 if i put here register information you can see for enabling real time mode you have to click continuous refresh so from this you can see your cpu timer interrupt is running and every 500 millisecond its value is increasing you can see from here is my screen visible to all sir okay so from here you can see this is for continuous refresh mode if
            • 49:30 - 50:00 you turn it off you won't be able to see it running if you turn it on you will be able to see it running and then from this particular webcam as well you can see my led is blinking okay every 500 milliseconds it will be blinking this is how this particular algorithm runs okay whenever you are using interrupt service routine after certain period of time okay it will be blinking your led like this so this was the code related to you know
            • 50:00 - 50:30 your red led similar code i have designed for the blue led with the help of this http so i'll just stop this codes for once and i can go to main and from here i can see that the code is similar to time daily deep link in this one what i have done is this is the declaration of any function as i told you if you are using that function outside me you have to declare it this is the declaration of any function
            • 50:30 - 51:00 okay after that you are running your main function from here you are running your apis the procedure is same i have initialized system control as well i have disabled interrupts i've initialized pi control modules i have put disabled to all other interrupts i've used pi vector table then i'm calling here timer zero interrupt as well you can call timer one interrupt as well okay there won't be any problem i guess just go over here you can just change it to one and
            • 51:00 - 51:30 change it to one over here so if i dump this i will show me error okay cpu timer 1 isr it showing me i
            • 51:30 - 52:00 have undefined this particular thing if you could run over here yeah i think it's done so we are doing it on cpu timer one time or not after that i will just build this particular thing
            • 52:00 - 52:30 okay and you can see that they are good to go and in this particular code instead of red led and dpr31 was there i have taken something else which is dpio31 is here and in that particular code same thing is there
            • 52:30 - 53:00 i can change it not a big d let's say i'll just look into the presentation that i have gpio 34 as a red led and gpio 31 has a blue led since we have used gpi 31 will go for gpio34 so for using gpio34
            • 53:00 - 53:30 what we have to do is i guess you can change it here b and change it here one and you can go for gpio34 and if you can get your gpio you can change it here and from here 34.
            • 53:30 - 54:00 so if you are you know unaware of this what you can do is you can just erase this and click on here you can see over here welcome whatever gpios are related to this particular thing it will come over here so it is not coming in blue it means it is
            • 54:00 - 54:30 wrong so you have to put it here b so before in blue it means this instruction is correct now and then we have acknowledged all the group 1 resistor and from here cpu timer 0 in place of that will put cpu timer 1 so we'll just you know copy this and we'll put it over here in the expression window so that when we run the code you understand what is happening
            • 54:30 - 55:00 i'll build it once again after all the changes that i've done it's asking me to reload the file okay then what i will do is i'll debug this see if your all these windows are not getting adjusted you click on this double click on this particular thing it will give you full if you double click on this it will give you like this okay
            • 55:00 - 55:30 so it will be easy for you to handle so once you learn this particular thing you practice on your own once you have your board it will be very nice for you if you run this code you can see from here okay something is wrong see when i'm servicing interrupt it is
            • 55:30 - 56:00 not showing over here it means something i'm doing wrong so i need to look into it so i'll just suspend this code once again
            • 56:00 - 56:30 so i'll run it once again to see if any error is there
            • 56:30 - 57:00 because as far as i remember from this three cpu timers one timer is there which is used which you cannot access maybe because of that equal timer 0 and 2 you can use maybe because of that this error is there it will go with cpu timer 0 only not sure whether it is 0 1 or 2 interrupt i'll look into it and tell you
            • 57:00 - 57:30 [Music] okay okay is very necessary and see what is the use of this register
            • 57:30 - 58:00 still it's not increasing the number of
            • 58:00 - 58:30 interrupts [Music]
            • 58:30 - 59:00 oh sorry see what i was doing wrong is i select timer 0 interrupt in order to trigger and i was changing it to timer 1 that's why the interrupt was not triggering because from here you can see that the timer interrupt one is having location timer interrupt 0 is from 1 sub group 7
            • 59:00 - 59:30 but if i have to use timer interrupt 1 i have to see in this box where timer interrupt one is there okay it's not there it's not listed so maybe that interrupt is used for servicing your you know main cpu only so you cannot maybe you don't have access to that particular interrupt otherwise it would have listed with time interrupt one or time interrupt two so i
            • 59:30 - 60:00 guess we can use only time interrupt 0 for this particular thing since you you can see here there is no other interrupt like time interrupt 1 or anything you cannot trigger that interrupt and use that interrupt service routine so certain limitations are as well there whenever you are going to trigger any interrupt you need to aware whenever you are running any code like this if you are not getting any output over here you just saw an example that if you are not getting any output over here you make sure that you are triggering correct interrupt so this is the advantage if you are as
            • 60:00 - 60:30 well coding with the board you will get easily that if certain error is there so i will just change it to timer interrupt 0 again
            • 60:30 - 61:00 [Music] so it should run now then you should
            • 61:00 - 61:30 run it again yeah now it is running and you can see that cpu timer zero interrupt is increasing and instead of that led previously which we were looking at a different led will be blinking now so from here you can see that my red led is blinking now
            • 61:30 - 62:00 previously it was blue so this way you can use in order to you know see any particular interrupt triggering and all so i'll just suspend it for now so in this one you can put all the resistors over here you can see it's live values okay if it is interrupt service routine if it is any other resistor as well okay so every bit has particular use that why we are using it and uh if you want to see keep what this register exactly means you just have to go to technical reference manual
            • 62:00 - 62:30 and you can just if you click on this download this and into this technical reference manual it's actually quite huge manual of 3600 pages but you don't need to read that much as i have told you most of the portions which are useful to you so you just have to look into the resistors
            • 62:30 - 63:00 which is necessary for programming and you're good to go you can see it's a huge manual and i guess it's stands for i guess three thousand two thousand five hundred so they have given in very very you know long what exactly every module means and what is there but that is not possible for everybody to read this much so i've told you how to go for that
            • 63:00 - 63:30 so in this one if you go to api on paper unboxing as well so you can see here certain registers are listed over here and in this register uh will show one key what will happen if you particularly do with that particular bit of the resistor okay so this is for that that if you want to see any resistor what is the use of that we can go to technical reference manner and you can see you can see here gpa maximum
            • 63:30 - 64:00 as i showed you in the presentation i have taken the snap from here only so you can see that it is defined queen maxine for selection of gpio so this resistors are shown over here if the resistors are yellow protected they will show just over here allow protection in the sense if you want to have access to certain register just like you can see this resistor that is pi vector table timer zero interrupt resistor so this is a elo protector register so if you go into the manual and look for this register pi vector
            • 64:00 - 64:30 table timer zero interrupt so this resistor will be ello protected i want to say is i want to explain this watchdog cpu so if you understand once uh will be little bit easy for you you can see what i have done here is in this code this one header file which
            • 64:30 - 65:00 is related to project.h and in this header file all the predefined function declaration will be there as i said before then you have a function over here which is related to your watchdog interrupt function so it is servicing a interrupt service routine which is named as big interrupt service rupee and then you have two global variables global variables in the sense any function in this code can access can have access to these two particular variables if i'm writing 10 functions as well i can have access to this
            • 65:00 - 65:30 particular variable so that's why i'm leaving it and that's why i have named it here as global variables then you have here 32 what does this mean is is an unsigned integer which is of 32 bit so it can take value like this big count and loop up count can take value from 0 to 2 to the power 32 and since it is unsigned it will be having only positive values so your wake interrupt count and loop count these are two variables i am defining here for the algorithm and from here i can see that other
            • 65:30 - 66:00 procedure to my algorithm remains same where i am initializing a system control for clocks then i'm disabling all the interrupts step two and i have a pi control for step three that is peripheral interrupt expansion control initialization then you have core interrupt disabling in step four and then you have pi vector table in step five where you have initialization of your pi vector table then what you are doing is you are calling a wake interrupt just like you
            • 66:00 - 66:30 were calling a particular you know cpu timer zero interrupt like that you are calling a back interrupt with pi vector table and it is a ello protected register okay it means if you write elo instruction only you can access this particular register okay it will be mentioned in your technical reference manual that which instruction is yellow protected okay so this inbuilt examples will actually help you in in making any code that you in in accessing any interrupt service routine any interrupt you don't need to look into anywhere only c2000
            • 66:30 - 67:00 will give you a great knowledge to that particular thing then you have and wake up interrupt isr it means you are calling this interrupt isr interrupt service routing with the help of this and instruction okay then i have initialized these two variables as 0 0 and this is xcsr bit which is related to your watchdog watchdog interrupt bit okay right now what you're doing is you're clearing all the bits of this scsr that's why you return your all so that there should not
            • 67:00 - 67:30 be any overwriting or any other bit should be present to that particular uh interrupt okay so what does this particular register means that also you can see into your technical reference manual like i'll tell you that in minute so you can see here as i as i told you group 1 and sub group 8 it's related to your you can go to presentation and group 1 and subgroup 8 is related to your wake interrupt fake interrupt is
            • 67:30 - 68:00 nothing but your voiced opener so from here we are triggering this watchdog interrupt and we are enabling the pi module with this one instruction and with this instruction we are enabling group 1 subgroup 8 interrupt then this instruction should be masked for every algorithm as i said before ier enable with with respect to group 1 we are enabling so we saw it from here as well i ir1 that group one interrupt we are interested in then we are interrupt pi
            • 68:00 - 68:30 interrupt is for enabling your global interrupt okay now there is one counter which is uh there in this predefined function service dog so this service dog in the sense it's a it's a function which is related to your watchdog timer actually this is uh this is related to something when your watchdog is running your counter will start increasing from certain value and this is a register in which a watchdog counter register in which you are enabling with this 0 0 to
            • 68:30 - 69:00 it if you convert this into decimal okay you will get in if you convert this into binary you will get some values and that if you put into your this register of all the bits okay you are enabling your watchdog so you can see this i think it will be greatly clear from this only so you can just go to this particular register okay from here you can see what exactly that particular bit means
            • 69:00 - 69:30 that is also given into this resistor from bit number zero to two you have a wdps that these bits are used to configure your watchdog counter clock rate related to your internal oscillator okay int osc and it has shown here that how much the rate at which you want to run your watchdog counter that is given with this particular watchdog since it is directly uh taken from your internal
            • 69:30 - 70:00 oscillator this dividation is there if your internal oscillator 1 is there it should be divided by 5 1 2 if you are using it 0 0 0 if you are using it triple 1 then into your internal oscillator frequency that will be divided by your 5 1 2 into 64 like that it means then you have here five three three two five watchdog chk resistor so this interrupt is there in order to make you understand you don't have to understand it like what everything means because it is not useful to you in more way generally
            • 70:00 - 70:30 people go for cpu timer interrupt so if you understand that only it is better for you okay these things is there if you want to you know use this watchdog interrupt okay so the procedure will be same in order to enable watchdog you have to put zero zero to it as in in front of wdcr okay after that so you don't have to you know waste your time in deciding whether what will happen if i put zero one here okay here
            • 70:30 - 71:00 has already given you facility that you go through this procedure you will be able to trigger and enter so what i want to show from this example is when watchdog interrupt this trigger okay so what will happen is your wake count will go on increasing okay and when you uncomment this service dog whatever wake interrupt over here if you uncomment this what will happen is this function will keep on running and your loop count will only increase but if you comment this particular thing then once it will come to loop count and then it will trigger your wake interrupt
            • 71:00 - 71:30 so what i am doing is if i run this
            • 71:30 - 72:00 ah sorry so if you play this you can see here right now both of the loop count and wake count which which is my which are my variables they are increasing why it is like that because what is happening is this for double semicolon is for your infinite loop okay
            • 72:00 - 72:30 even if there are certain instructions such as while one in c that you can use for your infinite loop so whenever this infinite loop is there it is just it does not have any purpose you just there whether your microcontroller is going into your main function and executing all the instructions or not for confirmation of that only so we have just taken one variable loop count and we are increasing that variable with certain plus plus sign as you know plus plus in c will increase increment that particular variable by one so this group will run infinite times once this
            • 72:30 - 73:00 microcontroller start or wins this program is debug onto this microcontroller this loop count will go on increasing and you can see in this example your wake interrupt interrupt service routine is being serviced and that's why your wake count is as well increasing so you can see here that is increasing at particular rate and your loop count is increasing at a much higher clock rate okay so your you can see with this that your wake interrupt is servicing at a certain period of time but your loop count is running at a very fast rate it means it is running at your main cpu
            • 73:00 - 73:30 clock and wake count is divided by certain you know pll so that your clock frequency should reduced and your isr should be serviced okay but we don't have a time here with this instruction like what particular time it should run so if you disable this to disable this what will happen is you stop this
            • 73:30 - 74:00 and if you build this once again by uncommenting this particular function which is service talk function which is related to your uh watchdog interrupt so what will happen is once it comes into this infinite loop the service dog is used for resetting your watchdog counter so every time it comes into this loop it will call this function and this function will actually reset your watchdog counter so reset watchdog counter means your watchdog timer watchdog interrupt should
            • 74:00 - 74:30 not happen and your code should be running into this particular loop only so it will come to this loop it will take this function service dock once this call is executed it will come here it will reset the watch.control so it will not go to this particular function okay from here if i run this you can see your weight count is at zero now but your loop count is increasing so it means that every time it is coming to this particular loop to the service dog it is calling this is a call to function
            • 74:30 - 75:00 and when service dog is being called it will reset your watchdog counter this instruction particularly is there in order to reset your watchdog counter so certain watchdog key resistor is there in which certain value has been put so that in order to reset your watchdog timer okay so it is like this i hope this is clear to everybody this is just to explain you the
            • 75:00 - 75:30 execution of an interrupt how does it happen