draaknar
Newbie level 3
- Joined
- Oct 1, 2013
- Messages
- 4
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 45
Hello guys!
I have two functions where i have a RX-INTERRUPT and i send data via TX.
But i cannot understand a simple problems ive come accross.
I have two functions where i have a RX-INTERRUPT and i send data via TX.
But i cannot understand a simple problems ive come accross.
- Why cant i write printf("%d",index_rx) in my void USART1_IRQHandler(void) function?;---> is it because "uint8_t" and "int" are not the same?? ,I know that we have to use "%d" when its an "int" declaration.
- Why doesnt it work when i write int index_rx=0;, and compile, whats the difference between static and int ?
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 void USART1_IRQHandler(void){ static uint8_t index_rx=0; if(USART_GetITStatus(USART1, USART_IT_RXNE)!=RESET); { StringLoop[index_rx++]=USART_ReceiveData(USART1); } void send_data(USART_TypeDef* USARTx, volatile char *str){ while (*str) { while(USART_GetFlagStatus(USARTx, USART_FLAG_TXE) == RESET); USART_SendData(USARTx, *(str++)); } }
Last edited by a moderator: