Skip to content

Instantly share code, notes, and snippets.

@DexterHaslem
Created November 13, 2022 23:27
Show Gist options
  • Save DexterHaslem/7ba868bb04b8fa908b98389451d974ed to your computer and use it in GitHub Desktop.
Save DexterHaslem/7ba868bb04b8fa908b98389451d974ed to your computer and use it in GitHub Desktop.
#include <xc.h>
#pragma config FOSC = INTOSC // Oscillator Selection bits->INTOSC oscillator: CLKIN function disabled
#pragma config BOREN = ON // Brown-out Reset Enable->Brown-out Reset enabled
#pragma config WDTE = ON // Watchdog Timer Enable->WDT enabled
#pragma config PWRTE = OFF // Power-up Timer Enable bit->PWRT disabled
#pragma config MCLRE = ON // MCLR Pin Function Select bit->MCLR pin function is MCLR
#pragma config CP = OFF // Code Protection bit->Program memory code protection is disabled
#pragma config LVP = ON // Low-Voltage Programming Enable->Low-voltage programming enabled
#pragma config LPBOR = ON // Brown-out Reset Selection bits->BOR enabled
#pragma config BORV = LO // Brown-out Reset Voltage Selection->Brown-out Reset Voltage (Vbor), low trip point selected.
#pragma config WRT = OFF // Flash Memory Self-Write Protection->Write protection off
void main(void)
{
TRISA = 0x03;
ANSELA = 0x07;
// LFIOFR 31.25KHz_osc_not_ready; HFIOFS unstable; HFIOFR 16MHz_osc_not_ready; IRCF 500KHz;
OSCCON = 0x20;
// WDTPS 1:16384; SWDTEN OFF;
WDTCON = 0x12;
while (1)
{
LATAbits.LATA2 = ~LATAbits.LATA2;
SLEEP();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment