Part Number: TMS320F28069M 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: void key_control(void) { 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); if(HAL_readGpio(halHandle, (GPIO_Number_e)HAL_keyGpio_x) ==LOW) { 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; while(1) { 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); } } } } 1, Is there a problem with the program I wrote? How can I control the motor forward and reverse rotation by pressing the key? 2, Where can I change the reference speed? I had changed it as 0 ramp, But in the expression window it still shows 1800 ramp. 3, gHall_GpioData = (~HAL_readGpio(halHandle, (GPIO_Number_e)HAL_HallGpio_C) & 0x1) << 2; What is the result of gHall_GpioData?
↧