// 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/hello-2.htm #include "configurationsbits.h" #define _XTAL_FREQ 1000000 // Must match the PIC clock #define MYDELAY 100 // 100 ms delay void main(void) { TRISC = 0x00; // Set all PORTC pin as Output while (1) { // Forever for (LATC=0b00000001; LATC != 0; LATC <<= 1) __delay_ms(MYDELAY); // Shift left, eight times for (LATC=0b10000000; LATC != 0; LATC >>= 1) __delay_ms(MYDELAY); // Shift right, eight times } }