I have at the moment no experience in microcontroller programming but I'm trying to start in doing something.
I'm trying to use a Motion Board to move a little machine, but I'm not able to use the motor 2.
I used a little demo that a friend provided me but I'm not able to move the motor 2 that is connected to RD6_PIN83. Ichecked the code and I wanted to ask if using this function:
Code: Select all
__INLINE__ void __ALWAYS_INLINE__ init_motorPWM(EE_UINT16 pwm_ptcon,
EE_UINT16 pwm_pwmcon1, EE_UINT16 pwm_pwmcon2, EE_UINT16 usperiod,
EE_UINT16 pwm_sevtcmp)
{
/* Check if the ADC is initialized */
if (EE_motorPWM_init != 0) return;
PTCON = pwm_ptcon;
PWMCON1 = pwm_pwmcon1;
PWMCON2 = pwm_pwmcon2;
PTPER = us2ticks(usperiod);
SEVTCMP = pwm_sevtcmp;
/* init the enable pins for the H bridge */
TRISDbits.TRISD6 = 0; /* motor M2 enable pin */
TRISDbits.TRISD7 = 0; /* motor M1 enable pin */
EE_motorPWM_init = 1;
}
the problem can be here, when it's called the function:
init_motorPWM(0x000C, 0x0011, 0x0, MOTOR_PWM_USPERIOD, 0x0 );
I think that maybe I have to pass another value but all the CON values from the datasheet I find are not working.