magic_boy_1989
25-11-2010, 10:41 PM
em co doan code sau nhugn no kg chay,Mong anh em giup do.SR vi may o tiem kg co unikey ma dow thi lau wa hix
#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};
//-------------------------
void dc_thuan(){
int8 i=0,j=0;
while(forward){
delay_us(100);
output_D(bien[i--]);
if(i<0){
i=3;
}
} i++;
}
main(){
while(true)
{
if (forward==0)
{
delay_us(100);
dc_thuan();
}
}
}
Chú ý: Vui lòng sử dụng tiếng Việt trong diễn đàn, và code phải đặt trong thẻ code
#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};
//-------------------------
void dc_thuan(){
int8 i=0,j=0;
while(forward){
delay_us(100);
output_D(bien[i--]);
if(i<0){
i=3;
}
} i++;
}
main(){
while(true)
{
if (forward==0)
{
delay_us(100);
dc_thuan();
}
}
}
Chú ý: Vui lòng sử dụng tiếng Việt trong diễn đàn, và code phải đặt trong thẻ code