#include "configurationbits.h" // PIC18 in C - Versione 0.2 - December 2014 // Copyright (c) 2014, Vincenzo Villa // Creative Commons | Attribuzione-Condividi allo stesso modo 3.0 Unported. // Creative Commons | Attribution-Share Alike 3.0 Unported // https://www.vincenzov.net/tutorial/PIC18/hello-2.htm // Reference - PIC18F25K20 data sheet // PORTC, TRISC and LATC Registers - Page 127 -> // REGISTER 2-1: OSCCON: OSCILLATOR CONTROL REGISTER - Page 29 // Reference - PIC18F2431 data sheet // PORTC, TRISC and LATC Registers - Page 119 -> // OSCILLATOR CONTROL REGISTER - Page 36 #define LED LATCbits.LATC0 #define CONFIG_PORTC TRISC = 0b11111110 // Set RC0 as output; RC1 -> RC7 as input #define _XTAL_FREQ 1000000 // Must match the settings in PIC18F25K20 OSCCONbits.IRCF - See data sheet! //#define _XTAL_FREQ 32250 // Must match the settings in PIC18F2431 OSCCONbits.IRCF - See data sheet! void main(void) { CONFIG_PORTC; // Configure PORTC while (1) { // Forever LED = ~LED; // Reverse led status __delay_ms(250); // Wait for 0.5 second } }