#include <16f877a.h>

//sets the clock speed for the microprocessor
#use delay(clock=20000000)
//configures pins c6 and c7 for UART communication with the terminal
#use rs232(baud = 9600, xmit = pin_c6, rcv= pin_c7)

// defines pin C0 as sw1 for easy reference
#define sw1 pin_c0
//defines pin b0 as LED for easy reference
#define LED pin_b0

void main()
{
   set_tris_b(0x00);// configures port B as an output
   output_b(0x00);// sets port B to start low

   while(TRUE)
   {
      /*
      when input sw1 is pressed, prints LED ON in the virtual terminal, and 
      turns on the pins located on port B, turning on the LED
      includes a delay of 100 milliseconds to not flood the terminal with 
      inputs.
      */
      if(input(sw1)){
         printf("LED ON\r\n");
         output_high(LED);
         delay_ms(100);
      }
   }

}
