** çҹ繤Դ繢ͧ¹ͧ 觼ҹ繵ͧ繴令Ѻ
ҡ բʹ ;ͤ ԡ سѧ¹¤Ѻ ӡ䢢
١ͧ Ѻ
Ѻ˹ѡ
 

PIC mikro C ¹

㹺͹һء觨ҡҹçҹѹѺ 㹵͹з LED ¡á˹觹鹡ѺҵͧẺ˹ 觡¹鹨ҧѹҡѡ

õǧöٻ¨ PORT B B0 ֧ B7


ǧ÷㹡÷ͧ


觷㹡¹

TRISB
PORTB
delay_ms();

÷ӧҹͧ觨觨ҡ LED0 ѧ LED8 ¨еԴѺǹ

CodeѺ
void main()
{
TRISB = 0X00;
while(1)
{
PORTB=0X01; // LED 1 Դ
delay_ms(300); // ˹ǧ 300 ms
PORTB=0X02; ; // LED 2 Դ
delay_ms(300);
PORTB=0X04; ; // LED 3 Դ
delay_ms(300);
PORTB=0X08; ; // LED 4 Դ
delay_ms(300);
PORTB=0X10; ; // LED 5 Դ
delay_ms(300);
PORTB=0X20; ; // LED 6 Դ
delay_ms(300);
PORTB=0X40; ; // LED 7 Դ
delay_ms(300); ;
PORTB=0X80; ; // LED 8 Դ
delay_ms(300);
}
}



http://www.youtube.com/watch?v=5HhTPxXk8qM


š÷ӧҹ


աٻẺ ҧԴǹ Ѻ

code
void main()
{
TRISB = 0X00;
while(1)
{
PORTB=0X00;
delay_ms(300);
PORTB=0X01;
delay_ms(300);
PORTB=0X03;
delay_ms(300);
PORTB=0X07;
delay_ms(300);
PORTB=0X0F;
delay_ms(300);
PORTB=0X1F;
delay_ms(300);
PORTB=0X3F;
delay_ms(300);
PORTB=0X7F;
delay_ms(300);
PORTB=0XFF;
delay_ms(300);
/****************/
PORTB=0XFF;
delay_ms(300);
PORTB=0X7F;
delay_ms(300);
PORTB=0X3F;
delay_ms(300);
PORTB=0X1F;
delay_ms(300);
PORTB=0X0F;
delay_ms(300);
PORTB=0X07;
delay_ms(300);
PORTB=0X03;
delay_ms(300);
PORTB=0X01;
delay_ms(300);
PORTB=0X00;
delay_ms(300);
}
}



http://www.youtube.com/watch?v=qw_I8pOuR4M


š÷ӧҹ


¹ 5 .. 2554