Other Parts Discussed in Thread: DRV8305
Dear sir:
I use F28069M and DRV8305 based on lab11e to control motor and I want to control the motor forward and reverse rotation by pressing the key. But after I added the below program in lab11e, it doesn't work:
{
key_s1 = HAL_readGpio(halHandle, (GPIO_Number_e)HAL_keyGpio_1);
key_s2 = HAL_readGpio(halHandle, (GPIO_Number_e)HAL_keyGpio_2);
key_s3 = HAL_readGpio(halHandle, (GPIO_Number_e)HAL_keyGpio_3);
{
usDelay(50);
if(HAL_readGpio(halHandle, (GPIO_Number_e)HAL_keyGpio_x)==LOW)
{
while(HAL_readGpio(halHandle, (GPIO_Number_e)HAL_keyGpio_x)==LOW);
return LOW;
}
else
return HIGH;
}
else
return HIGH;
{
if(key_s1==LOW)
{
gMotorVars.SpeedRef_krpm = 0.8;
}
if(key_s2==LOW)
{
gMotorVars.SpeedRef_krpm = -0.8;
}
while(1)
{
if(key_s3==LOW)
{
gMotorVars.SpeedRef_krpm = 0.8;
usDelay(500);
gMotorVars.SpeedRef_krpm = -0.8;
usDelay(500);
}
}