Home > other >  Excuse me each great god, and I want to take advantage of USART change duty ratio to send data make
Excuse me each great god, and I want to take advantage of USART change duty ratio to send data make

Time:09-17

The interrupt function is such void DEBUG_USART_IRQHandler (void)
{
uint8_t ucTemp;
If (USART_GetiTStatus (DEBUG_USARTx, USART_IT_RXNE)!=RESET)
{
ucTemp=USART_ReceiveData(DEBUG_USARTx);
Time=ucTemp;
TIM_SetCompare1 (GENERAL_TIM, time);
USART_SendData (DEBUG_USARTx, time);

}

}
The main function is that
Int main (void)
{


USART_Config ();
GENERAL_TIM_Init ();



While (1) {


}}
With serial assistants first enter the Numbers change duty ratio steering gear movement, after input is no reaction, but the screen or print out the interrupt request print number, is this why?

CodePudding user response:

Duty ratio doesn't change?

CodePudding user response:

Duty cycle if there is any change, use oscilloscope measurement,
In addition
 
TIM_SetCompare1 (GENERAL_TIM, time);
USART_SendData (DEBUG_USARTx, time);
this two sentences do not put in best
 
Void DEBUG_USART_IRQHandler (void)
the implementation,

CodePudding user response:

If the inside of the interrupt time is too often

CodePudding user response:

There is no clear interrupt flag bit ah

CodePudding user response:

reference 4 floor lulous response:
there is no clear interrupt flag bit.

GetITflagstatus not automatically remove flags

CodePudding user response:

You'd better inside the interrupt get a flag bit to judge and elsewhere say child function based on tags to change the duty ratio, it is best not to perform complex operations inside terminal,
  • Related