AnsweredAssumed Answered

pwm and uart

Question asked by asim khan on Nov 14, 2017

Hello All..I am controlling 4 servos of MeArm robot.I have initialized 4 pwm output channels of timer4 to generate different duty cycles..here is my code inside while loop.

{

for(dutyCycle1=1400;dutyCycle1 <= 2400;dutyCycle1 = dutyCycle1 + 200)
{
HAL_Delay(100);
htim4.Instance->CCR1 = dutyCycle1;
}


for(dutyCycle2 =1000;dutyCycle2 <= 2400;dutyCycle2 = dutyCycle2 + 200)
{
HAL_Delay(100);
htim4.Instance->CCR2 = dutyCycle2;
}

for(dutyCycle3 =600;dutyCycle3 <= 2400;dutyCycle3 = dutyCycle3 + 200)
{
HAL_Delay(100);
htim4.Instance->CCR3 = dutyCycle3;
}

for(dutyCycle4 =600;dutyCycle4 <= 2400;dutyCycle4 = dutyCycle4 + 200)
{
HAL_Delay(100);
htim4.Instance->CCR4 = dutyCycle4;
}

 

Now i want to transmitt dutycycle values (dutyCycle1 to 4) from my stm32f746zg to raspberry pi..I have already initialised USART1 (Async mode).But i cant think of any logic how to send these values via uart..i would really appreciate to get suggestions and help from ST community@..

Outcomes