Pic programlama timer0 örnek devre ve kodları
#include <16f628a.h>
#fuses intrc_io,nowdt,nomclr
#use delay (clock = 4m)
#use fast_io(a)
#use fast_io(b)
#define use_portb_lcd TRUE
#include <lcd.c>
int cont = 1;
int timer;
int num[5];
void main()
{
set_tris_a(0xff);
lcd_init();
setup_timer_0(rtcc_internal | rtcc_div_1);
lcd_putc("kose \n");
delay_ms(2000);
lcd_putc("\f siralama: \n");
delay_ms(500);
set_timer0(1);
while(true)
{
while(cont<=5)
{
timer = GET_TIMER0();
if(timer > 0 && timer <81)
{
num[cont]= timer;
printf(lcd_putc,"%u",num[cont]);
cont++;
}
delay_ms(331);
}
delay_ms(3000);
lcd_putc("\f siralama: \n");
cont = 1;
}
}
Hiç yorum yok:
Yorum Gönder
Her yorum bilgidir. Araştırmaya devam...