e đang viết code để điều khiển động cơ bước. e muốn xuất ra 50 bước code của e ko biết vì sao nó chỉ xuất ta 1 bước mội nguòi xem giúp e nha
signed int i;
void rephai()
{
for (i=0;i<=50;i++)
{
output_high(pin_b0);
delay_ms(2);
output_low(pin_b0);
delay_ms(2);
}
}
void turn_back()
{
for (i=0;i<=50;i++)
{
output_high(pin_b0);
delay_ms(2);
output_low(pin_b0);
delay_ms(2);
}
}
void main()
{
set_tris_b(0x00); //mac dinh port d la dau ra
while(1)
{
output_low(pin_b1);
delay_ms(100);
rephai();
delay_ms(100);
output_high(pin_b1);
turn_back();
delay_ms(100);
}
}
|