Detector de Colores Rgb Con Pic 16f877a

DETECTOR DE COLORES RGB CON PIC 16F877A #include #device adc=10 #use delay(clock=4000000) #fuses XT,NOWDT,NOPROTECT,NOL

Views 219 Downloads 60 File size 106KB

Report DMCA / Copyright

DOWNLOAD FILE

Recommend stories

Citation preview

DETECTOR DE COLORES RGB CON PIC 16F877A

#include #device adc=10 #use delay(clock=4000000) #fuses XT,NOWDT,NOPROTECT,NOLVP,NOPUT,NOBROWNOUT,NOWRT #include #byte portc=7 #use fast_io(b) #use fast_io(c) #int_ext void pulso() {int16 c,n,color1,color2,color3; float vol1,vol2,vol3; n=0; printf(lcd_putc, "\fPROCESANDO..."); delay_ms(500);

for(0;nvol3) {printf(lcd_putc, "\fColor reconocido"); printf(lcd_putc, "\nVERDE"); delay_ms(1000); } else {printf(lcd_putc, "\fColor reconocido"); printf(lcd_putc, "\nAZUL"); delay_ms(1000); } } }

lcd_gotoxy(1,1); printf(lcd_putc, "c1=%1.1fV c2=%1.1fV", vol1,vol2); printf(lcd_putc, "\nc3= %1.1fV", vol3);

} void main() { setup_adc_ports(AN0); setup_adc(adc_clock_div_32); set_tris_b(1); set_tris_c(0); port_b_pullups(1); enable_interrupts(int_ext); ext_int_edge(H_to_L); enable_interrupts(global); portc=0; lcd_init(); printf(lcd_putc, "\f>BIENVENIDO A__COLORES__