0% found this document useful (0 votes)
18 views3 pages

Pic Mplabx Procedure

Uploaded by

Deepali Patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views3 pages

Pic Mplabx Procedure

Uploaded by

Deepali Patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

STEPS TO BE FOLLOWED FOR PROGRAMMING WITH PIC

1. MPLAB X Programming IDE.


Step1: Creating a new project
 Go to the File Tab.
 Click on New Project.
 Step1: Choose Project:
 Select: Microchip Embedded -> Standalone Project. Click Next.
Step2: Select Device:
 Select: Family -> Advanced 8 Bit MCU (PIC18).
 Select: Device: PIC18F4550. Click Next.
Step3: Select Tool: Simulator. Click Next.
Step4: Select Compiler ->XC8. Click Next.
Step5: Select Project Name and Folder.
 Give Project Name.
 Select project Location using Browse Button.
 Uncheck Set as main project option.
 Click Finish..
Step6: Creating a new Source file and Header File.
 Go to the Project location in the Project window.
 Click the + sign to open the project space.
 Right Click on the Source Files folder (for a C file) and Header files (for a .h file).
 New - > C Source file / or C Header File.
Step7: Opening an existing project.
 Go to the File Tab.
 Select Open Project.
Browse to the location and select the project name.X file (project file). Click on Open
Project
2. Adjusting application for Boot loader.
Step 1: Go to Project window and Right Click on the Project folder.
Go to Properties.
Select XC8 linker.
In Option categories ->Select memory model.
In Code offset section type 800
Click Apply button and OK button.
3. Compiling Project.

Step1: Go to project window.


 Right Click on the project folder and select Build or Clean and Build.
Step2.Executable Flashing Tool (PICLoader.exe).
 Connect the USB Cable to the Board.
 Double Click the PICloader.exe.
 Go to Programs -> Settings.
 Select the USB or serial com port. Click OK.
Step3: Go to Programs -> Break/Reset Mode or Press F3.
Step4: Press the Reset Switch on the Micro-PIC18F Board.
Step5: Go to Programs ->Bootloader Mode or Press F4.
Step6 : Select Hex file :
File -> Open -> Browse to location.
Project folder -> dist -> default->production.- Double click on every
Step7: Go to Programs -> Write Device or Press F6
Step8: Press Reset on the board to Run the program.
SE[IT] Processor Architecture

Assignment No.1: Addition of two 8 bit Nos:

#include <P18F4550.h>

void main(void)
{
Unsigned int i, j, x;
TRISB=0; // port b as O/P
LATB=0;
i=0x04;
j=0x05;
x=i+j;
PORTB=x;
PORTC=i;
PORTD=j;

Out put : Address Name Hex Decimal Binary Char


F81 LATB 0x09 09 00001001 “-“

How to see the Result


1. Write the program
2. Debug the project – Check for the errors
If No errors – Build successful will appear on the OUTPUT window
3. Go to Debug window ---Discreet debug operation
—build for debugging
- Launch for debugger option
- For single stepping press F8
4. To see the result: click on Window tab on Navigation bar
 Click on PIC Memory Views
 Select option required
 Window will appear go to required location and
observe the result by doing single stepping

2 DEPARTMENT OF ELECTRONICS AND TELECOMMUNICATION ENGG


SE[IT] Processor Architecture

Program2: Flashing of Alternet LEDS connected to port B

#include <P18F4550.h>
void T0Delay(void);
void main(void)
{
TRISB=0; // configure Port B as output
While(1)
{
PORTB= 0x55; // load Bit Pattern
T0Delay ( );
PORTB= 0xAA;
T0Delay ( );
}
}
void T0Delay ( )
{
T0CON=0x08; // Timer0, 16 bit, no prescaler
TMR0H=0x9E; // load Higher byte in TMR0H
TMR0L= 0x58; // Load Lower byte to TMR0L
T0CONbits.TMR0ON=1; // start the timer for upcount
While(INTCONbits.TMR0IF==0); // Check for overflow
T0CONbits.TMR0ON=0; //Turnoff timer
INTCONbits.TMR0IF==0; // clear the Timre0 flag
}

3 DEPARTMENT OF ELECTRONICS AND TELECOMMUNICATION ENGG

You might also like