Are you sure 40 MHz Fosc will work for that device. Try 4 MHz Fosc.Hi, thanks for your reply.
This is currently the simple code Ive got going and the circuit schematic essentially.
p.s. sorry for the bad formatting. Hopefully you can make some sense of it.
/*
* File: main.c
* Author: burt
*
* Created on August 20, 2017, 4:41 PM
*/
// CONFIG
#pragma config FOSC = INTRCIO // Oscillator Selection bits (INTOSC oscillator: I/O function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN)
#pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled)
#pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled)
#pragma config MCLRE = ON // RA3/MCLR pin function select (RA3/MCLR pin function is MCLR)
#pragma config BOREN = ON // Brown-out Detect Enable bit (BOD enabled)
#pragma config CP = OFF // Code Protection bit (Program Memory code protection is disabled)
#pragma config CPD = OFF // Data Code Protection bit (Data memory code protection is disabled)
// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.
#define _XTAL_FREQ 4000000
#include <xc.h>
void main(void) {
OSCCAL= 0b11111100;
TRISC0 = 0; //RC0 as Output PIN
while(1)
{
RC0 = 1; // LED ON
__delay_ms(1000); // 1 Second Delay
RC0 = 0; // LED OFF
__delay_ms(1000); // 1 Second Delay
}
return;
}
XC8 and also C18 compiler uses #pragma directive for config words. Hi-Tech C doesn't use.Which C compiler are you using?
xc.h is used by the microchip XC8 compiler.