Proteus – PIC 18F Blink a LED

Your first Proteus PIC project – Blink a LED on port RD2 of a 18F4620

This is your first PIC project ever, blink a LED, yes, I know…

But it’s a great way to learn!


Proteus project

The board version

00058 (1)

Source code

// Main.c 

#include <xc.h>;

// Default output frequency of INTOSC on Reset will be 1 MHz
#pragma config OSC=INTIO67 // use internal oscillator - Depending on your PIC this could be: #pragma config FOSC = INTOSC_EC
#pragma config LVP = OFF // Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit (RB3 is digital I/O, HV on MCLR must be used for programming)

#define OUT 0
#define LED_PIN PORTDbits.RD2
#define END_OF_TIME 1
#define ON 1
#define OFF 0
#define _XTAL_FREQ 1000000 // needed for __delay_ms()

// This is the program entry point
void main(void)
 while (END_OF_TIME) {
 } // while END_OF_TIME
 } // main()

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: