// PIC18 in C - Versione 0.2 - Dicembre 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/hellorealworld.htm // Reference // PIC18F2431 data sheet - PORTC, TRISC and LATC Registers - Page 119 -> // PIC18F14K50 data sheet - PORTC, TRISC and LATC Registers - Page 90 (92) -> // PIC18F25K20 data sheet - PORTC, TRISC and LATC Registers - Page 127 -> #include "configurationsbits.h" #define LED_RED LATCbits.LATC0 #define LED_GREEN LATCbits.LATC1 #define CONFIG_PORTC TRISC = 0b11111100 // Set RC0 and RC1 as output; Rc2 -> RC7 as input void main(void) { CONFIG_PORTC; // Configure PORTC LED_RED = 1; // Turn on the red led LED_GREEN = 0; // Turn off the green led while (1); // Do nothing, forever }