You are on page 1of 2

#include <16f877a.

h>
#fuses XT,NOWDT,NOPROTECT,NOLVP,PUT,BROWNOUT
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
#use standard_io(B)
#use standard_io(D)
#define
#define
#define
#define

LCD_DB4
LCD_DB5
LCD_DB6
LCD_DB7

PIN_D4
PIN_D5
PIN_D6
PIN_D7

#define LCD_RS
PIN_D2
#define LCD_RW
PIN_D1
#define LCD_E
PIN_D3
#include <lcd1_C.c>
char Keypress=0x00;
#int_rda
void rda_isr() {
Keypress=0x00;
if(kbhit()){
Keypress=getc();
}
}
void main() {

output_B(0b00000000);
lcd_init();
enable_interrupts(int_rda);
enable_interrupts(global);
printf("\r\n\LED Commander\r\n\r\n");
do {
// CONTROL DESDE LA RS-232
if(Keypress!=0x00){
switch(Keypress){
// Periodos Prefijados
case '0': output_B(0b10101010);
delay_ms(500);
output_B(0b01010101);
lcd_putc("\fSECUENCIA 1 ");
break;
case '1': output_B(0b11110000);
delay_ms(500);
output_B(0b00001111);
lcd_putc("\fSECUENCIA 2 ");
break;
}
Keypress=0x00;

}
}
while (TRUE);
}

You might also like