- Đây là ảnh mô phỏng protues.
- Đây là code chương trình.
#include <16f877a.h>
#fuses NOLVP,NOWDT,PUT,XT
#use delay(clock=8000000)
const unsigned char maled[10]={0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82,0xF8, 0x80, 0x90};
int dem;
void main (void)
{
set_tris_b(0x00);
output_b(0);
while(true)
{
output_b(maled[dem]);
delay_ms(300);
dem++;
if(dem==10)
{
dem=0;
}
}
}
#fuses NOLVP,NOWDT,PUT,XT
#use delay(clock=8000000)
const unsigned char maled[10]={0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82,0xF8, 0x80, 0x90};
int dem;
void main (void)
{
set_tris_b(0x00);
output_b(0);
while(true)
{
output_b(maled[dem]);
delay_ms(300);
dem++;
if(dem==10)
{
dem=0;
}
}
}
EmoticonEmoticon