I'm using FlowCode V4.5 with EB006 board.
I could not run a stepper motor using the macro component, even with enablemotor and disablemotor instructions.
The animation, was runing fine.
Looking at the code PIC_stepper.c, final instructions "#endif" of / * Macro_EnableMotor_Start * / and / * Macro_DisableMotor_Start * / seem misplaced.
I have relocated it just after the "#else "(I was too lazy to remove it" and now the stepper is running:
Code: Select all
:
[code]
/*Macro_EnableMotor_Start*/
#ifdef MX_MIAC_SYSTEM
.
.
.
#else
#endif <==========
%q_enabled = 1;
clear_bit(MX_%q_TRIS1, MX_%q_PIN1);
clear_bit(MX_%q_PORT1, MX_%q_PIN1);
clear_bit(MX_%q_TRIS2, MX_%q_PIN2);
clear_bit(MX_%q_PORT2, MX_%q_PIN2);
clear_bit(MX_%q_TRIS3, MX_%q_PIN3);
clear_bit(MX_%q_PORT3, MX_%q_PIN3);
clear_bit(MX_%q_TRIS4, MX_%q_PIN4);
clear_bit(MX_%q_PORT4, MX_%q_PIN4);
/*Macro_EnableMotor_End*/
}
Code: Select all
/*Macro_DisableMotor_Start*/
#ifdef MX_MIAC_SYSTEM
.
.
.
.
.
.
#else
#endif <=========
%q_enabled = 0;
set_bit(MX_%q_TRIS1, MX_%q_PIN1);
clear_bit(MX_%q_PORT1, MX_%q_PIN1);
set_bit(MX_%q_TRIS2, MX_%q_PIN2);
clear_bit(MX_%q_PORT2, MX_%q_PIN2);
set_bit(MX_%q_TRIS3, MX_%q_PIN3);
clear_bit(MX_%q_PORT3, MX_%q_PIN3);
set_bit(MX_%q_TRIS4, MX_%q_PIN4);
clear_bit(MX_%q_PORT4, MX_%q_PIN4);
/*Macro_DisableMotor_End*/
}