PIC Microcontroller Programming Tutorials – Part 1

PIC Microcontroller Programming Tutorials - Part 1



hello everybody welcome you all to the robotic systems pic microcontroller video programming tutorials before you start please do install the software so that you get in our CD micro C Pro for fake and fix him later ID and win pick on now let's get started first let's start the LED blinking program now double-click on the micro see icon the define in the desktop you'll see the micro C Pro launch the micro see is a very nice IDE with an very user friendly and it has got nice cool features there is it is ID and I'll be explaining all the apps and all the menus that you will be having here so first let's start a new project go to project new project I will see the project with a launch go to next and here you can choose a microcontroller that you're working with now we are using pic16f877a it as a test and if you're using 20 you put it as 20 using 4 previous 4 then click Next choose the location for your project here I've created a folder called as micro see in my desktop so I'm going to store my files there and I'm going to open another new folder will be LED blinking and the project name will be delivering I'm gonna save it next next finish you will see the default what main block generated before I start you let's before we start programming let me introduce you to the pic simulator ID pixelate ID is this oceans of pic simulator the trial ocean that you get on a CD please double click on it to start else's message click ok and this is the Pixelmator ID you could access all the registers see what's happening inside pic and a very good simulator alright oh you've got the first good options and how to select micro controller you will see a list of micro controller this mostly for pic – LF and section of series and we are going to use pic16f877a for a is the better is the latest version like 16 f8 for click select and then go to options if you have this compact macro control of view or check please uncheck it and then go to tools microcontroller view there you go you see the microcontroller now let me explain this microcontroller to you click 16 f8 four or six six eight four a has two ports basically a port a and port B port a has five pins as you see are a 0 2 or a 4 is a port B and or B naught 2 RB 7 is a port B and also you have the power supply vs s and V DD and you have mclr as mclr is something specific to pick you have to pull it hive the 10k resistor in order to for the program to start running and this is the clock oscillator very good the clock pulse input remember we selected 10 we say we selected 10 megahertz while we were setting up the project that is what the 10 Rockets crystal will be connecting it here and you have this project settings here you can go ATP or projects it isn't any time also you have a code Explorer if you have some functions and global includes you can just select it access it easily from here and you have a library manager where you have lots of cool inbuilt C libraries hardware libraries and in has a routine list the project manager where you can manage projects find files inside the projects you are coming back to the pic microcontroller is a simulator ID ra0 or port a in any micron any pic microcontroller will be usually usually contain analog to digital conversion converters internal analog digital converters would be as a digital put can use it either for digital input or digital output also the analog put put a can we use for digital signals as well can also configure it to get as digital inputs or digital outputs alright that's it about that's a brief introduction about pic microcontrollers now let's start programming masada program you will get a default void main block that is where the main block is is where the code runs in NEC program that is where the code is being executed so let's let me lick Oh what is my objective here I am going to make the port be LED blink on off on off so my requirement would be I am going to define port BS output how do i define port bs output there is a register call as Chris registers pris pris is common and can either used for configuring port a eustress a or if a configure import B eustress B is equal to 0x zero zero zero now I can't forget put BS output now if you want to configure port B as input use zero x FF now wondering why I'm using something weird like 0xff we normally use numbers to define a now let me explain now if you're working on Windows go to start all programs you go to accessories and go to calculator now if you want to view the scientific you just click view scientific you'll get this scientific thing here so let me put 0 X F F let me convert it to the decimal number system that we normally use in our daily life is 255 now let me convert into binary this is where this is the interesting part the converted to binary you see or you see you see all ones that means configuring port via twist be equal to 0 X F F will make the port as inputs now let me configure it as outputs 0 X 0 0 so put 0 0 here click on X zero-zero then click on binary you get the zero right now Pig doesn't have an operating system something has to tell the coal that it is run again and again so inside most programs you will see in never running loop this case is going to be wild one this room loop will run forever when the course starts running first the pic executes tryst B equal to 0 x0 0 it will see it 0 0 0 so it makes a port B as outputs output and then it will come here while 1 the code inside this part will be running forever so let me make LEDs in port B go high port B is equal to 0 X F F here is interesting but what's F F now let me do that again FF cannot endure binary this will make port B is led all LEDs glow from here remember this is the most significant bit rb7 is the most significant bit it stop a bit r b6 r b phi r before all leds would glow

Comments

  1. Avi Jain

    I am Avi Jain and need help in making a project

    Which includes interfacing a usb keyboard along with 3stepper motors to make a machine which can write on paper with the help of cnc the letter we type from keyboard.. 

    For more convenient chat we can talk more about it on what's app.

    +919977994935

  2. Don G

    i really love this….but how can i get a full video of this . i am a beginner in programming , i need the detail and of course tutorials like this especially about micro basic compiler and how to programme some IC please .thanks

  3. arunvijaykg

    Hey thanks for the comment man.. Lowsperm81 is just a ridiculous bigot. I am from India and live in the United States right now and I love it and there isn't an inch of hate in my heart. There are unreasonable bigots in every part of the world, not just America. People here don't have a problem with my accent, I have been appreciated many times for speaking good English. So I really don't take hate comments seriously like before, because they mean nothing to me..

  4. Rahul Jhuree

    People like you are the reason people hate America. Why? Because this guy came from a place where there are much less opportunities to learn things like this, yet he put in the effort to get this far and share it with us. He comes from a place that is much more unfortunate than you, yet you still have the nerve to troll him?
    All you've done by writing that comment is shown to over 120 thousand people how bad america is

Leave a Reply

Your email address will not be published. Required fields are marked *