Created
June 11, 2012 15:43
-
-
Save TAUTIC/2910753 to your computer and use it in GitHub Desktop.
PIC18F14K50 Blink example - Compatible with MPLAB X
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Be sure to include a linker file for the PIC18F14K50, I use the rm18f14k50.lkr file in the USB - Mouse demo firmware folder available in the Microchip Application Library download. (see http://www.microchip.com/mal) | |
#include <p18f14k50.h> | |
#include <delays.h> | |
//Bootloader support code start | |
extern void _startup (void); // See c018i.c in your C18 compiler dir | |
#pragma code REMAPPED_RESET_VECTOR = 0x1000 | |
void _reset (void) | |
{ | |
_asm goto _startup _endasm | |
} | |
#pragma code | |
//Bootloader support code end | |
void main (void) | |
{ | |
TRISC = 0; | |
LATC = 0; | |
LATCbits.LATC4 = 1; | |
LATCbits.LATC5 = 0; | |
while (1) { | |
Delay10KTCYx(250); // Delay 2,500,000 cycles | |
LATCbits.LATC4 = !LATCbits.LATC4; | |
LATCbits.LATC5 = !LATCbits.LATC5; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment