Có lẽ chương trình chạy đúng theo những gì bạn viết đó chứ.
Chương trình nên được sửa lại thành:
Code:
//Chuong trinh led sang don o PORTB
/*ket qua o PORTB là:00000001,00000010,00000100,00001000,00010000,00100000,01000000,10000000,10000001,10000010,10000100,10001000,.....cuoi cung thi PORTB=0xFF */
#include<16F877A.h>
#include<def_16f877a.h>
#fuses NOWDT,PUT,HS,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use fast_io(b)
int8 sck,bienxoay;
main()
{
trisb=0;
while(true){
sck=8;
portb=0;
delay_ms(100);
bienxoay=1;
while(sck>0)
{
portb=bienxoay;
bienxoay=bienxoay<<1;
delay_ms(100);
sck--;
}
}
}
Thân,