Let Us PIC: A Datasheet Approcah for PIC Programming | Parinati Swadeshee | Skillshare

Playback Speed

  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Let Us PIC: A Datasheet Approcah for PIC Programming

teacher avatar Parinati Swadeshee, Exploring possibilities..!

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

26 Lessons (3h 7m)
    • 1. 1Course Overview

    • 2. 2EmbeddedSystems

    • 3. 3PICMicro

    • 4. 4DevelopmentCycle

    • 5. 5IDEsCCompilers

    • 6. 5xSoftwareInstallations

    • 7. 6CPRogLanguages

    • 8. 7CProgStructure

    • 9. 8FunctionsInC

    • 10. 9COperators Controlstatemets

    • 11. 10HardwareSetup

    • 12. 11DeviceConfiguration

    • 13. 12LEDBlink

    • 14. 13CloudBasedIDE

    • 15. 14GPIO

    • 16. 141Assignments

    • 17. 15OpenDrain&WPU

    • 18. 16SevenSegmentLED

    • 19. 16sfAssignment2

    • 20. 17SwitchSense

    • 21. 18ExternalInterrupt

    • 22. 19PPS RA0INT

    • 23. 20RAOINTPPS MCC

    • 24. 21IOC

    • 25. 23CLC 2Switches

    • 26. 22IOCwithMCC

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.





About This Class

This course introduces basic concepts of PIC micro-controller programming using C. Starting from installation of required software, this course gives insight of programming the PIC microcontroller to access General Purpose Input Output (GPIO) pins, Configuring external interrupts, Timers and counters, ADCs, LCD and Keypad interfacing, PWM generation and few communication protocols like UART, I2C and SPI. The course is well designed for beginners without any prior knowledge about the micro-controllers to get started with the subject. Also this course contains topics for advanced coders. 

Few project examples like IoT temperature logger, Water level controller are added to gain more insight of PIC programming and sensor interfacing.

Meet Your Teacher

Teacher Profile Image

Parinati Swadeshee

Exploring possibilities..!


Knowledge of PIC Programming, dsPIC, Arduino, ARM Cortex-M3 LPC17xx Coding.

Expert in MATLAB and Simulink Simulation

Worked with Eagle PCB Design tools

Worked with LabVIEW, NI MultiSim, Xilinx ISE tools

See full profile

Class Ratings

Expectations Met?
  • Exceeded!
  • Yes
  • Somewhat
  • Not really
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.


1. 1Course Overview: Hi. Welcome you all the discourse on big micro control Micro controllers are extensively being used in feels like Internet of things automotive, consumer, electron, ICS, industrial automation, medical devices and millet tiene difference. Eight bit microcontrollers dominated the market with 35% off markets, and the market is expected to grow at a component will go trait 8.4%. The market has major players, likenesses, microchip and next be exiles instruments except rise up artificial intelligence on increasing automation in the caves. Immense good opportunities. If you want to grab those opportunities, then this causes just for you. Pick microcontrollers are produced by microchip technology in pic microcontrollers are famous for their vile availability. Low cost. He's off programming. An extensive collection off three application knows on the free development tools like I d and C compilers cores. Object is the course is designed especially for no wise learners who want to master big programming starting from basics and then understand that once topics like you r R s p a and I do see throw the course will use them. Pilla Bix I d and exceeded C compiler, which you can really don't know how microchip, Excite, test and debug the court. I recommend you to use a low cost pic 16 F one double double 70 relation work. This evolution board is affordable. It has an integrated dragon drop programmer compatible with any USB connected PC laptop, or you run with the tablet because off cloud based development Toe, in addition to this board, you need a bread board. Feel components and senses have kind of the course. You'll be well versed with configuration up, interrupt time of data conversions and gendered pre Dublin signals will be able to use gloat, WiFi and zig B models for wireless communication. On the SPE, I do see protocols for interfacing sensors and Isis. I invite you all to enroll, toe this course and explore the world off real systems. Thank you for watching they can. 2. 2EmbeddedSystems: Hi. Welcome you all. I personally thank you for enrolling to the scores on pick microcontrollers in this lesson , you know, few things about embedded systems components off microcontrollers on a few differences between a microcontroller on a personal computer. So here we go. We all use. These are plans is similar daily life. These include a television remote control refrigerator washing machine, dishwasher calculator on many more like this. Do you know what is that inside these devices that drives them to work so accurately and efficiently? Yes, you are right. Microcontrollers. An embedded system is a design that uses the power of his small microcontrollers like the microchip pic microcontroller or DHEA speak. Digital signal controller. The IRA are familiar. System started in 1971 when Intel Corporation released first commercial Corporates Central person unit Intel 4004 The microprocessor has limited resources like a diplomatic and logic need controlling it on fewer injustice. As we lesser technology developed, more number of components were fabricated on the same silicon. These components are internal oscillators, Haram program memory, he prom timers, reliably mortals, etcetera. A modern microcontroller will have more models for communication on our management. in short microcontrollers combine and my corpus of in it with some additional secures called difference on the same chick to make a small country model requiring few directional devices. The single device can be embedded in tow, but the electronics and mechanical devices who are low cost digital control examples off such memory systems are washing machine more. By Paul Aprender. MUSIC SYSTEM Water level controller. Three more controllers settle. No, we'll see the differences between microcontrollers on computers. Well unnumbered controllers dedicated toe. One specific task on Embry controller runs a single problem on, as the result can be made cheaply to include just enough computing power on harbor to perform that dedicated past a nem very system as a low cost him. See you quarters Intelligence has many peripheral secures on the same team and has re literally correctional devices. Often, a number system is an invisible part or sub model off another, perhaps such as Cordless drill refrigerator, our home automation system. An example of him. Your system is this smoke detector. Its function is to be valued signals from a sensor and sound. An album with the signals indicate the presence of the smoke, a small program in the smoke predictor. I difference in an infinite loop, sampling the signal from the smoke sensor or lies dormant in a local sleep, being awakened by a signal from the sensor. The program then sounds hello. The program would possibly have few other functions, such as user destruction and a low burial ER. The personal computer is designed to run many different types of programs on Pukanic. So many different external devices. A personal computer has very literally expensive generalized central processing unit with the many other factional divides like RAM baseball tries, video controllers, network interferes circulars, etcetera. A personal computer with a sensor on Dario could be programmed to do the same function, but it would not be a cost effective solution. Ember designs. He used inexpensive microcontrollers toe put intelligence into the everyday things in our environment, such as smoke detectors, cameras, cell phones are plans. Is autumn ABIs smart cars and secretly systems to summarize on em. Very system uses the power of his small microcontroller microcontrollers. Combine a microprocessor in it with some additional Pericles. They provide low cost pistol control. Microcontroller is dedicated to one specific task or set off costs microcontrollers have conventional parts microcontroller has less computing power and requires less color. The personal computer has very little expensive and allies to CP with many other external devices. I hope you got some idea aboard him. Your assistance. If you have any questions, please drop eating discussion panel. See you in the next lecture. 3. 3PICMicro: Hey, welcome your interest. Listen, I will introduce you with pick microcontrollers this session. Cover speak device family features Off Peak Pino details blood Bagram on an evolution board which will be using throughout the course. First, we'll visit microchip dot com for details about pick microcontrollers just scored on on new products section, click on microcontrollers and microprocessors. Now click on eight Bit PM's use to check out more about eight bit microcontrollers. This page gives details about their pick on DVR. Eight victims use on the left. The big family devices are realistic vacating family. Big 16 family, big fellow family on Big 10 family pic 16 F E eight Double 70 year is 18 bit microcontrollers, which is very widely used by engineers all over the world. We will just such for it here on Click on the first link in the search reserves that will bring you this speech on DFO. Rusting. To know Tease is it is not recommended for new designs. That means microchip may soon drop this product on. This may not be available for purchase. The page also such as Considering pic 16 F one double a double seven for future designs. Just check out this four side by side comparison off the device with pick 16 of one double double seven. Big 16 off one double in Double seven is also the latest pic microcontroller, so it will be available for sale for a few more years. Microchip also provides a number of development tools for Big 16 of one Double A double seven. I prefer this stadium 164143 Relation board as it costs only $12. This is simple for bigness to work on it. The A relation board is crafted for cloud based development. That means they're supports MP lab experts i D. Which doesn't require an installation. They can just open decide E on any browser on grill your core. This relation board has an onboard Big 16 of one double doubles and persistent. One important fisher off this development board is that it does not require any harder programmers to flash the program memory. It supports dragon drop programming, so you need to just like this relation board onto your system with a USB cable, and then we copy the hex file. Nor did I was required on this relation board is very compact to carry provisions. Allow Don't Lord that theater shirt off this microcontroller on and find out more features aboard Big 16 1 double U Double seven the same series based on RISC architectures with only 49 instructions. Operating speeds up to 32 megahertz clock input on 1 25 nanoseconds Minimum instruction cycle. There are 16 level of stagnant water that means you may perform 16 Mr Conscience calls or interrupt routines, read or causing malfunctioning. Of the program. There are 38 with timers on 4 16 times. The device has upto 56 k B off programming with four KB off data memory on 2 56 itself. Equal program memories needed to store the instructions, which are to be executed. My microcontroller during the run time. No, Tommy Moe restores the runtime variables. Abrams is used to store any data on that need to be sealed when the power supply for the chip is removed. The CMC, who has sufficient memory who most of them murdered applications the chip has got to good operating world is range off 1.8 words to 3.6 wars for Big 16 LF Siris on 2.3 to 5.5 world or pick 16 of cities. It has proper saving features like those idle sleep on peripheral model Disabled, which makes this suitable for battery operated applications and also supports extreme low power features. A good number off the little peripherals like configurable logic cells. Bay formed generators See City models. UNC Whoa! A 70 CRC communication models 30 16 Put our weapons very fertile in select on DS and pick 16 off one double Double seven has in a Malakal digital converter with the competition, which has a resolution. All end with up to 35 national channels. The UDC are tumors post processing on dmat functions like raising and filtering. It also prayers in sleep more. There are good competitors and a fibrous digital download convert. It has got high position into loss later that can be controlled to operate upto 32 makers through program PLL options to enhance the frequency of cooperation by four on in told her to do killers oscillator for real time applications. Data shows tell us a lot off information and features. You may be confused and may not understand you send everything you want on the data sheet at this moment. But trust me, I will. Did you to use all these peripherals on program Big 16 of one double its double seven device. This device has many features which make a big number to get confused about. Be confident on, never lose hope. You will master these things in a few weeks. This table use exact specifications aboard pick 16 a double eight, double seven and see these are the pin details off. Different packages off the same. See, the AMC is available in Printed in your spirited package. When did Bean you offend? Package four deep in deep package for dipping. Yuki offend package on 40 14. Kick your package. This shows the block diagram off Big 16 Year one doubler Double seven MZ block diagram. The president's different memorials. President On the cheap, it shows they're converted. The CPU a timing generation block program Flash memory, Haram, with the sports for excellent peripheral interferes on shows the board some other peripherals, their soul from this lesson posting the door seeing me how in the question and answer section I'll answer your queries personally Seeing the next lecture they care 4. 4DevelopmentCycle: Hi. In this Listen, I'm going to discuss few things you must know to understand the religious aspect. Soft Embraer system. Design the contents off this video Our development cycle language tools got a good view. Bugging software and hardware debugging development, cycle design and development. Often embedded system has to undergo various stages, including selection off microcontroller design off hardware, Andi, then writing and testing off software. In each of these stages, designer has to check to meet the requirements specified by the client and perform continues refinement. Selection off microcontroller depends on the complexity of processing. It has to perform eight bit microcontrollers off for sufficient computing power and memory for most of the applications. In a few cases, one has to consider 16 bit or 32 bit microcontrollers to accomplish the job in hand. In order to minimize the time to market, one has to go with the microcontroller, which is readily available. One, which has low cost find the one on which the designer has a previous working experience for quick, proper typing. 1 may has to work with the evaluation boards available in the market on then design an orginal PC before mass production hardware design deals with selection off other components models for power management, and these are interferes on PCB design. Armor design is very crucial part ensuring the reliability and life off the product. This lesson covers the software development part. Software in Ember system is torment as program. The process off writing a program consists off, creating a chord on testing it for real life conditions and then modify it for corrections and improvements. We need a computer software called Integrator Development Environment or I D. The coordinated disposes. First, we need to create a source court from scratch, or we may use an existing template or sample courts. The courts can be written in C language or assembly level. Depending on this, a compiler or a similar converts our program Toe Mission level Court, which a microcontroller will be able to execute. The generator court has to be don't learned onto the microcontroller and then must be tested for satisfactory working. A special hardware called D burgers can be used to use this process off. Testing A de burger comes in between the computer which runs I d on microcontroller, which exhibitors that cold. We have written de bugger works as the mediator between I D on microcontroller. The designer then can analyze the core for possible loopholes in the court on Did the Court for Implement. This process has to be repeated till the program works flawlessly for areas in percent conditions. Compilers assemblers are the language tools which animator designer uses tons like cross compilers and across assemblers are used for tools which run on computers. These language tools are unknown computer, but they produce course, which run on another microcontroller microchip provides MP lab Ex I D on the X See eight compiler to dollar programs for pick microcontrollers. The generator court is tested on you d Bugger. The burger can be a software program that similares the behavior off microcontroller for testing. You don't need any hardware to test your court with the simulator software. It is an easy way to check your court on simulator and then download the final cold to the actual harbor. The court, tested on its off 30 burger, may or may not work properly on harder. This may be because off hardware issues or software elected problems also simulator runs slower than the actual microcontroller. Proteus is a famous appropriator is simulator software from Lab Center, which supports pic microcontroller. You may tried this for testing your course. When it comes to Hardware D bugger, there are programmers on Riel Hardware D burgers. A programmer simply buns the court from personal computer into internal memory off the microcontroller. The microcontroller then can be plugged into the target. Hardware on the core can retest it on real system. If it doesn't work as desired, then designer has to modify the court, compile it and then burn it again onto the microcontroller. This process is called debugging. Testing this way is time consuming. Sometimes it's very difficult to understand what exactly is going wrong in the court. Picket three Programmer de Burger is a low cost, simple in circular de bugger hardware d bugger our youthful. In some cases, hardware D buggers can be in circuit emulators or in Circuit de buggers, which use microcontrollers. That House special building the bugging features a hardware de burger like a simulator follows the engineer to inspect variables at various points in the court on single step to follow instructions as the hardware interacts with its specialized circuitry MP lab. I see the three is an in circuit de bugger developed by microchip that you can give a hand on. In this lesson, we discussed aboard development cycle language tools. Not a good debugging, really. With the things he learned in this lesson and ask me any questions you may have See you in the next lecture. 5. 5IDEsCCompilers: Hi. How are you guys? I'm back with the new listen, This listen explains you about integrated development environments on C compilers we use to program pick microcontrollers. We'll also discuss about cloud based development. So let's get started. Integrated development and Meuron means this is a system off programs running on a computer that helped to write, edit debug on the program, the court into a microcontroller MP lebec saidi is such a system. It contains all the components needed to design and deploy Embraer Systems applications. It provides a single integrated and environment to develop court for embedded microcontrollers and the love eggs I d includes a fully featured programmers text editor that also source as a window into the Deep Bugger, a project manager that provides integration and communication between the i. D. On the language tools, a number off a similar Lincoln Seals for the development off farm, where for your projects device and the burger engine that provides break points, single stepping watch windows and all the features off in modern de burger. The D bugger works in connection with the debug stools, both software and hardware. A software simulator for all. Pick em see you on DSP DSC devices. The simulator is actually composed off several device specific simulator exert tables and the Love eggs i D decides which one to use based on your projects device. There are also a few optional components, like compiler language tools. MP lab XY C compilers from microchip provide fully integrated optimized cold for pick em shoes on DS Pic de Assis, we'll be using X E eight compiler for eight bit big controllers. There are also some additional components, like programmers in Circular de Bugger Sand emulators on plug in tools will not be using any off these tools in our course C compilers, as discussed in the previous listen, C compilers translate high level programming language instructions into mission language. The MP Leveque C eight c Compiler is a freestanding compiler. It supports all eight with pick microcontrollers Pick 10 picked fellow pick 16 on Pick 18 seals devices. The compiler is also available in three operating Morse Free Standard. Our group, the standard and pro operating Moors, are licenses Moore's on require a serial number to enable them. Three more is available for unlicensed customers. The basic ample operation supported devices on available memory are identical across all Morse. The Moores only differ in the level of optimization employed by the compiler cloud based development microchip providers as an option to develop pick programs on cloud based development, tool and be love experts, empty lab expenses and online development. And we're government that contains the most popular features off Imbula. Becks I. D. MP Lab Express is a perfect starting point for new users. Off pick microcontrollers. There are no down lowers, no mission configurations and no waiting to get started on your system development. The good thing about the cloud based development is that you can write your programs on tablets. Also, for beginners who hesitated reading the data sheet to get details about various registers in microcontrollers, there is a good news. Empty lab core configuration, the MP lab core configuration generators, driver core. Using a graphical user interface, the generator drivers control the peripherals on pick microcontrollers, the graphical user interface problems and easy means for setting up the configuration off the peripherals. The microchip court configuration is a plug in for them. Pilla, Becks I d. The AMCC generates source code and head terrifies based on selections made in the graphical user interface. This is how we can build our court in MP lab ex I D. With MP lab core configuration. These are minimum system requirements for installing all these tools in your system. You just need a computer with the latest windows. Who? Bhutto. Our Mac operating system on one GB of from and one GB off free disk space. Their soul from this. Listen in this lesson we discussed their boat. MP lab ex I D x e eight c compiler flowerbeds Development on MP lab Court consideration. Thank you. 6. 5xSoftwareInstallations: in this lesson, I will show you how to install M. Pilla. Becks, I D x e eight c compiler on MP lab core configuration. Before you begin installations, download the latest release off empty lebec saidi from microchip website on windows. He just had to exert installer and follow the on screen instructions. I will show you the various stages in installation off MP lebec Saidi way on Mac systems You how to mount the DMG file and follow the on screen instructions for Lennox Open terminal emulator on change directory To have the installer is located extract the tar file . Run the installer as root. Enter your administrator password when prompted. The following are poor should display where XX bit is either 32. All 64 bit. Follow the instructions in the Installer deluxe after the installation Off em Pilla Bix, I d d out install ic C eight c compiler on your system. First, get the latest washing off XY eight installer from microchip backsides down your section when you east all an MP lebec C c Compiler, You're installing an unlicensed compiler. This means that you are running under a free license and you have access to the minimum amount off court optimization and support for greater optimization and support. You need to get their license on Windows system. Run the downloaded installer. This screen will dictate how your compiler is installed. - The compiler has no been installed. Click finish toe. Complete the install after installation off X E eight C compiler, you need to install MP lab core configuration Openem, pilla, Bix I d Select the tools menu and click on plug ins. You need an active Internet connection for installation to proceed. So your system is now ready for pick programming. That is what I have to share with you in this lesson. Please review this lesson if you get any issue in installation off MP lab Ex I D. Xy eight compiler on MP lab core configuration. Thank you. And tickets. 7. 6CPRogLanguages: this. Send the following few lessons, especially for those who don't have much knowledge about C programming. And also for those who want to refresh their memory abortion. I will cover only basic things you must know before starting to write courts For pic microcontroller, you must suffer some good books about C programming toe. Get a good hold on C programming. In this lesson, I will cover number systems on microcontroller programming. Languages. Numbering systems are not a part off C language. How included this? As we'll be using these numbering systems in microcontroller programming, there are mainly four numbering systems. Decimal binary excited symbol on Dr Decimal System uses a based off can on. We are usedto this numbering system you to use US numbers from zero up to nine. A number like 456 has three digits, four in hundreds. Place fire intense place on six in once place on the base off 10 456 is represented as four in 200 plus fire into 10 plus six into one that will be 456 by now. The system has a based off to Andi uses only digits zero and one. For example, 110 in binary is not 110. In decimal, 110 has three digits. No finders decimal equivalent. We are to multiply the cowfish ins by the power off to 110 is the same as one into two to the power to plus one in. True to the power one plus zero into two to the power zero, which is equal to four plus two plus zero that will be six in decimal, so 110 in binary is equal in tow. Six. In decimal computers and microcontrollers only understand binary numbers, but by any numbers are difficult to read. In that case, we may use one more numbering system called as eggs are decimal number. It is easier to read on. Most of the times will use HEX, a decimal system in the programming languages. Excellent Small number uses. A based off 16 on the uses digits from 0 to 9 on Alphabet's yea B C, the e and E off to represent values. Exodus simile is equal. Toe 10. In decimal system B is equal to 11. Sees equal to Trelew. These equal to 13 easy equal to 14. Your physique. Waldo 15 10 in Hexi Decimal Easy, Quito 16 in Decimal Hex 11 is equal toe 17. In this image, there is also Octel numbering system which uses the base off it. Refer this table for comparison off decimal binary on except decimal numbering system. In embassy, we use prefixes to differentiate numbering system zero X is used for acceptable number zero B for binary number zero for Octel on no prefix is used for decimal number. Microcontrollers have registers in addition toe arithmetic and logic in it on a controlling it, we have to use few registers for writing programs. These registers store binary numbers. The smallest unit off the data is called a bit one big can hold either zero or one eight bit microcontrollers. How eight bit registers on a little bit register can store only eight bits at a time are a maxim off decimal 2 55 The register shown in the image has binary number 1101 1101 That leads to significant bid is called L S B. Is the right most bit off the register and must be our most significant bit is the left most bit off the resistor. A group of four bits is termed as nibble. A group off eight bits is called a bite on two bites. Make your world languages. Computers and microcontrollers only understand mission language. Mission Language is mission specific and contains binary numbers. Zero and one Mission Language is difficult to understand for us, so those programs are returning assembly language or high level language. Assembly language is also mission specific. It can cease off instructions called as new Monix examples. Off assembly instructions are jump move, etcetera. Each of these instructions have a nickname, Onyx, specified by the microcontroller manufacturers as an instruction. Set on assembler is a software used to convert these new Monix to mission language. There are either Sisk or RISC. Architecture's Sisk stands for complex instruction. Set computers is an architecture which handles complex instructions. One complex instruction and capsule. It's several simple instructions, thereby reducing instruction retrieval time from memory. On the other hand, reduced instruction set computer architecture handles simple instructions. The processor can execute these instructions at a very high speed. The program, returning assembly language for a partner microcontroller, does not run on other family off microcontroller. High level languages are widely used because off this risen, high level languages produced machine independent court and are easily ported on other family. Off microcontrollers high level languages have English like statements. Compiler is used to generate mission language courts from high level language. Examples off high level languages are C C plus plus four down Paschal Java etcetera. C Language is widely used to write programs on computers on microcontrollers embitter See programs use microcontroller specific header flies. DOC tells compiler about hardware related details required to generate the Mission Language course. They also give the information about resource constrains like Rahm Ram stock and processing . A good omitted court should give magazine features in the minimum space on the minimum time they're Sol from this lesson. In this video you started a boat numbering systems machine, language assembly, language earned high level language. Seeing the next listen 8. 7CProgStructure: high. In the last lesson, I explainable commission language assembly language on high level language. In this lesson, and following few lessons, we'll discuss mainly about Hi 11 language. This lesson teaches you the structure off C program and Syria turd lives. Let's have a look at C program structure. A typical C program consists off direct use declarations and statements. Directors are handled by pre processors. The pre processor repairs. The program, to be read by the compiler three processor Direct use are always preceded by a hash mark. Hash. Include hash defined on high Spragg. MMA are the three directives using memory court hash. Include is used to include header files. Herder files may contain device specific details. Compiler specific functions. Standard library functions on the user defined function declarations. For example, hash include xy dot etch indicates the pre processor to include XY compiler header file. Yes, Tedy, I would dot It is a header file, which defines variable types and functions for performing input and output. Hash defined is used to define symbolic. Constance. We may use some constants or certain number several time in the core, instead off typing the actual numbers we normally define them as Constance at the beginning off court, the program becomes more readable when we use hash different. Also, it is convenient in the keys. When we want to modify these values in such cases, we just need to modify them. Only the beginning off the court and the statements has defined on one on hash define off zero. The symbols on and off are assigned the values one and zero, respectively. These values cannot be changed throughout the problem, except in the hash defining statement has spread Mount Direct use in truck, the compiler Toby here in a certain way, based on the description off the hardware resource is off the target computer hash Prague MUS statements are most often used in header files, which provide the hardware specifications for report lor device Brag Mazar hardware specific features. Declarations declarations are used to define the name on type off. Identifiers used in the program. Identify us, represent either your value are variable or a group off instructions called functions identifies the present. A memorable occasion where microcontroller can store value are functions and I didn't differ. Can be any world that begins with a letter or underscore character followed by a zero more letters, numbers or underscore characters. The C language has keywords like in Car Return Main etcetera, which the compiler results because the house special meaning in the language key words are never to be used as identifies. I didn't the first are declared using the following syntax date. Our type. Identify the name semicolon. A semicolon is a statement ordinator in C data types, data types and see provide rules for the storage and retrieval off information from memory . When we declare identify years, we must mention it's a data type. Data types can be car in float on long. The data type informs the compiler about how much memory location it must reserve to store the value in the memory. The details about the supporter data types and variables for XY eight compiler is mentioned in the XY eight compiler users. Good page number 1 49 These are the intentional later tapes, and their size is supported by exceeded compiler. A bit signed the car Unsound car signed in unsigned ING are few commonly used in T generator types. These are the range of soft values, foreign teacher types, car data type stores, eight years. Maximum value off car is 1 27 on the minimum value is minus 12 Indeed, so a character who are signed care variable can hold a value in the range off plus 1 27 to minus 1 28 Unsigned care can store values up to 2 55 Schardt in has a range off 7 32,067 to minus 7 32,067 Unsigned in can Take a mags him off 5 65,035 a long and can store even a bigger number you're to select a higher later type. Won't leave. It is required in the program. A higher later type requires more memory. Locations on microcontrollers have limited RAM memory. To store floating point numbers, you may use a float double or long double later. Types. That's all. In this lesson you learned C program structure. Direct use declarations on guitar types, river, The things you started in this lesson before we move on to the next lesson. Visual. Discuss aboard more C programming features in the next lesson did get 9. 8FunctionsInC: in this lesson, you learn aboard functions in C calling a function I'm scope of variables and functions. Programs contain a number of instructions that tell the microcontroller what task it has to perform on when to perform it. Sometimes fever instructions are repeated again and again to perform a butler task a block off. Such instructions are termed as functions functions make the program to look credible. Andi, easy to trees functions typically accepted data as input, manipulate data and returned the resulting value. Every function definition has a function header. A functionary describes what type of value the function Britain's the name of the function on what input argument it expects the body of the function follows the function header. The function body contains a set off statements between braces which are exuded when the function is called. Every secret must have a function called main, which is always the first function to be executed. Main function will not accept any in person will not written in the result and you validate in the fire with the pair off. Parentis is will be considered as functions. The instructions off main function must be included between two races. The term wide before the main indicators that the main function does not return any values . The main function can also execute court from other functions. This is referred as calling another function before calling another function. It has to be declared on defined in the source file. This can be done by writing the function body before the main function in C program here. Delay. Underscoring amiss is the function which is written before the main function. The DELAY function accepts in teacher number on does not written anything. Have the function to be called is returning other source file our library file, then you need to include yours header file so that you can call that function. For example, delay dot edge is a header file which has the function declaration the source file are the library file must be added to the project to enable the main function to find the definition of the function to be called. The variable season functions can be global variable, arto static or an external variable. A global variable is declared before the main function. A global variable can be used inside the main as well as inside all the functions called by the main all functions can read and write to a global variable. A local variable is declared inside a function on and it is valued only inside that function. Compiler assigns memory to these local variables in the ram memory. Static variables are used in functions on day preserve the value assigned to eat in between function calls. The different between global variable on static variable is its scope. A global variable can be accessed from other functions on C five by declaring it as an extra in type that as ecstatic variable cannot be accessed by other functions or other see files in the course. Soon, variable eyes declared before the men so it is a global variable on can be used in the main function as well as the function delay Underscore m s variable I is initialized with in teachers 25 variable j off type car. In the function dealing underscore M iss is declared as static on it is initialized to zero . The variable ge is added with the number 10 so a new value often a store in G when the function terminators No, the function is called by the main function for the second time since the variable Jay's declared a static. It still horses lost value of 10 j will not be initialized again. 20 variable que in the main function is a local variable que is accessible only inside the main function, the variable axes declared as Exton. That means X is a global variable. It would have been declared in another seal file in the project on external, variable cannot be initialized with any value because it is initialized in the sea file, Barrett is declared. Other than these variables, that can be a constant in Sequels. The values assigned to constant types cannot be changed once and declared C compiler assigns memory to your constant in the program. Memory as a value assigned will never change. To summarize functions, typically accepted data as input, manipulate data and return Deserting value function contains a function header on function body. Every secret must have one function called mean. A function can call other functions. The variables are used to store values in functions. The variable in functions can be off global. Arto, our local study are extent type. You can also use constants in the functions, their salt from this lesson. See you in the next lesson 10. 9COperators Controlstatemets: in this video, I will explain function body, see operators, control statements and program comments Before I talk about function body, let me explain you. The sea operators. An operator is a symbol which tells the compiler to perform specific mathematical or logical symbols. C offers arithmetic operators relational logical ba twice on increments detriment operators at the medical, but it resulted less for addition minus for subtraction, asterisks, court multiplication, backslash for division and percentage sign for marginalise. Relational operators are used to compare a Boolean expression for greater than greater or equal less then unless than, or equal equality or non equality. Nor that in double equal sign is a logical operator, whereas a single equal sign is an assignment operator. See supports logical operators like logical and logical or on logic alone, Logical and on logical or operators are Byner operators. Means they require to operations. Logical, not appears on single opened. See support bit. Find operators to perform bit by bit. On our eggs are ones compliment right shift on left shift. There are also inclement operator and the criminal operators. These operators are used to increase or decrease the value off a variable by one as explained in the previous listen function, is a group of statements which can be called inside another function. A function should have a function header on then their function body. The function body contains few assignment statements. Control statements like you Fells Switch case for on why a function may also call some other functions. One of the simplest and most common statement in C is a Sandman statement on assignment Statement takes the value off the expression on the right off the equal sign on designs it to the symbol on the left side of the equal sign. For example, years equal to 34. This assignments treatment assigns the value of 34 variable e before assigning a value to the variable. That variable should be declared at the beginning off the main function control statements alot decisions to be made to determine which statements are exuded and how often there are two decision making and to looping structures in C. He fells is a common decision making structure here. If yells are the keepers, the expression one insert a parent is is can be a bullet expression or any see identifiers . If the result off expression one is non zero. Then it is called as true condition. The expression one turns out true, then only the statements inside the foot braces are executed sequentially on. Then the execution is transferred to the statements following the NFL's block. If the result off expression 10 or falls, then expression to gets evaluated again. If the expression to is true, then only the statements inside the yells if block gets executed. If all expressions are false, then yes, the block is executed. There can be only one. If on only one yells block in a he fell structure, you may write any number off yells if blocks following year if block yes, if and yells blocks are optional in If l structure when you want to check a single expression or a variable with the list of possible values and then execute the set off statements. Switchgear structure is useful here. The such expression is evaluated on then compared with kids constants. A burglar block off case start Mons will be exuded if the value of the expression matches with a particular case constant and then the structure terminators. If the switch expression doesn't match with any of the case statements than an optional default block statement will be executed. You may write any number off case blocks inside its. Which structure for and while are the looping structures, which are used when we want to execute a block off statements. A number of times based on an expression far loopy, is used. When we know the number of reiterations to perform, they're far. Nope. Uses a count variable, which need to be initialized. Farlow will check the condition for that variable, and it raises the block off statements. Still, the condition becomes false. Are the end off vegetation? The variable will be incriminated as given in the increments part. Yeah, why Lopez used. When you don't know exact number of times, you have to repeat a block off statements, but you want to repeat them until a condition is reached or a Boolean expression turns out to falls via loop. First checks the expression. If the result is true, then the block off statements are executed of the expression is false. The while opiates dominated, you may also use via loops to retreat a block. A certain number of times similar toe for look in that case, he hurt increments. Arbitration count in the body of the while Loop as the inclement is not specified along with the condition, will understand more about these decision making encontro statements as we start to write the C programs. Common Cincy programs are the non executable part of the court. Comments are not executed by the compiler on day. Also, don't count for the course. Eyes on performance comments are used for documentation on. We explain the importance off a block off statements in the court. Comments can be placed anywhere. They also help us toe disable some portion of the court for debugging. Interesting. You can come and multiple lines off course like this. Oh, are you may use this double backslash to come in a single line in record their soul. In this lesson, I explained UAB or see operators function body control statements like if Els switch keys far lope and why Look, you also know the importance off comments and how Commons can be added in C. In these four videos, I have explained a few basic things that bore C, which you need to know in order, right? And we're course, please attempt a practice test to check how much you have studied in the first morning. Take care 11. 10HardwareSetup: Hi guys. In this lecture I will show you how to set up the hardware and connect the components you need and we love Express Speak 16 off one double Double seven Evolution Board Bread world for you, buddy Connectors sorting and soldering lead through allergies. Andhra sisters just follow the video tutorial properly and do it. The Revelation Bull has an onboard pic 16 F one double U double seven microcontroller. It has a reset button USB connected for dragon drop programming. A Walters regulator on probability. If you're not family with soldering on blackboard connections, please refer the instructional PD off. Given in the resources really owes male bird connectors to connect this evaluation board to bread board Next solder the bar character to their relation World no connect a red allergy to the pin RB zero with their cities resisted off one kilo, their sister limits the farmer current off delivery. You'll save value. - That's all. This is the required hardware set up for testing, enabling court to check that you have done it properly. I have provided a testicle in the resources. Don't know that the file on exactly no clinic a micro USB cable to the Evolution Board and plug it to the U. S. B port off your system. It will be shown as an USB flash drive. A copy that led blink dot hex file in the extracted folder with a USB flash drive on Press the reset button. You should see the red led connected to Port RB zero off the relation board blinking that shows that the connections yard than are proper if they lit is not blinking, followed the troubleshooting guide. Given in the resources, I'll explain you how to write daily bling court using MP lab Ex I D in the next lecture, take. 12. 11DeviceConfiguration: hi guys and the last. Listen, I explained you how to prepare the hard receptor before we go ahead with writing course. I just want you to know about device configuration. A wrongly configure device will not execute the program properly. Device configuration consists off configuration words Core protection on device i. D. There are several configuration world boots that are low, different oscillator and memory protection options. Big 16 F one Double A Double seven has fire configuration for sisters, which must be set according to the oscillator and memory concerns. The first configuration register is used to specify oscillator options. To understand how this is to be set, scroll to Chapter six off the leadership in page number 110 oscillator model with fail safe block monitor. This is the clock source block diagram. The external oscillator model can be configured in one of the following clock. Moore's National Clock low power mode that works below 500 kilohertz. Actual clock medium pour more that works in the range of 500 kilos to eight megahertz external clock. High power mort that works a bow eight mega hearts yell P. That is a target. Oh, kilohertz, low power Crystal Moore Txt medium gain crystal or ceramic resonator oscillator more that works between 100 killer hards toe four megahertz. Just high gain crystal or ceramic resonator. More that works able for my guards. Excellent block can be applied to clock in pin. In that case, clock or pin can be used us I open toe provide clock for other components. In case you want to connect an external crystal oscillator in the LP txt or adjust more, you need to connect Asper This secured Bagram. He may also use a ceramic resonated in case affection oclock the emcee who has on oscillator startup timer To ensure the stable operation off system clock the S. A little model contains a pill that can be used with few national clock sources to provide a system clock source. Secondary clock source may be used as an alternative block source. If you want to reduce the power consumption off the NC you during your part off your court , you may switch toe this secondary oscillator. There are internal oscillators which eliminated the new professional oscillators. It has a high frequency internal oscillated operating upto 32 megahertz, the low frequency internal oscillator operators at 31 killers, Dentyne Lost. Little Block also contains a divider block called MF Internal Oscillate to supply certain specific frequencies to other models on the device. This 1,000,000 figments internal oscillator model takes the undivided, high frequents internal oscillator plot as an input on our ports to clocks a 500 killers clock on your 31 point do for you kilohertz clock. The system clock source can be switched between external and internal clock sources by a software. This section deals with blocks, teaching and sleep. I will explain this in a separate lecture. Fail safe clock. Monitor our lows. The device to continue operating if national oscillator fills No go back to page 93 in conflict. Want Richest Bit 13 is used to enable or disable fail safe clock monitoring Mitt 11 is usedto alot. The clocks, which a factional clock feels a bit eight. Talos if you want block out, been as I've open or block or pin to supply clock for a directional peripherals. Big 6 to 4 are used to specify the reset default value Bits you're 20 are used as external oscillator. More selection bits. We'll move on to the second configuration registers. This is used toe. Specify supervisory options this resisted. Must be configured accordingly to enable debugging bit. Quello is stack or flow under floor reset enable big back register keeps and the track off in trips and function. Calls on or flow or under flew off Stack register Tzar Sing malfunctioning off them. See you as it closes the track off program flu. This bit transit causes them. See you to reset. In such cases, however, a good programming must a wide instances soft stack war flu are under, for the remaining bits are used to enable features like peripheral pin Select, but I don't notice it. Power up timers Master Clear Enable Conflict three Registered is used to set watch dog timer related perimeters. Conflict four Register enables low all day protection scanner model. Right protection off last moment. Conflict fire registered Enables core protection feature. When these bits are set, it prevents anybody from reading a poem on flash memory contains for the timing of a lot. Discuss much about these conflicts registers. We'll see how we can set these registers easily. In the next lecture. Use the ready four memory locations are designated as Heidi locations where the user can store sex, um, or other court identification numbers. These locations are readable and write able during normal execution. Devise I D and Revision 80 the member locations. Who are the device? I don't revision. 90 are stole, are read only and cannot be raised or modified development tools such as device programmers . Andi burgers may be used to read the device I d. On revision, lady. With the knowledge off these things, you may proceed to the next lecture see in the next lecture. 13. 12LEDBlink: Hi. Well, if you must be excited by no, after having the hardware set up ready to create your first pick program. I have been telling you only theories and concepts in all these lessons. And it's time for some action. No. In this lesson, I will show you how to create a project in M Pilla. Becks, I d generating the configuration bits on. Then cording the pic microcontroller for blinking led connected to pin RB zero. Before we begin, you must have installed M pillar. Becks. I d exceeded C compiler on and Philip core configuration. So let's get started first. Launch them, Philip. Exciting. If you're using a tablet, it can use flour based I d m p Lab Express. How demonstrated how to use MP Lab Express Cloud based I d. In the next lesson in m Vila Bix, i d Click New project. A new window will pop up. Click on microchip emerge Stand alone project on next the select device They big 16 off one and double eight. Double seven under device and click next. Now select the to list for programming the device. Since the relation board supports and dragon brought programming, we are not using any programming tool. Select the simulator on then next here, we need to select the exceeded Combine our tools in. If we have multiple abortions off the exceeded C compiler, select the latest washing. If x e it is not listed here, then you need to install it first. Here, you need to give a name for the Project and Selective Folder, where the project fights are Toby Stool. It's better to create a separate folder to store your pick projects. Having a single folder for all your projects is really good as you can back up that folder . Time to time, I will create a project folder in Need Ray for all my projects. Let me name it. Does let us pick? I have created a folder named Let Us Speak in My Eat Drink on named the Project as my Ellie labeling. Keep this Sata's main projects selected on den Click finish M. Vila Becks organizes the court on files as header FIEs Important fights linger files source files Libraries on Lord rebels now will go ahead and gender the court for a lady blink. MP lab core configuration makes it easy to program. Pick microcontrollers in the Tools menu under M. Byrd Submittal. You can also launch MP lab core configuration by clicking on this MCC logo on the left. Over here, it shows the resources you're easing. This shows the list off peripherals that are supported on this particular device. This is the composer area, which allows us to graphically configure the project resources. Click on the System Project Resource. The composer shows the options to select the clock Sources on clock Frequents will select in Los later at four. Mega hers. It shows the conflict registers, which we discussed in the previous Listen. If he explained each of these registers, he'll be able to see the various options to configure the device. There is conflict one. Register conflict to register Con fig three Conflict four gone Think fight on DFI. More oscillator Control registers don't change these settings unless you know what they are doing For the time being, that's not very much about configure. Will keep the default values before you proceed, just make sure that you have the proper package of the pick device. The Revelation Board has 14 UK Offend package. The pins marketing blue indicate the pins, which are available for general purpose. The blink the led connected to R B zero we need to first configure are busy whereas and output pin and the pin manager under port be lock but zero to select RB zero ask GP Able In case you require RB one we are do lock with one The pin market in green shows that we have selected that pin in our project once make sure that you have locker bit RB zero as output in the PIN Manager agreed. Next we'll make this pain as an output on disabled all adoptions. You make you a custom name like red led for easy reference, That's all. Now just click Generate cord on them Sissy generals that require courts and files for you Save the configuration files Wait for few seconds Still MCC genders The required court for you I will show you the files generated by MCC Asper Our options specified in a graphical user interface off MCC First open the MCC Darcy file The Czech configuration course defined with prag mus These brag mus indicated the US later and other conflict options Check the pin manager Dorsey file This is the court to initialize the registers to set RB zero as an output. If you take the header files that are some micros and functions that we can use in our program, there's about using MCC for generating configuration Brits and initializing pins for GP able. We'll analyze these course in the next elective. No, I will show you how to bring the allergic you need Tobe Rose, the pin manager dot h in the header files on such the macro RB zero led toggle. Copy this and placed it in the main file insert of I Look, this macro will toggle the condition off. Led connected to pin RB zero Each time it is executed. Type underscore underscore delay underscore and miss on reading the parent is is type 500. This is the building function off exceeded compilers to generate delay in terms off millisecond asked for the past value No, this functions under its a delay of 500 milliseconds by including these two instructions inside the lie loop. Basically, we are talking. They led on our busy rope in every 20.5 2nd No will build accord and check for 10 years in case you're getting errors in the courts. Ah, huggy one them beloved files as if file in the resources. Just don't Lord on exact the full open the projecting emblem on build the project. It should work for you. Check what he had done wrong by comparing her court with the court given by me and then corrected in your court. Build a successful no Broza. Let us speak Folder created in the address, which we have selected as a project folder, opened this folder on then distribution default on then production. Locate the my led blink dot exe dark production dot hex file and copy it. Now connect the violation Board the computer using micro USB cable. It shows as experts. Maar Storage Device opened Express folder and based the Corporate Hex file. Now you can check the ability connected to R B zero. Pin is blinking every one second. There's all from this lecture practice what you have learned in this lesson by changing the blinking rate on changing the poor pins. Also try to connect few moralities on, try toe play with the allergies by blinking on, generating different back. Post your dollars in the question and answer section. See you in the next meeting 14. 13CloudBasedIDE: Hello, guys. Hope you're doing well in this lecture. I'm going to show you how to use them. Plavix. This cloud based i d To write programs for people. We use integrated development tools that provide facilities to write software courts on idea normally consists off a source coordinated build automation tools simulator on a burger I m. Vila Becks is an i D. We use for pick devices. We need to install them in relation to compilers and other add on tools. Microchip provides MP Love Express, which can be run on Web browsers, off computers and most off mobile phones and tablets. You don't have to download and install any software. In addition, this club is tool also provides you massive amounts of storage available to users. You can store your current projects in the cloud the community feature or lose you to share your ideas with others or gain inspiration from the shared court repository. No, I will show you how to use em. Pill a big space first open Web browser and type this in address bar. This page gives information about loud based i d Click gets started. No button to launch the I. D. in the guest moored. You cannot save your project, but they can still build your core. Microchip offers free log in my account. So for us to create an account and then logging PMP lab experts, this is the interface off I D, which looks similar to the stop question. First, I will create a project for pic 16 F one double A double seven microcontroller. Click on new project under file Mental Select Microchip embedded on stand Alone Project. Here, select the device, which is Big 16 off one double double seven on, then give you a project name and then click finish. Once the project is created. Diary looks like this. This part shows the project fights. There are only two groups now identifies and source files dashboard and use more details about the selected device and the court size. Now we'll go ahead with microchip core configuration ER to generate the configuration, bits and courts. Click on this blue color MCC icon Leonardo. Use MCC on browsers. You're toe first installed Java runtime environment on MP lab Core configuration. After installing the NCC your toe copy and paste, this court given onto the MCC. The procedure to generate the court. Using MCC in this online tool is same as shown in my previous video. Now I will show you a traditional way off writing court without using MCC. First click on a file to bring this window select new main file on, then next here. Given name to the file and keep the extension as C. This is the new file, which will how a main structure first thing is to set the configuration bits select window pick memory view on then configuration bits that will bring these conflict registers and options for each of these convict registers. I'll just make three changes to the deferred values. One is I will disable the external oscillator and next time will enable the internal oscillators at one megahertz. I really disable this watchdog timer. I'll keep the remain ings values untouched on click on this. Generate source court to output. The tool automatically generates the required bag. More direct use. Copy them all and placed it in the main file at the beginning. No toe bling. The led connected to R B zero first here to make the pin RB zero as our put by clearing the air. Let's be off this. Be register. So right this line, Chris, be bitch dot Chris B zero is equal to zero, then a semicolon. This line makes the big zero off crispy register zero. Observe that. Chris. Be on it. Let's be. Zero is Ritalin caps. Whereas bits is written in small, you're to follow the exact former. So basically, we're enabling the output driver for RB zero. Next, we'll keep the led in Austin type lack be bits dot lack B zero is equal to zero. This makes the big zero off the port be. Look, that turns off the led No to blink reality. We need to toggle the r B zero pin continuously with the small delay off, say, 500 milliseconds inside the while loop will write the court, which my current lawyer has to execute continuously, right? Lat be bit's dot Lack B zero is equal to one to drive the pin RB zero high. So led will be on next type Underscore, underscore delay underscore Yemen is on bright finder inside the parent disease. This will produce a delay or finder millisecond. Next, copy these two lines on depressed it. Here, change this 120 to turn off the led. So if you assign one, then the led will be on. If you're a Zen zero, the led will be off. The led will be initially off. When the violet begins to execute, the first line pulls the led high on. Then there is a delay of finder millisecond. The tired line will drive the already low on. Then there is again your delay off finder milliseconds. Now save the file on Click this build hammer sign button. It shows that the court has an edit. That is because we have used to delay a miss function, which makes use off oscillator frequency to calculate the deal. In order to work on this error, go to the top after the header files. Type has defined underscore X T Yale underscore fr eak. You then assign the value off oscillator frequency, which is one megahertz. This line defined sauce later frequency as one megahertz no will build a court again. Now the court has build successfully. Click on this download button, now copy and paste the downloaded file to the Express folder, which appears when you connect the violation board to the system. After this you can check that reality is blinking Asper. The court we have written This is how you write the court to blink led connected to R B zero without using MP LAPD core configuration. If you're using M. Philip Express on tablet or smartphone closer, the name sissy cannot be used in that case here. Toe, go ahead. With this traditional way off rating the court, I have created few projects in MP Love Express that you can use for your reference. You can try these scores by browsing the examples, and then you can edit on build the courts. Globe is the MP lab Express stool is cool, but it's prefer to use deck. Stop washing off MP lebec saidi. In case you need to build a court for pick device when you're on a tour or when you don't have access to your laptop, you can try this clothed with tool. This is very useful because they don't have toe Don't Lord or install any software's. They're soul from this. Listen, thank you 15. 14GPIO: Hi. I have already explained to you how to create a project in M Pilla. Becks on right Accord to blink led connected to our be zero. In this lecture, I will explain you the different registers associated with G p A weapons on. Then we'll analyze the court generated by NCC First letters. Open the data Shoot off pick 16 off one double A Double seven a navigate to Chapter 12 0 in pace number 200. The device we're using has five ports named as 40 four b. See the on board Eat If you check the pin, diagram the pins named as Ari zero R E one Ari toe till Aria seven. Our group with us Quartey, Ford be Kansas off pins RB zero RB one RB to kill Our B seven pins are zero RC one till rt seven belongs to Porc for two D has already zero rd one gilardi seven. But as party has, only for pins are zero r E one are Ito and R E three. The pin RG three is designed with master clear function. In total, there are 36 GP weapons in this 14 package used in Evolution Board most Portman's share common functions with device pretty for us both, and log on digital in general, when a peripheral is enabled on importing that been cannot be used as a general purpose. Or put each of these pores how many registers like pulled latch Chris and the Log Selig Week Pullup input level slavery control on open brain control Here extra offers the corresponding port name. For example, 40 prissy lucky exit ler of the Registers Society for Party To understand how the port works, have a look at the poor structure. Whenever a data is returned, toe either port or lack register. That data is held in the data register with the price did buffer is enabled by writing a large zero to the Chris Register. The data will be assigned to the Park Laurrapin off the port. If the tristate buffer is enabled by writing a logic zero toe Chris register, the data will be assigned to the partner pin off the port. A righto port resistor will cause a special problem off. Read, modify. Right. Last register is used to work. Um, this raid modify right problem in the picture. But when you want to read a port. You should read it from port resisted because they read from latch. Use the value of the data register, whereas read from port registered. Use you the actual value of the port pin, but issued Disable Chris register when reading. To prevent the value of data register from or writing the value of the port in the register and log, select our lows. A port pin to be used from an a la CRA digital converter. If you want to use it in for digital input output, then you must disable the corresponding but then a log select register. This is important if analog select, but it is not clear. Then the and gate will block the real operation. You must remember that when you want to write a report, use last register in shit off port register These die yours connected between reality ground on the port queen provides or old age and polarity protection. If any high voltage or negative voltage appears on the pin, these die yours conduct thereby limiting the world age are nipping 40 registers as I have other desert that are registers for each and every pork we see register controls the direction of the port setting a prissy but is equal to one will make the corresponding port . Yep, in on input. That means it disables the output driver clearing it receive. It will make the corresponding poor tape in and output. There are two possible connections for every pin in open drain on push pull open during operation is independently selected for each pin. When an open drink control beauty sick, the corresponding port or put becomes an open drain driver capable off sinking current only . In this case, a pullup resistor is connected to drive any Lord. When an open mind control but is cleared, the corresponding port or put pin is the standard push pull drive capable off sourcing and sinking current. In addition, each port has a sliver controlled register, which allows the user to control the rate at which signal changes. When a slew rate control, Biti said, the corresponding port pin dry is slavery. It limited. Sliver it. He is nothing but the rate off change off signal with respect to time. The input level register control, then put Walt It ritual for each of the available port input pins, then lock select bits default to the unlock more after the city. Do you use any pins as digital general purpose or peripheral imports? The corresponding analog Select bricks must be initialized to zero by user Software Week Pullup register all owes us to enable internal pull ups for port aprons. These are the somebody off registers for Port E. These are for port. Be for poor see for two D on these are for Port E No. We'll open the court generated by MCC and analyze it. First open the main door. See file in the source file. The file has a header file named AMCC Dotage in the MCC generated files. Derek To check the header file, select the header files MCC. Gender typifies on open this MCC dotage file. It has few header files included, like exceed dotage for exceeded compiler PIN manager dotage and then a few standard library defies. It has definition off crystal frequency off one mega hers. There are two function declarations. One knees system initialized. Another one needs oscillator initialized. Definition of these two functions can be found under source files in MCC. Dorsey file at the beginning that are pragmatically possessor statements used to configure bits all the conflict registers conflict one conflicto conflict 34 on conflict fire register bits are set to default values by the i. D. This is the function system initialized, which does two functions. It initialize. Is the port as either input or output? Since we have set RB zero as output, you should expect the least significant bit off Chris Be Register said that zero the technique. Just rightly conducting manager initialize on select navigate and then go to declaration. It opens in the manager Darcy file where that function is implemented. So the function has set all last registers off all pores to zero. Here, check that risk registers Allport pins armored input by writing a bit one toe their positions. These registers are a bit registers. So when all the birds are said to one, it becomes FF in exile decimal. So make RB zero as output you need to set Unless the off Chris B zero That means, except the last bit. All other bits must be set to one that gives a value off. Yoffie in exile decimal MCC disables doubt. Put drivers off the remaining pins by writing big toe 12 corresponding bits off Piste register. Port E has won the four prints out off, which are the three pin easy used as a master clear that loses with three pins on Port E. All of them are not used, so I'm since he makes it as input pin by writing 07 to make our A zero R E one and Ardito, as in Putin's No. R B zero, is used as digital. I've opens so there. Let's be off on the log Select be register is set to zero to enable read week pull ups and open brain registers are cleared by writing zero that makes all internal pull ups disabled Onda pins operate on push, pull more not on open drain more in push pull moored The pin is capable off both sinking and sourcing currents come back again. Sissy Darcy Second function is oscillator initialized function which rights values to our Slater control registers to set internal oscillator, oscillator, frequency and other oscillator related options. Now open pin manager dotage file in the head verifies on the top that are few definitions for input output high, low and free. But you should never change these header file contents check red Led said Tired definition in Line 69 this land sets the bit corresponding toe RB zero that is a lesbian flag. Be register as one. That means it drives the pin RB zero high. Similarly, the line red led set low search are busy rope in look. Red led toggle line actually reads the least bit off lot. Be register and inward sick. The Tiller sign is a compliment operator. That means it in March, the big There are a few more definitions which we don't require. No, no, Come back to main function to see the court. There is a system initialized function. Call to set are busy rise output on to initialize oscillator. Control registers Inside of I loop, we have continously toggled darby zero pin with the delay finder millisecond so the already will blink every second. And that's it. You learned aboard different registers associated with GP weapons. Power ports can be assigned input or output functionality. We also analyze the core generator by MP lab core configuration. No, to check how much you have started in this section that are a few interesting assignments. Try to solve them by your own all the best picker 16. 141Assignments: no. 17. 15OpenDrain&WPU: Hello microcontroller GPS opens Support three features Push pull open drain on week pullup . These features are device specific, so you must refer the device's data. Shoot for availability off these features. This lesson explains you about these open drain and internal pull of Fisher's off. Portman's have a Seamus driver on an internal pullup resistor. Seimas over has two transistors Q one and Q two. Q one is a the most device, which conducts when the signal from driver is look que toe is an and most device and conduct when the signal from the driver is high. In the pic devices, open drain control and weak pull up enable registers are used to control Cuban, and we pull a persistent for push pull operation corresponding bit in open ground control. Resistors must be clear. To understand the working off push pull driver let us consider led one and led to connected Asper this diagram with the SYRIZA sisters to limit the dye. Your far were current ladies have a former world and drop off two point tools toe 2.5 hours . When a Portman is driven high, it provides a voltage which is equal to really pic 16 f one double A double seven provided in the express evaluation board works on 3.3 words. Dizzy So additional world age in excess off led Farmer World age off 2.2 old should be dropping across the city's resistor. A typical led will have a forward current off 20 millions to be on a safer side. Let's stick forward current off 10 millions that will give us a resistor value off 110 rooms. Any value higher than this is safer. I have used a value of 4.7 kilo ohm. Any high signal appearing er the input off you must push pull stage will feature on transistor Q two and drives the port in low on hands. Fidelity to will be off but led. One gets on, since it's scatter is re one low by the port in so current from really threw the day old will flow into Q do to ground hands. Q. Two things The Lord Goring a low signal and then put off Simoes Dries Q one on and Q two will turn off. Cuban will drive the poor pin high, so led to will be on but led one will be off. Current now will flow from ready through. Q on through led to the ground, so the stage sources the current reality. So it is absurd that which pulled rail sources and things occurring. The electrical characteristics in data shoot in the page. Number 5 91 specifies a maximum current off plus or minus 50 millions. In any standard I open. We should not sink or source current higher than 15 millions. So for the level operation and long life practice, not the source or sink current higher than 20 millions from GPS opens off pick microcontrollers transistor Cuban can be disabled by setting a corresponding bit off open drink control resistant. The resulting brave is called open drain are open collective as the train terminal off the Kyoto is not connected to anywhere. Now consider a lady connected from ready toe. 14. Low signal cannot drive the and more sinister so cute will be off. Allergy will be off, since there is no part for flow off current from ready to ground on, Portman will be floating. When a high signal is produced by the driver, you too will conduct thereby driving the port pin low led will turn on and the current no flows from rigidity to ground through Seriously. Sister Led and cute. So cute you will sing the current. We observed that the open brain drive is capable off sinking current only instead of connecting led from really to pin. We may also connected from Port Pinto ground. In that case, when a low signal is applied, Cuban will be off on a poor pin will float. Therefore led will be off. High signal will turn on Q two and again Portman will be floating. Led to will be off the circular. Never works for both. High are lost Signal levels from input output Driver on external resistant must be connected from reality toe port in order dis secured to work. Now if there is a low signal from driver, Q. Two will be off. So poor Penis Pullard Walt Age depending on the value of resistor connected. This extra older sister connector is called pullup resistor because led stunned on on current flows from really to ground a high signal tons on Q two and pulls the porting glow led will turn off and cuter will sing the current. The amount off this current difference on the value of pullup resistor of the assistance is less than more current will flow, so a low value assistance is called strong pull up, whereas higher assistance causes a small amount of current. Therefore, it is called a week full of pick microcontrollers. How weak internal pullup resistors that can be enabled by setting a corresponding bit in WP , your sister big pull ups are disabled on startup presents off internal pullup registers. Eliminate the need off external pull up to be connected in open during configuration. These weak pullup resistors cannot provide sufficient current to drive lures but are useful when you want to connect switches on button to port pins. Your board will have less components to do two presents off internal pull ups. Now we'll see how all these will work with the liar demonstration. This is the hardware arraignment. I have a red led connected to Port RB zero with a limiting resistor off 4.7. Klum First open a little bling project in M. Philip, which we have created in one of our previous lessons. Open main Darcy file. This part shows the already connected to R B zero which should be blinking Everyone second were large ing anything here. Open pin manager Dotage header file on. Check the open time control on Dweik. Pull up registers. So all these registers are set to zero. Indicate push pull moored on DNO week. Pull ups. Build this court and copy the hex file to express board. If you have a multi meters, check the world age of pin RB zero with respect to ground multi meter reads a value off around 3.3 words When the led gets on on greed Surround zero words When elegies off No, we'll modify the court for open during operation and the pin manager dotage headed the open drain can be register to enable the open drain for RB zero r b zero is the last pin off port Be so said they Let's be off open mind control Be register Assigning 012 already can be register will set the ls be off that register. We have not modified anything in the main file. Now build accord and then copy and paste the hex file The expressive Elation board and really should blink asked the court but it fails to bling since the poor can only sink currents, it is not ableto pulled up in high. So, as expected, Elliot is not blinking. No, if you measure the airport in voltage, it shows a value between switching between 0 to 1 points and world nor that the multi meter rears average valiantly. Seymour's in the open time moored in the port pin, will be floating for high signal. Now I will connect a pullup resistor off 4.7 cologne from really itty to poor pin on. We'll check what happens. That's perfect. Quality is blinking Asper the program This pullup resistor connects the floating opened in connection to really let me confirm it again. By removing it on, my lady stops blinking. I will canning the pullup resistor again and it works. You must be careful in selecting the value of pullup resistor. Else he would end up with the damaged. Been so any value in terms off combs is fine. Just enough assistance to keep the current below 50 millions or even 20 millions is safe. Now. I will remove the sectional pull up and enable the internal vehicle up. Let's see what happens to enable quick pullup for RB zero I have to set the ls be off WP you be registered high again. I'm not going to change anything. It is still there in the open during more I have enabled weak internal pullup which can supply current off 2200 micrograms Asper the device data sheet, build accord and then copy and paste the hex file The expressive Elation Board Wow! Amazing! The internal pullup is driving the led on and I think led intensity is not that great because off the pullup But still it works in comparison with the open drained rail push Pull dry provides more speed off operation. It can both sink and source current and also it provides small drive capabilities. Since pullup resistors limits the current in open drain opened trainees to be used when you need to connect. Many switches in Parral are in wired Our connection also in a few communication protocols like I Tosi communication where multiple masters share common lines for communication, they're soul From this lesson. I hope you have understood clearly the concepts off push pull open dine and weak pull ups. I'll come back with next lesson to interface seven segment a little display with Until then , take care Bye 18. 16SevenSegmentLED: this lecture is about seven. Segment allergy Displace, I'll explain you two types of seven segment displace and how to interface it toe pic microcontroller are the end of the lecture will understand how to use seven segment displays. Toe display numbers. Seven. Segment led displace are widely used display numbers in instruments and sign boards. They are cheaper, durable on. Most importantly, they can be read from a distance. Seven. Segment displays are made up off seven allergies in a rectangular arraignment. The seven segments off allergies are identified as you may be. See the E, f and G. Nobody is. They have one more segment to display. Decimal point allergies in these displays are connected in two ways. Common anna types how an or softball led is connected together and cater's off. These ladies are available as in usual pins. On the other hand, common cattle displays how Cater's off already is connected together to form a common point on a nurse are available as individual pins. If you checked up in Bagram, the segments are arranged in a random order. If you hold the display with the simple point downward, then from the left, the foster pin Izzy. The next one is D in the next days. Common then see. And the last one is decimal point on the top. Is he a be comin, G? Yes, I have both these types off displays in my hand. If you look at the sides off this, you will find a number. Now. First, let me show you the data sheet off seven segment display which you can find in the resource section. The data should use some features and applications off this display. Important is this table which Jews? The part number and the type. The display I have is 5501 which is common, Anil and other with 5503 is common cattle device. Check the number on the display you have and find out whether it is a common an old or common cattle. If part number is not properly printed or if you have a device with other part number, then you can find out which type ladies by conducting a small test with this visual Multi meter. Keep it in the community, Mort, and insert the red probe toe old age measurement and a black probe too common. Now hold the red probe to common terminal and black robe to segment. We have the segment yea, igniters, then this is common and or display. If it isn't lit, then entertain the props off multi meter. That means hold black probe to common and read the probe, hoping me now if the segment yea ignorance, then it is common cattle display. If you don't have a multi meter, there is one more way to identify the type of display. Connect air sister off curriculums range to common terminal and connected to really now connect one wire terminally and connected to ground. The segment should ignite in the common and or type in a common cat, or you have to connect common terminal to ground through your sister on segment. EA to ability. This display is common cattle. Next, we'll discuss about interfacing this displaying with pic microcontroller to display digit. We need to father by us. Suitably, these led segments for this common terminals off common and or display should be connected to really on Cater's off corresponding segments. Toby Lit must be connected to groan and common cattle. Common terminals should be connected to ground on segments. Must be puller high by driving terminals to really with microcontrollers. This is done very easy. The figure shows how two types of displace should be connected. Take an example off digit zero to be displayed. We need to let all segments except G and decimal point in the case of common cattle to live segment C, A, B, C, D, E and F drive the pins connected to these segments high the remaining pins connected to segments G on decimal point should be kept low that feel far by our abilities corresponding to segment C, A, B, C, D, E and F on these segments will be on display digits zero in common and not displace. You need to do exactly oppose it off this when the pins off microcontrollers are Pullard low, the segments will get far by us since common and or sell connected provided that means despaired. This zero. You need to drive the pins connected to segments. The A, B, C, D E and F Luke Onda pins connected to segments Z and decimal point must be 31 high. Turn off those two segments. This table shows positions off different segments in our to display digits from 0 to 9 on decimal point for common cattle display for ease of programming will use the hex abysmal equivalent off these course for digits. Zero except decimal court is UFC for common cattle on 034 common and their table goose. These X occurs for both common scattered and common and or displace. Take this dagger for connections. Use any port off pic microcontroller. I will use coarse sea before we proceed. Sector data. Shit. To find out the D. C. Farmer car into per segment, which is around 20 to 30 millions, I will keep it toe 10 millions for say, for certain, find out the forward edge per segment, which varies from 1.822 point five hours, depending on the color off display. Let me take minimum off these, which is one point it was from these two. You can find out the value of current limiting resistor. I will use 4.7 kilo home sister. The value of ill effect, the intensity of the display use the same value for all the segments and the segments will have different intensity. No, we do. They require circle connections. Do these connections with the relation board, not connected to laptop or any parcels, plays the display on the bread board somewhere on the centre, near to the evolution board with the decimal point. Don't works on lightly. Press it to ensure good connection. Take eight resisters on bend each off them in the U ship for easy insertion. Planning this resistor toe penny on the other end to an unused column off Bread board connected to our C seven using a jumper wire. Next to do this for Segment B, but no to RC six. Next segment C to R C. Five segment D to R. C four Segment E to R C. Three. Yes, you are. See do G to R C one and finally segment decimal point to our C zero. Next, if you how common and or type display connect common terminal to read it. There are two common terminals. Connect both off them to read et off relation work in the case off common cattle display, connect both common terminus to ground terminal off Evolution board. Make sure that the connections are proper and the wires are properly inserted in the bread board. More importantly, sick that their sister lives are not touching each other. Now. Open em, Philip and creating new project for seven segment led display. I will not use the MCC. Instead, I will write course directly first creating new file for writing the court to generate the configuration with slick on Windows. Then pick Memory V's on then configuration bits. You should disable induction all oscillators and then select internal oscillator at clock frequency off one megahertz. Then Gordon and here disable the watchdog timer to avert any research generator configuration bits on, copy everything and arrested in the main fight. First, define the crystal frequency as one megahertz. This is required for delay. I miss function to produce the required amount off Billy inside the main file. First, we need to initialize all pins off the Porc, as are assigned. Proceed with zero X 00 that will reset Oliver itself Chrissy register and enable the output driver self Allport. See pins? Well, first, starting off all the segments off. Seven segment display for that type. Lassie is equal to zero x 00 If you have common cattle discipline for common and or display , you need to type large C is equal to zero xff to turn off all the segments. Next clear analog Select. See register by writing zero x 00 and also disabled. Open drains on internal big pull ups before this table, for course, to display numbers from 0 to 9 on four decimal point in total letter 11 courts. So create a character away off 11 elements I will limit as common K course on initialize them with hex scores. As for the table, keep it in the same order in kids. If you have common and or display, create an area called common e course on right the courts for common and or Display. We need an infinite loop in any microcontroller core use via one. For this, I'll write the court to displayed seizures from 0 to 9 in the incriminating order on finally display decimal point. This can be done by a far loop like this. Declare the variable off for look. I have 11 elements, so I want the far look to execute for 11 times, and then it repeats because off Luke next days, to assign the hex course to Porc the case off common and are displaying, you need to assign Darcy with Kami course for common cattle display type lassies. Equal toe Come J Courts off this line will assign Porc with the court asked for the table values as I eatery. It's with the values from 0 to 11. That means when I Easy Court zero, the first element of the character very will be assigned to love. See, that will display digits zero in the next generation, when I becomes equal to one, The second element Off Array will be assigned to Lassie to display. The one basically designed scores to display digits from 0 to 9 and then finally decimal point. Next, give a small delay off one second. This deal is required before next. Digital displayed. You cannot just the delay asked for the spirit. Require there, Saul. Build accord on. Once it is successful, Opened the Fuller and locate the hex file. Copy the hex file and connect the relation War with a laptop. Best the hex file. So the express folder? No, that display shows the digits from 0 to 9 on Finally a decimal point before it repeats again. This three piers forever. Until the supplies which you know with that I will end up this quite a Lindy lecture. See you in the next lesson. 19. 16sfAssignment2: 20. 17SwitchSense: no musty. In this lecture I will explain how to interferes. Tackle sits with microcontroller factors, which is an on off device that is only on when the button is pressed. It there used Tokyo momentary on signal switches enable human interferes to convey information Toe microcontrollers a day Switches normally have four terminals for circular connection Hold the switch in your hand like this These are the two terminals off the switch. The other two ends which face the other two pins are internally connected. Four terminals provide good mechanical stability in these speeches. When they're used in PC bees first will build the circular Mount the switch on the central part of the bread board like this. Take a jumper away on connect one end of the switch to ground Colonel off Revelation work Connect other end to any GPS will be enough microcontroller. I have connected it to already too. The switch is connected from already to the ground. We need a pullup resistor For this circular to work properly will use the internal week pullup resistor available in pic microcontroller. Next connect one led to a GPL open using a current limiter. Sister, I really use our day Zero This is a sir. Cute. We are going to be used here. I wander microcontroller to switch on the led only when the switch is pressed for this we need to write a program so First Open and Philip and create a new project, then creating new C file gender the configuration briefs, then copy and paste it toe The sea file defined the crystal frequency as one megahertz. How connected Led to Pinardi zero and switch to already too. So how Toe configure rd zero as output pin on already to as an input pin I had to clear the corresponding bit off Chris de Register to enable output driver also clear and lock Celik open drain on week mullah bits turn off led by clearing the bit off lacked de register corresponding to our 20 Next to enable the input driver off Already too, said the corresponding bit off Christie Register clear and along Select register enable vehicle up for already two yells. The pin will be floating when the switch is not president type of I look and read the court to send the switch. Another switches connected from Arnie to the ground using an internal week pullup resistor . The vehicle upper sister pulls the Pinardi toe high when the switch is not. But when the switch is present, the Pinardi two will be pulled low and it really is logical. I will use FL statement to check whether the switch is present or not. I will read the status off RD two off 40 of the pin real zero. That means the switches president This will turn on led and the else part I will turn off ability. Since it is a mechanical switch, there will be switched the bouncing off contacts. So use a delay of 100 milliseconds to nullify the deposing effect. Save this file on build the project once it is successful, located the hex file and paste it to express board. Now check the secured by pressing the switch to see that led turns on only during the period when the switch is held. A Press it when you release us which the led turns off their self from this. Listen now, just for your practice, use the switch as on on off which for a lady the already should turn on when you press the switch and then dreaming on till the fifties. Press it again. Try this exercise. I'll not give any solution to this, but you can always ask me for help. Syria in my next lecture. 21. 18ExternalInterrupt: no Misty today. I'm going to talk about interrupts and how to configure pick microcontrollers to work with excellent terms. Interrupt isn't request made by the peripherals off the microcontroller or any device connected to it. Interrupts generated by peripherals is called software. In trips, the interrupts, which are generated by actual device, is termed Harbor. Interrupt, as it happens, are certain microcontroller chip. In this lesson, I will discuss only about actual interests microcontroller upon receiving and interpreting . Quest will service it or leave that part. Lorraine trip is enabled in the user program. There should be a group off instructions that specify what actions I need to be done when there is an interrupt from a particular source. These set off instructions is called Interrupt Service Routine or ah yes, are on Yesterday's exuded only upon the occurance. Often interrupt the microcontroller follows some backup actions before it. Executors and I s are the contents of the program counter are RPC, which force the address of the program memory location from where the next instruction in the main program is to be fetched will be pushing. Did the stack also, a few critical registers are also backing up to microcontroller will execute the yes are on Gwenda. Yes, Sorry stagnated. It should resume the main program from where it has been stopped because off the interest for that it will require the data from the stack on Loaded to PC on. Also, it restores fuel critical register contents and then continues to run the main program. The same process repeats again when the interrupt our cars next time interrupts can also be disabled. That means microcontroller will continue to execute its main program and ignores an interrupt request. Open the pig 16 off one double A double seven data Shoot on more to Chapter seven On in denims, you'll find details about the operation off interrupt in this chapter. This is the interrupt logic off pick. It shows different. Interrupt sources like very far interrupts Time are zero rund interrupt in drop down change , etcetera. The G I e Bit, which is nothing but global interrupt, enable bit enables or disables all the trips. Peripheral. Actual interrupt enable R P I E Bit is used to mask the interrupts from preference in Turpin is used for external in trips. That means only one external device can be directly connected to Dark Queen to generate Excellent I n t interrupt can be enabled by setting i n t. Then there is an interrupt on i n tip in I nte off flag will be set on microcontroller will be interrupted if global interrupt is enabled. This interrupt can also be used to wake up the chip from low power sleep more. The same thing is explained in this section Two points to keep it in your mind. One is interrupt Flag bits must be cleared before exiting die Asare yells. It causes repeated interrupts Second, any interrupt occurring while G a bit is clear will execute when the g a which they set again The timing diagram shows even that happened on an extra in trip when there is a change in signal on i n tip in i nt a flag is set in the next two clock period. If g A is also said, then it generates an interrupt the time elected from the change in iron tipping toe the execution off Faster Instruction of the USSR is called interrupt. Latency in Turpin is used to cause extending trips in in the interrupt control register G A it must be said to enable all in trips. P E i e Bit is used to enable all peripheral in trips. I n t e d d bit decides the interrupt edge. If this bit is set, then interrupt occurs on rising edge of the signal on I n tipping. If this bit is cleared, then falling edge of the signal on my end tipping causes dangerous. This no tells that interrupt flag Brits must be cleared before enabling an interest. I n t e bit in p i e zero register is used to enable or disable external interests. This bit must be certain to enable Giant in trip to clear the interrupt flag i nt f It must be clear in the PR zero registered this bit can also be used to check whether and actually interrupt has ocurred or not. These are videos registers in connection with in trips for i n t interrupt. We need to set g a bit on di nt Easy bit off in context. I nt f bit off p i r. Zero register must be clear before I nte bit off p i e zero register is set this table indicates the D for location for i nt as r B zero i nd Fisher can be more to any off the port Yay or port beeping using PPS visual. Discuss aboard Dart. In the next lesson, there's enough off theory. I will show some practical stuff. Using interrupt. I will use the hardware connection used in the previous listen with one modification. Since I NT is located at RB zero by defied, I will connect the switch to our busy roping now open and blub on creating new project. Also create a new main file and generate the configuration boots. Check that the their cities off in the configurations, since their city uses are busy rope in copy and paste from the configuration boots defined us later. Frequency right, an infinite loop in the Mane program Without any court, that means microcontroller will be exhibiting no operation instruction. This is just to test the interrupt feature Configure rd zero as output pin for led on then RB zero as input pin with weak pullup enable. Now I will configure the eunt in tripped in the Intercon Register said Global interrupt enable bit to enable all in trips. Then I n T e d g bean to select either rising or falling edge. Next. Before enabling, I entertain Dripped. I must clear Diane t a flag in pr zero register. After that, I can enable i nd bit in p i e zero register. That's about initializing RB zero as in tripped on our day zero as output pin I need to write Ah, yes, sir. After the main program, type wide, interrupt as keywords and then give a custom name for the yes are Ah yes, Our is similar to your function but it cannot be called by the user program. It gets executed only when there is an interrupt. Also, yes, our cannot return any data this higher. Sorry is common for all in trips occuring in the pick microcontrollers, including very fertile encrypts time or zero in trip, or are you are seeing trips? So I need to check the interrupt flag to identify the source off interest. So this if statement checks Diane t a flag is set high are no. If I nt a flag said then the interrupt is caused by i n dipping. If there is an interrupt, I will turn on led on. Then turn it off after one second before exiting the yes Are I must clear the India flag? Yes, it causes repeated interrupts. You may test for it later. The end. Now build a project on then copy and paste the hex file to test the cold presidents which and the led tons on for one second and then turns off. That shows that the court is working. You might try by keeping g a bit zero and then again build and placed the court a la observed that the lady will not are known indicating that the interrupts are disabled Now I alleged discord the control on and off off led I will remove this court from Ah yes our and declare a global character start and then initializing zero and ah yes, I will talk all this variable if start is equal to zero Tarnoff Day lady yells star non duality build Accord Dragon dropped the hex file to express board Well observed that the court sometimes work and sometimes it is not responsive. This is because off switch D bones ing which happens in mechanical switches on causes multiple in trips to work on this problem I will rd delay off around 300 millisecond and check whether it works broken. None of it works without any glitches on daily changes. It's state. Each time I pressed the switch, I just want you took rising age by setting this pain trip edge bit and see what effect it has on the court. Check it out on comment. Your answers there. So all I have to tell you in this video I'll come back within new stuff in the next listen taker on by. 22. 19PPS RA0INT: In this lecture, I will discuss one handy feature that will definitely help you out. In certain cases, PC bees are the backbone off Um, weird system, which contained Micro, contributed to our supply on few peripherals like speeches. And I would reverse These peripheral devices are connected to Portman's. As for the supported functions on those, Portman's switches are normally connector toe pins, which support interrupt features. Similarly, fuel pins support serial communication functions like Rx and TX. Based on Pino details off a microcontroller in it, they need to finalize the schematic on then prosciutto PCB layout. If you commit a mistake on the schematic entry, I will come to know that when the PCB reaches your hand from PCB hosts, the connections in the PCB are not revive arable, so you may scratch fewer tracks and then hand solder the required connections. Or you may dump those PCBs and get it redesigned. Also, you may how on existing board, but with connections not Asper, the functions supported by the poor pins. Just look at the image here. Well, that's 50 is not connected to the bean, which supports I ain't in dripped. Also, they are the connections are not matching our ex ante expense in such cases, very for help in select will sail a lot off time, effort and money. GPS allows us to map Portman's to peripheral features in the software level. With PPS, you can use the existing PC bees by remapping the required features to the connected. Portman's BP has also use more freedom for the Arbor designer aunt. He can use a nearest pin while rotting the board. Let's find out more from the data. Shoot off, pick em. See you in the Chapter 13 p piece model, connects the peripheral inputs and outputs the device I've opens. Only digital pins can be used for PPS, whereas on a lark functions remain. Fix it with this table shows the different input functions, their corresponding registers before locations on remarkable Portman's. It shows that I NT signal is that has to r B zero pin. By default, I end a signal can be remarkable to any pins off sporty and port beat by configuring I nt PPS register. Similarly, Rx and TX signals are connected to our C six and R C seven by 84 on these can be remembered to any pins off port P on sea by configuring Rx PPS Andi XP Pius respectively This table goose the values he hard to write toe PPS registers to remap desire pins to remap. I enter signal to our A zero we how toe right 000 So the i n t p p s register this part explains the same thing. Each peripheral has a people's registered to map and the lies been, whereas each I will pin has an people's register with which it can be mapping without put off peripheral. This is the same beefier block diagram off peripheral pin Celik, which shows that peripheral input outboards can be remembered to other Portman's for bidirectional pins like yes d off I to see PP Selections for both input on our ports must be made for the same port pin bps includes this lock feature which province and the random changes in the peripheral been mapping. A special sequence must be followed in order to perform been mapping. An example called is shown in the assembly language. First interrupts must be suspended then 06 55 on Xerox year must be returned to PPS lock register. B P s locker Bit off people's lock register must be clear before we can change up in mapping. In addition, PPS lock one way in the configuration but can be set to all other software Toe only. Do such a remapping once after port up this feel provide additional protection against inadvertent genius. This table shows the peoples are put routing options. Take an example off TX signal off the rt, which is attached to us a six by default. It can be remarkable to any pin off port. Be on Porc. In case you want to remap the PX signal to our B seven. He out the right people registered off. Devise pin RB seven, which is our B seven PPS with zero Rx 10 each. I will pin has a people's register named with a pen name like our Xie PPS here. Accent. Why are the port on bit? Identify IRS for our B seven pin off Would be it becomes RB seven PPS. So by writing zero x of 10 to R B seven PPS register. I am so you will remap the PX signal to R B 17. Now I will demonstrate how this can be done for I nt peripheral in the previous example. Hard explained how to use. I ended up in to generate interrupts I will remap di nt feature to our before which by default works on R B zero. We have already tested it in the previous quoting example. First, check the people's registered off TNT, which is I nt PPS. This I nt can be remembered only too opens off Port B and 40 are the cunning. This is to our before been on I will map di nt feature to our before pin No, open the project file off interrupt which we did in the last lecture Now to remap i nt to our before I need to write i nt PPS register with zero x zero c Here I will ard the court for pin Solich. First, we need to unlock PPS by following a special sequence. So right 06 55 on, then directs Yea two PPS lock register. After that Clear PPS locker bit off PPS lock register. Now I will write i nt People's Register with zero x zero C to remap I nt peripheral feature to our before pin. Then I must lock and a bit again by following the same sequence and then said PPS Lockerbie important is making our before on imports signal. So I will do that here also I have to enable the week Philip, that's all. I will build a cooled and then Corporan piece the hex file. I'm really excited to check the result here. I praise the sitch. Amazing happiness can be explained when it works as per the court. I don't believe it's really working. Let me check it again. I will re map I nt feature toe. Yeah, that is evil. Okay, so I just how to update i nt PPS register with 000 and change are zero as input pin Let me build it on programmed Express board now I will coming the speech to our A zero Yes, you Everything is already know it's barking. I should work for everyone I have explained on important feature called peripheral pin Select How used that to map I nt feature from RB zero ur before Then I check it again by moving it toe Aria zero. That's all I have in this video. See you, Decker 23. 20RAOINTPPS MCC: Hi Now, Misty in my previous video, Hard explained you about peripheral pin select for I enter feature. I have been writing course in a conventional be by your refering date Usher's for those who are allergic. So that method on for all those who fail it difficult to do it. There is a simpler way to get never with this. Yeah, I'm Philip core configuration. I will show you how things can get easier with the MCC first creating new project in AM blab on then state of a launch MCC tool. Well, here in the device resource look owt for actual interrupt on double click on E x t I nt to our dark model to our court. No, you can see that Interrupted Started your project resource under peripherals. Click on pin Manager agreed, which shows that national interrupt is mapper two r b zero by default. But I want it on our A zero. I cannot directly change it here on the grid manager in the current washing off MCC, maybe future versions, although us to do it from grid manager itself. I will maximize this window for you to have a good look at it. so that shows few options for directional interrupt. I need to enable the week pull up to remap i nd feature toe are a zero click this register button that shows all the registers in connection with the interrupter. Look out for I NT People's Register, which contains zero XB by default to map RB zero I will change it 2000 to remap you are a zero. It's that simple again. Come back to easy set up check that week Pullup is checker like me Minimize this on here It shows that they interrupt. Feature is attached to rd zero I will make are these eras and output pin for led by locking this bit off Port city again Goto primordial. And now check and our put option for our day zero on Antic Donal Logue Option Once check the system model for the US later options. I need internal oscillator at one megahertz. Then say the settings to your file. Then hit generate button Wait for few seconds. Still are MCC genders. The library files and then close them sissy. Now open main Darcy file, which contains required initialization courts in the system initialized system initialized will have few more functions to initialize. Beans asked leaders on extra interrupt. Being the manager initialized Will. How course Who said Tries dude Lots and the log select open drain and weak pullup registers . Asked for the options we have given in MCC I don't need this week Pull upon our Braziel Check this court which mainly maps I nd feature to rd zero The court for unlocking and locking People Register is generated by MCC so you don't have to waste your time on this. No, come back and check what is there in external interrupt initialized. It has few definitions to clear the interrupt flag Enable interrupt and also to set the raising itch. Now, if you check on dying top manager here, it has an A Yes, our with checks for Die India flag to decide the interrupt source Onda calls a function If you navigate to the function definition, it opens txt in Darcy on it has a statement to clear Die India flag. It calls the interrupt handler but is situated here. We have to our our court here. First, I will write the court in the main program to check variable limbs. Start and then turn on or off the led at our 20 here Start is declared outside the main program. So it is a global variable. Now in the axle in conduct. See, I will talk to start variable each time there is an interest. So right, the core in the interrupt handler, then a delay of 300 milliseconds to eliminate switch. Debussy start is a global variable declared in Maine. Darcy. In order to access it in this file, I have to declare it does on external variable. That delay I miss function makes use off crystal frequency, which is defined in the NCC dot ph file. So I must include the MCC Dark edge header file in this sea file. In order for this delay, Amos functions to work. One more important point is to clear I ntr flag after interrupt. Handler, this will clear the flag just before the U. S. Are is terminated and eliminates the possibility off multiple in trips caused by switch d Bonzi. Last but not the least. Don't forget toe uncommon. This global interrupt enable yells. Nothing is going to happen when the switch is pressed. That's all. Now build a court and copy and paste the hex file to express board. Check that the hardware response to switch evens. As for the court written, there's no one can write accord without even bothering a boat and data shoots on various registered weeps. MCC will do it for you. So you just have to concentrate on actual courting hope This helps you on these. You're learning process. See you in the next video. Take care. Bye. 24. 21IOC: no Misty. In this lecture, I will explain about one feature that release a program must job. I'm talking about interrupt on change. That means whenever there is a change in the logic level on the signal off it pin it generates an interrupt. If this feature is enabled on that pin, every pins off all ports can be configured to operate as an interrupt on change mean except for treaty. The model detects every time there's a raising edge or falling edge off the signal to generate. I was he. The model has features like I was then able Master Switch. Individual pins can be configured, rising and falling edge detection on interrupt flags for each and every pins To enable this model I WASI interrupt enable Bit must be set in p i. E zero register. Unusual pins can be configured by using positive edge detection and negative edge detection registers to enable rising edge detection on up. In the corresponding bit off, I will see XP register must be set similarly negative. Urged detection can be enabled by configuring. Are you all see x he and register here X represents the port the days yea for party the bits off I will see XY f register indicate the status off in dropped flags Days bits are sick. If there is a signal change detection on corresponding port pins on interrupt is generated . If I will see I e bit is said that I will see I you have bit off p i r zero register indicate dine drop status off all I will see x fbx The individual interrupt flags must be cleared in the software by resetting them to zero interrupt on change. Interrupt can wake up the device from sleep more. This is the block diagram off. I was a model for party Rx is the port e a pin? On day you will see a P X on I will see and next are the bits that enable the positive and negative edge detection on that particular I open The positive and negative edge is detected on cue to clock signal on the logical are off positive and negative Edge 100 takes will be processed ID in the Q four Q one clock signal any changing signal off. Five. Open off Portier. Well, said the corresponding flag in the oval CF register. If I will see IE but they said then it genders and interrupt to Cebu. We must clear this flag before we exit from Ah yes, our tow Avoid repeated in trips for the single signal change even for each port and there are three registers to be set to configure. I will see the 1st 1 is positive. Sewage register to enable positive edge detection on airport when we need to set the associative bit in this register clearing this bit will disable interrupt for positive going edge Second register is negative. Registered VT is used to enable or disable interrupt for negative going edge. The third register is the interrupt flag register which reflects any positive or negative edge is detected or not. The register will be used to take on which I will open. There is a signal change which caused interrupt for example, If I will see off zero Betis it, then it indicates that the areas a roping off 48 has it changed in signal level. We can check whether it is positivity or negativity by reading the world age level off. Aria zero have the Pinar a zero reels logic low. Then it was a negative. Going edge? Yes, it was a positive going edge. All these three registers are present for all ports Which support I was a feature. These are the summary off registers. For I was he nor duck. We NATO said g I e bit in in Khan register on. I will see I e bit in p a zero register. In addition to the three registers, we discuss it with this much off theory. Let us go and do some programming first, create a new project in MP lab, then create in news main file Generate the required configuration bits on page them to the sea file first to configure Pinardi zero as an output pin for led connection. My values are a Dupin Taconic A switch to generate. I was in tripped. So we have to configure aria to as an input and also enable the week pullup No, I will configure the evos registers first clear that it was the flag corresponding to our dear to pin in on your see a off register, I'll enable the positive detection by sitting. I will see a P two on disabled The negative edge detection next high should enable that I will see I e bit in p i e zero register on, then the global interrupting able bit often contra system. Next, I will like on infinite Loop here that basically does nothing. I will blink the already connected to art zero whenever the switches president. So this is the yes, our that gets executed whenever there is an interesting the checkpoint drop source. I have to check the flag. I was here. You have to since switches connected to art it If this flag is said, let me blink the led once with a delay off one second. Don't forget to clear the flag by writing zero to it. Okay, that's all. No build accord and copper and place the hex file to explode aboard Second act the switches connected to argue to pin. Now let me press dosage. The already blinks when I leave the Fitch. Just absurd it again. Now I leave this to your imagination to identify the reason my duality brings only when the switch is released. Not when the switch is blessed. No, If you need a little bling the moment when the switch is president, what change is to be done in the court. This is the exercise for you. Just check that out. No, I will add some court here that blinks reality once when the city's president on blinks led twice when the switch is released, that means I really detect both positive and negative going edge. For this, I will enable the negative edge detection By setting this big, I will remove this cord on the use if statement to read aria to pin on the far Ito is zero . That indicates the falling edge has Akel. I will pass this court here which brings on the court only ones. If there is a rising edge the pin aria two reads high. So if our ego is equal to one, I will blink the lady twice with this part of the court. First, the RD zero will be high. Then it will be low after one second. Then it repeats it for the second time. Bill discord and again, copy and paste the hex file. Let me check what happens. No. So when the switch is president and led blinks once when the switch is released, it blinks twice. That means I was a feature can generate interrupt for both rising and falling edges off the signal on an input output pin. This feature is added one take off. I will seem over I entin drip by default I entities mapper two r b zero on can be remembered to port ea or be using very fertile been Celic whereas I was he is available for all poor pins except port. So remapping is not required for I will see i n t can detect either positive or negative energy at the time, but I will see can detect both rising and falling it That is the end off this lesson See in my next lecture 25. 23CLC 2Switches: no musty in this video, I'm going to talk about configurable Logic, says Configurable. Logic cells provides a programmable logic, sir. Cute, which operators? Our third, the speed limitation off software execution. This basically means these logic cells run on hardware level in real time without any processor dependability. This results in high speed logic functionality on reduces processor intervention. The logic says. Take upto 32 input sources that include I've opens internal clocks very Pharrell's on register books. The output off these logic cells can be directed to peripherals Andi on output pin combination logics like on our eggs are on lattice like Asare, Jakey are included. This is the simplified block diagram off configurable logic cells. These are the different input sources that can be connected to logic cells using data selection gates. Out of these, only four signals can be connected to a partner logic cell at a time. The logic functionality can be selected using more bids. The signal from the logic function will be available if enable, Biti said on depends on polarity, but the are put off. The logic cell, then can be assigned to an output pin using PPS, or it can be connected to peripherals are also could generate in trips. This table shows the different import sources for the model. No, I will directly go toe programming to show you how CLC can be used for the given application. First, I will create a project in MP lab. After that, I will launch MCC. They use CLC model without worrying much about the registers on how to configure them before proceeding. Significant loss later selection for one megahertz, I will use the same configurations used in previous projects. Then here search for feel see under device resources, there are four CLC models CLC one, 23 and four Select CLC one by double clicking on now it shows up and the project resources and also here in the pin Manager greed The CLC has only four imports possible at a given time On these indicates the default selection Select our A zero for C l C I n zero input on here The clc out. You may select any port pin off 40 a or C. I will use our C zero for CLC out and the easy set up here enable the CSE on I will learn to use interrupt in this example. This shows the more for logic cells, and there are a few options for us to select from. I will use for input and get the anger views a logic I only if all affairs imports are high out of these, I will use only twin purse CLC in zero and CLC in one. I'll connect the first input, so this are get with the remaining imports unconnected that will keep those unconnected imports grounded. Therefore, the or gate acts like a buffer, bypassing your sin. Put toe the input of the and get. Similarly I will connect the CLC in 12 2nd argued and should off these two. You could also connect them toe to inputs off a single argued now here to more imports off and get can be disabled by changing these two, as Knorr gives, which provide logic high signals by default in pin manager Agreed. See that you know the CLC in one is assigned to Port Ari. One Next president Generate button on MCC generators the required course. I'm a large. Write anything inside the lie loop. Now build the court before copying the hex file. I will do the require connections. I will use one more switch on connect one end off the switch to ground and the other terminal to aria zero. The second switch has to be connected to Aria one. These two features are used to apply the logic signals to the inputs off and get that's which is applying a logic low signal when precedent. Now copy and paste the hex file to the express board and led will be on on whenever it switches president. It will turn off because when the switch is present, it will play logic lost signal to the input off on gate on Get gives a low output signal to turn off duality. This behavior can be nurtured by enabling the murder of the are get and hence no. The and gate gets a logic high signal. When the switch is blessed against 100 accord on. Then build a court. No, see that Fidelity's off on remains off even when you press the switch. But if you press both switches simultaneously, then the undergird gets a logic high signal at theirs, doing both on hence led tons on absurd AC. These are done it hardware level on processor has nothing to do with it. To get a clear cut idea about CLC, I will do one more experiment here. I will make rd zero as an our foot in the PIN Manager agreed. Disabled analog function on Rename It for easy reference, as are the zero led seven gender decor. Next in the Pin Manager dotage header file copied this rd zero led set high definition on Based It Inside of I look, give a delay and then copy and paste the RD zero led said Look, I can give a dealing. This court is to blink the already connected to Artie zero pin now again build a court and the hardware connected led to rd zero with the syriza sister No copy and paste the X file to the express board. Okay, Del, it is blinking because off the court, this led is controlled by the software part no president switches and check that r C zero tons on when both switches are pressed together. The second led is controlled by the CLC which is implemented in the hardware off microcontroller The logic Selous configure using the court. But its operation does not affect the art. Zero led blinking Notice. That and RTZ reality blinking will not pause or the switch blessings are not slowing down the little bling court, So CLC is very useful when you want to control peripherals on real time. There would not be any spirit limitations off software execution. I hope you got some idea board configurable logic cells. The use off CLC for an application mainly depends on the imagination. Off programmer to solve the problem CS is a new feature introduced in the recent Big Isis. Please come in your questions and doors. I will definitely answer your queries Syrian The next video. 26. 22IOCwithMCC: no Misty. In this video, I will show how to use the MCC to generate the court for interrupt on change on Aria to pin off first launch M. Philip on creating new project, then launch M Philip Core configuration in the PIN Manager Greed lock bit two off 48 as input to connect Yes, which on the lock bit zero off Port de as our put to connect led at already zero After this select pin model under project resources here, uncheck the and log on select output for rd zero for aria to select week pullup under to enable I was the feature click on the drop down menu and select the required option. There are four options. The 1st 1 will disable like we'll see feature Select the one from the drop down list to enable both positive and negative edge detection Once check the system model for the configuration bits mainly the oscillator selection as internal oscillator at one megahertz . No, Siri it on. Hit the general button and wait till all the files are created. And then close the MCC open the main file system initialized which has been the manager initialized andare Slater initialized functions. Check initialize, which contains court for initializing aria to pin as input on rd zero as output second a week pullup enable on our these lines. Clear the USA flag off. Hurry to on enable positive and negative edge detection. Finally there is I will see Interrupt enable This line indicates they interrupt Handler which will be executed when there is an interrupt on change off signal. Honor it. So we need to write the court for a yes are here. I'll read the court to detect negative image by checking Aria to pin off 40. If our E two is equal to zero, I will bring the led ones else. If there is a positive image, I will bring the led twice for delay a mess function. I will include MCC dot edge header file Now come back to pin Manager Darcy after the initial ages in court here it shows spin manager Yes. Are which checks the using flag off? Are they do on If it is said it will call a function named I will see off to Ah yes, are the called function in turn calls the interrupt handler which we have written then it clears the USA flag off are you, too? By writing zero to it when the interrupt manager Dorsey file where the default I Assad is written this idea saris exuded whenever there is an interrupt from any of the sources it checks. I was here your flag on definitely said it calls the pin manager. I will see function now We need to uncommon this line to enable Global in tripped save the file and build it. Once build is successful, copy and paste the hex file. So the express board. Now it's time to check the working off the court in the harder they're soul. See you in the next lesson.