Hello everybody,
I am currently trying to understand the code generated by my model but I have some difficulties with the UART_Tx bloc.
Here is the code :
/* S-Function "UART_Tx" Block: <Root>/Tx Output */
{
uint8_T Tmp;
do {
Tmp = ~(TxPtrHaut_Uart1 - TxPtrBas_Uart1);/* Tmp = 7 - (Haut - Bas) modulo 32 */
Tmp = Tmp & (32-1);
} while (Tmp == 0);
TxTab_Uart1[TxPtrHaut_Uart1] = testI2C_B.Output;
TxPtrHaut_Uart1 = (TxPtrHaut_Uart1 + 1) & (32-1);
_U1TXIF = 1;
_U1TXIE = 1;
}
I understand that Tmp is local and won't exist anymore once we left the function.
I tried to solve it on paper to be sure I understand properly but for me the value of "TxPtrBas_Uart1" is never changed. It is initialised at 0 and stay this way. So at the second iteration we wil enter the do-while loop and stay in it forever.
Am I getting this wrong? Does TxPtrBas_Uart1 is changed somewhere else? I tried ctrl F in every file but did not found any line modifying this varaible.
Thanks,
Helene
UART_Tx bloc code comprehension problem
Re: UART_Tx bloc code comprehension problem
It's me again
Sorry, I found the answer to my question. My dsPIC_UART1_Interrupt.c file was missing on MPLAB and TxPtrBas is modified in it.
Problem solved.
Helene
Sorry, I found the answer to my question. My dsPIC_UART1_Interrupt.c file was missing on MPLAB and TxPtrBas is modified in it.
Problem solved.
Helene
-
- Posts: 4
- Joined: Fri Sep 06, 2013 7:47 am
- Contact:
Who is online
Users browsing this forum: No registered users and 8 guests