Reply by "kar...@yahoo.com [rabbit-semi]" September 26, 20172017-09-26
Hi, Barni, Got it, I will study this, thanks for your help.
Kara
Reply by "Ber...@t-online.de [rabbit-semi]" September 25, 20172017-09-25
kara,

a library (TimerB.lib) from Scott Henion offers you an exact Timer-Interupt.

See here: https://shdesigns.org/rabbit/freelibs.shtml

Barni
Am 25.09.2017 um 12:39 schrieb k...@yahoo.com [rabbit-semi]:
> Tom, thanks
>
>   Yes,It is workable if waitfor (DelayMs (1));
> but motor speed is a bit slow, if the time delay want to change to
> 0.5ms, is it as follows?
>
> waitfor (DelayTicks (1));
>
> or waitfor (IntervalMs (??)); how does this instruction use ?
Reply by "kar...@yahoo.com [rabbit-semi]" September 25, 20172017-09-25
Tom, thanks

Yes,It is workable if waitfor (DelayMs (1));
but motor speed is a bit slow, if the time delay want to change to 0.5ms, is it as follows?

waitfor (DelayTicks (1));

or waitfor (IntervalMs (??)); how does this instruction use ?
Reply by "Tom...@tomlogic.com [rabbit-semi]" August 7, 20172017-08-07
In your inner loop, try changing the 500ms delay to a 1ms delay. Sample code on the net uses a 500uS delay (i.e., 0.5ms).

Also, make sure you’ve configured those pins as outputs (something that HBpinHigh() and HBpinLow() might already do for you).

-Tom
> On Jul 23, 2017, at 10:04 PM, k...@yahoo.com [rabbit-semi] wrote:
>
> Hi, the following is the A4988 module + stepping motor c code for RCM3000,
> But stepping motor will only shake without turning, is the program or hardware wiring problems ? thanks.
>
> #use "hobbyist.lib"
>
> #define START_SW HB_PF5
> #define MOTOR_STEP HB_PF6
> #define MOTOR_DIR HB_PF7
> int x;
>
> if(!HBpinRead(START_SW)){
> sprintf (status_html, "Start\r");
> HBpinHigh(MOTOR_DIR);
> for(x = 0; x < 200; x++) {
> HBpinHigh(MOTOR_STEP);
> waitfor(DelayMs(500));
> HBpinLow(MOTOR_STEP);
> waitfor(DelayMs(500));
> }
>
> waitfor(DelayMs(1000));
>
Reply by "kar...@yahoo.com [rabbit-semi]" July 24, 20172017-07-24
Hi, the following is the A4988 module + stepping motor c code for RCM3000,
But stepping motor will only shake without turning, is the program or hardware wiring problems ? thanks.

#use "hobbyist.lib"

#define START_SW HB_PF5
#define MOTOR_STEP HB_PF6
#define MOTOR_DIR HB_PF7
int x;

if(!HBpinRead(START_SW)){
sprintf (status_html, "Start\r");
HBpinHigh(MOTOR_DIR);
for(x = 0; x < 200; x++) {
HBpinHigh(MOTOR_STEP);
waitfor(DelayMs(500));
HBpinLow(MOTOR_STEP);
waitfor(DelayMs(500));
}

waitfor(DelayMs(1000));