You are on page 1of 2

#include "16f877a.

h"

#fuses XT,NoPROTECT,NoWDT #use delay(clock=4000000)

#define sensor PIN_A0 #define sw PIN_A1 #define buzzer PIN_C5 #define led PIN_C4

void main (void) { set_TRIS_C(0x00); set_TRIS_A(0xff);

while(1) { if((input(PIN_A0))&&(!input(PIN_A1))) { output_high(led); output_high(buzzer); } else if ((!input(PIN_A0))&&(input(PIN_A1))) {

output_low(led); output_low(buzzer); } else {

output_low(led); output_low(buzzer); } } }

You might also like