TIMER0 ÀÎÅÍ·´Æ®¸¦ ÀÌ¿ëÇؼ 5.0176ms ¸¶´Ù ÀÎÅÍ·´Æ®¸¦ °É¾î 5Ãʸ¶´Ù LED ¿¡ 0.5ÃÊ°£ ºÒÀÌ µé¾î¿À°Ô ÇÏ´Â °úÁ¦°¡ÀÖ¾î¿ä ¤Ð¤Ð
ÀÎÅÍ·´Æ®¸¦ ÀÌ¿ëÇϴ°Ŷû, Flag ºñÆ®¸¦ »ç¿ëÇÏ´Â°Ô Àִµ¥,
#include <18F452.h>
#fuses NOWDT, HS
#include <stdlib.h>
#use delay(clock=20000000)
#byte PORTD=0xf83
#byte TRISD=0xF95
#define ms5 98
long count=0;
long sec_count=0;
#int_rtcc
void timer1_isr()
{
count++;
if(count=98)
{
count = 0;
if (sec_count=48000)
{
PORTD=0xff;
delay_ms(500);
sec_count = 0;
}
}
}
void main()
{
set_tris_d(0x00);
count=0;
PORTD=0x00;
setup_counters(RTCC_8_BIT, RTCC_DIV_1);
// setup_counters(RTCC_8_BIT, RTCC_DIV_2);
// setup_counters(RTCC_8_BIT, RTCC_DIV_4);
enable_interrupts(INT_RTCC);
enable_interrupts(GLOBAL);
while(1) {
}
}
¾îµð°¡ Ʋ·ÈÀ»±î¿ä ¤Ð¤Ð ¾Æ¿¹ ÀÛµ¿À» ¾ÈÇϳ׿ä...
Á¦¹ß ºÎŹµå¸³´Ï´õ ¤Ð¤Ð¤Ð |
1.
if(count=98)
¿Í
if (sec_count=48000)
´Â
°¢°¢
if(count==98)
if (sec_count==48000)
ó·³ = ´ë½Å == ·Î »ç¿ëÇØ¾ß ÇÕ´Ï´Ù.
2. sec_count++ Àº ¾îµò°¡¿¡¼ ÇØÁÖ³ª¿ä? ºüÁø°Í °°³×¿ä.