724
// Main Routine void main(void) { // Peripherals & IO Configurations SPI_Master_Init(); // Initialize SPI as Master @ Fosc/64 SCK uint8_t Data = 0; // Data Byte TRISB = 0x07; // RB0, RB1 & RB2: Input Pins (Push Buttons) TRISD = 0x00; // Output Port (4-Pins) PORTD = 0x00; // Initially OFF while(1) { // Increment Data Value if (UP) { Data++; __delay_ms(250); } // Decrement Data Value if (Down) { Data--; __delay_ms(250); } // Send Data Value Via SPI if (Send) { SPI_Write(Data); __delay_ms(250); } PORTD = Data; // Display Current Data Value @ PORTD } return; }