Pic microcontroller step by step your complete guide

24
y Ashraf AlMadhoun y Ashraf AlMadhoun echatronics Engineer https://www.udemy.com/master-pic-m protuesprofessional/learn/?couponCod microcontroller-using-mikroc- de=limitedoffer50off

Transcript of Pic microcontroller step by step your complete guide

Page 1: Pic microcontroller step by step your complete guide

By Ashraf AlMadhounBy Ashraf AlMadhoun

Mechatronics Engineer

https://www.udemy.com/master-pic-microcontrollerprotuesprofessional/learn/?couponCode=limitedoffer

microcontroller-using-mikroc-protuesprofessional/learn/?couponCode=limitedoffer50off

Page 2: Pic microcontroller step by step your complete guide

How to install ProteousIn this lesson you will learn how to install Proteus Software which is used to make electric circuit simulation and will be used mainly to test your code using PIC Microcontroller Simulation.

First Step is downloading the Software From this Link:First Step is downloading the Software From this Link:

http://1drv.ms/1OpVxOB

http://www.mediafire.com/download/pfisM89.zip

Now extract the file using Winrar Software.

Do exactly like what I do in these steps to get the software up and running.

https://www.udemy.com/master-pic-microcontrollerprotuesprofessional/learn/?couponCode=limitedoffer

Proteous Professional In this lesson you will learn how to install Proteus Software which is used to make electric circuit simulation and will be used mainly to test your code using PIC Microcontroller Simulation.

First Step is downloading the Software From this Link:First Step is downloading the Software From this Link:

http://www.mediafire.com/download/pfis93kmq85s0es/P.8.3.SP2_EngAS

Software.

Do exactly like what I do in these steps to get the software up and running.

microcontroller-using-mikroc-protuesprofessional/learn/?couponCode=limitedoffer50off

Page 3: Pic microcontroller step by step your complete guide

How to Install MikroC Pro for PIC Programming MikroC is the programming interface software in which we will write our code in c language to communicate with PIC Microcontroller, using this software it will be really easy to compile and run the code and get a .hex file which will be used in Proteus simulation or can be burned to PIC file which will be used in Proteus simulation or can be burned to PIC Microcontroller using a certain type of programmers that we will talk about in next chapter.

To Download the software use this link:

Now do exactly like what I do to get the software up and Running.

https://www.udemy.com/master-pic-microcontrollerprotuesprofessional/learn/?couponCode=limitedoffer50off

Pro for PIC Programming is the programming interface software in which we will write our

code in c language to communicate with PIC Microcontroller, using this software it will be really easy to compile and run the code and get a .hex file which will be used in Proteus simulation or can be burned to PIC file which will be used in Proteus simulation or can be burned to PIC Microcontroller using a certain type of programmers that we will talk

To Download the software use this link:

Now do exactly like what I do to get the software up and Running.

microcontroller-using-mikroc-protuesprofessional/learn/?couponCode=limitedoffer50off

Page 4: Pic microcontroller step by step your complete guide

MikroC and Proteous First Design and Program In this lesson we will make a simple circuit to get everything up and running to start building beautiful things using PIC Microcontroller.

This circuit will include PIC microcontroller and writing a simple code to test all ports and turn these ports on and off.test all ports and turn these ports on and off.

You will be introduced to TRIS register.

You will be introduced to Hex files.

https://www.udemy.com/master-pic-microcontrollerprotuesprofessional/learn/?couponCode=limitedoffer

First Design and Program In this lesson we will make a simple circuit to get everything up and running to start building beautiful things using PIC Microcontroller.

This circuit will include PIC microcontroller and writing a simple code to test all ports and turn these ports on and off.test all ports and turn these ports on and off.

You will be introduced to TRIS register.

microcontroller-using-mikroc-protuesprofessional/learn/?couponCode=limitedoffer50off

Page 5: Pic microcontroller step by step your complete guide

TRIS AND PORT Registers

https://www.udemy.com/master-pic-microcontrollerprotuesprofessional/learn/?couponCode=limitedoffer

TRIS AND PORT Registers

microcontroller-using-mikroc-protuesprofessional/learn/?couponCode=limitedoffer50off

Page 6: Pic microcontroller step by step your complete guide

How to deal with PIC Ports As we mentioned, PIC Ports are the physical connection used to allow communicate with the outer world.

It allows receiving signals from control devices to PIC, and sending signals from PIC to control devices.from PIC to control devices.

The full control over PIC Ports is achieved using TRIS and PORT registers which can be done using C programming Language.

https://www.udemy.com/master-pic-microcontrollerprotuesprofessional/learn/?couponCode=limitedoffer

How to deal with PIC Ports As we mentioned, PIC Ports are the physical connection used to allow

It allows receiving signals from control devices to PIC, and sending signals

The full control over PIC Ports is achieved using TRIS and PORT registers which can be done using C programming Language.

microcontroller-using-mikroc-protuesprofessional/learn/?couponCode=limitedoffer50off

Page 7: Pic microcontroller step by step your complete guide

How to deal with PIC Ports

https://www.udemy.com/master-pic-microcontrollerprotuesprofessional/learn/?couponCode=limitedoffer

How to deal with PIC Ports

microcontroller-using-mikroc-protuesprofessional/learn/?couponCode=limitedoffer50off

Page 8: Pic microcontroller step by step your complete guide

Necessary Connections (PIC16F877A) PIC can be bread-boarded, with the following important

connections:

Power

Ground Ground

Reset signal

Crystal (oscillator)

https://www.udemy.com/master-pic-microcontrollerprotuesprofessional/learn/?couponCode=limitedoffer50off

Necessary Connections (PIC16F877A)boarded, with the following important

microcontroller-using-mikroc-protuesprofessional/learn/?couponCode=limitedoffer50off

Page 9: Pic microcontroller step by step your complete guide

LED example: code//LED example program written for //PIC programming tutorial. From //(http://seniord.ece.iastate.edu/dec0604/index_files/tutorialDec//standard include files#include <stdlib.h>#include <pic.h>#include “delay.h”#include “delay.h”//main function

void main(){

PORTA = 0x00; //set RA0-RA5 lowTRISA = 0x00; //set PORTA to output//superloopwhile(1){

PORTA = ~PORTA;DelayMs(250);

}}

https://www.udemy.com/master-pic-microcontrollerprotuesprofessional/learn/?couponCode=limitedoffer50off

/index_files/tutorialDec0604.pdf)

low; //set PORTA to output

microcontroller-using-mikroc-protuesprofessional/learn/?couponCode=limitedoffer50off

Page 10: Pic microcontroller step by step your complete guide

Flasher circuit PIC Microcontroller We will make a flasher circuit in which a LED will light for 1 Second after that it will be turned off.

This process will be repeated This process will be repeated indefinitely.

https://www.udemy.com/master-pic-microcontrollerprotuesprofessional/learn/?couponCode=limitedoffer

Flasher circuit PIC Microcontroller

microcontroller-using-mikroc-protuesprofessional/learn/?couponCode=limitedoffer50off

Page 11: Pic microcontroller step by step your complete guide

Lighting Led follower In this example we will make all the LED’s light one after another with 1 Second delay.

After that the LED’s will light in a After that the LED’s will light in a reverse order from last to first.

https://www.udemy.com/master-pic-microcontrollerprotuesprofessional/learn/?couponCode=limitedoffer

Lighting Led follower

microcontroller-using-mikroc-protuesprofessional/learn/?couponCode=limitedoffer50off

Page 12: Pic microcontroller step by step your complete guide

Control Led using Push ButtonWe will make a program to light the LED for 10 Seconds when the button is pressed.

https://www.udemy.com/master-pic-microcontrollerprotuesprofessional/learn/?couponCode=limitedoffer50off

Control Led using Push Button

microcontroller-using-mikroc-protuesprofessional/learn/?couponCode=limitedoffer50off

Page 13: Pic microcontroller step by step your complete guide

Controlling Seven Segment using PIC Microcontroller

Make a Circuit to display counting from 0 to 9 then turn off.

https://www.udemy.com/master-pic-microcontrollerprotuesprofessional/learn/?couponCode=limitedoffer

Controlling Seven Segment using PIC

microcontroller-using-mikroc-protuesprofessional/learn/?couponCode=limitedoffer50off

Page 14: Pic microcontroller step by step your complete guide

Controlling Seven Segment using BCD Counter PIC Microcontroller

Make a Circuit to display counting from 0 to 9 then turn off.

https://www.udemy.com/master-pic-microcontrollerprotuesprofessional/learn/?couponCode=limitedoffer50off

Controlling Seven Segment using BCD Counter

microcontroller-using-mikroc-protuesprofessional/learn/?couponCode=limitedoffer50off

Page 15: Pic microcontroller step by step your complete guide

Controlling LCD using PIC Microcontroller Make a Program that writes “I’M THE KING OF Microcontrollers” on LCD Screen.Screen.

https://www.udemy.com/master-pic-microcontrollerprotuesprofessional/learn/?couponCode=limitedoffer50off

Controlling LCD using PIC Microcontroller

microcontroller-using-mikroc-protuesprofessional/learn/?couponCode=limitedoffer50off

Page 16: Pic microcontroller step by step your complete guide

Display and Move Text on LCD Make a Program that writes “I’M THE KING OF Microcontrollers” on LCD Screen and moves it to Right or Screen and moves it to Right or Left.

https://www.udemy.com/master-pic-microcontrollerprotuesprofessional/learn/?couponCode=limitedoffer

Display and Move Text on LCD

microcontroller-using-mikroc-protuesprofessional/learn/?couponCode=limitedoffer50off

Page 17: Pic microcontroller step by step your complete guide

Stepper Motor Control Make a Program to control stepper motor in such away to make it move 5 seconds in the left direction and 5 seconds in left direction and 5 seconds in the right direction.

https://www.udemy.com/master-pic-microcontrollerprotuesprofessional/learn/?couponCode=limitedoffer50off

Stepper Motor Control

microcontroller-using-mikroc-protuesprofessional/learn/?couponCode=limitedoffer50off

Page 18: Pic microcontroller step by step your complete guide

Dot Matrix Control Make A program that writes the letter A on the Dot Matrix.

https://www.udemy.com/master-pic-microcontrollerprotuesprofessional/learn/?couponCode=limitedoffer

microcontroller-using-mikroc-protuesprofessional/learn/?couponCode=limitedoffer50off

Page 19: Pic microcontroller step by step your complete guide

Keypad Interface and control with PIC Microcontroller

Write a program that shows the number you press on portd as binary number.

https://www.udemy.com/master-pic-microcontrollerprotuesprofessional/learn/?couponCode=limitedoffer

Keypad Interface and control with PIC

microcontroller-using-mikroc-protuesprofessional/learn/?couponCode=limitedoffer50off

Page 20: Pic microcontroller step by step your complete guide

Device Programmer Need device to store machine code

into PIC’s memory (EEPROM or Flash)

Can be external device, but ICSP is easier: Don’t have to remove chip from its Don’t have to remove chip from its

circuit Provides interface between computer

(USB) and PIC Specific to circuit (due to

interconnect scheme and surrounding circuit)

Communication protocol requires 5 signals

https://www.udemy.com/master-pic-microcontrollerprotuesprofessional/learn/?couponCode=limitedoffer50off

Device ProgrammerNeed device to store machine code

Can be external device, but ICSP is

Don’t have to remove chip from its Don’t have to remove chip from its

Provides interface between computer

Communication protocol requires 5

microcontroller-using-mikroc-protuesprofessional/learn/?couponCode=limitedoffer50off

Page 21: Pic microcontroller step by step your complete guide

Device Programmer

Five Signals:• Vpp (programming voltage)• Vdd (power)• Vss (ground)• IC SPCLK (clock)• IC SPDAT (data)

https://www.udemy.com/master-pic-microcontrollerprotuesprofessional/learn/?couponCode=limitedoffer

Device Programmer

microcontroller-using-mikroc-protuesprofessional/learn/?couponCode=limitedoffer50off

Page 22: Pic microcontroller step by step your complete guide

Slide 21

A1 Vpp - Programming mode voltage. This must be connected to the MCLR pin, or the Vpp pin of the optional ICSP port available on somelarge-pincount PICs. To put the PIC into programming mode, this line must be in a specified range that varies from PIC to PIC. For 5V PICs, this is always some amount above Vdd, and can be as high as 13.5V. The 3.3V only PICs like the 18FJ, 24H, and 33F series use aspecial signature to enter programming mode and Vpp is a digital signal that is either at ground or Vdd. There is no one Vpp voltage that is within the valid Vpp range of all PICs. In fact, the minimum required Vpp level for some PICs can damage other PICs.Vdd - This is the positive power input to the PIC. Some programmers require this to be provided by the circuit (circuit must be at least partially powered up), some programmers expect to drive this line themselves and require the circuit to be off, while others can be configured either way (like the Microchip ICD2). The Embed Inc programmers expect to drive the Vdd line themselves and require the target circuit to be off during programming.Vss - Negative power input to the PIC and the zero volts reference for the remaining signals. Voltages of the other signals are implicitly with respect to Vss.ICSPCLK - Clock line of the serial data interface. This line swings from GND to Vdd and is always driven by the programmer. Data is transferred on the falling edge.ICSPDAT - Serial data line. The serial interface is bi-directional, so this line can be driven by either the programmer or the PIC depending on the current operation. In either case this line swings from GND to Vdd. A bit is transferred on the falling edge of PGC.

1. Select device2. Load HEX file3. Program PIC

Author, 9/15/2015

Page 23: Pic microcontroller step by step your complete guide

Questions?

Skype: EngASM89Email: Email: Mobile: +972595399311

https://www.udemy.com/master-pic-microcontrollerprotuesprofessional/learn/?couponCode=limitedoffer50off

Skype: EngASM89Email: [email protected]: [email protected]: +972595399311

microcontroller-using-mikroc-protuesprofessional/learn/?couponCode=limitedoffer50off

Page 24: Pic microcontroller step by step your complete guide

Eng Ashraf Said AlMadhounMechatronics Engineer

972595399311

[email protected]@gmail.com

Skype: EngASM89

Join the Course nowLIMITED TIME OFFER50% OFFhttps://www.udemy.com/master-pic-microcontroller-using-mikroc-protuesprofessional/learn/?couponCode=limitedoffer50off

https://www.udemy.com/master-pic-microcontrollerprotuesprofessional/learn/?couponCode=limitedoffer50off

microcontroller-using-mikroc-protuesprofessional/learn/?couponCode=limitedoffer50off