mach don gian nhung kg chay
e co viet doan code don gian nhung sao no kg chay mong may anh giup do !
#include<16f877a.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use fast_io(A)
#use fast_io(B)
#use fast_io(c)
#use fast_io(D)
#define forward input(pin_B2)
const unsigned char bien[] = {0x0e,0x0d,0x0b,0x07};
//unsigned char M[] = {0x11,0x22,0x44,0x88};
//-------------------------
void dc_thuan(){
int8 i=0,j=0;
while(forward== 1){
delay_us(100);
output_D(bien[i--]);
if(i<0){
i=3;
}
}i++;
}
main(){
dc_thuan();
}
|