Skip to content

Instantly share code, notes, and snippets.

@TAUTIC
Created June 11, 2012 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TAUTIC/2910753 to your computer and use it in GitHub Desktop.
Save TAUTIC/2910753 to your computer and use it in GitHub Desktop.
PIC18F14K50 Blink example - Compatible with MPLAB X
//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