Sie sind auf Seite 1von 3

Program Code:

The program code which is dumped in the microcontroller of our project is shown below. #include <16F72.h> //Microcontroller Used #include <tsop1738.c> //For IR Receiver

#fuses HS, NOWDT, BROWNOUT, PROTECT, PUT #use delay(oscillator=20M)

void dowork(int var) {

if(var == 3) // device 1 ON { //Dev1 ON output_high(PIN_C3);

} if(var == 7) //device 1 OFF { //Dev1 OFF output_low(PIN_C3);

} if(var == 4) //Program up 16 { //Dev2 ON


1

output_high(PIN_C7); } if(var == 8) //Program down 17 { //Dev2 OFF

output_low(PIN_C7); } }

void main() {

int code = 0;

//Microcontroller Health Check

output_high(PIN_C3); delay_ms(1000); output_low(PIN_C3); delay_ms(1000); output_high(PIN_C3); delay_ms(1000); output_low(PIN_C3); delay_ms(1000);


2

while(1) {

code = Get_TSOP_Data(); //Receive Data from IR Receiver

dowork(code);

output_toggle(PIN_C3); //Blink LED for Indication purpose

} }

Das könnte Ihnen auch gefallen