AnsweredAssumed Answered

How to print unsigned int always positive

Question asked by mich.lei on Sep 6, 2016
Latest reply on Sep 6, 2016 by mich.lei
This is more of a C problem than Arm problem, here too are some people who know their C.

I am reading the value of DWT_CYCCNT;
When print it via Uart, after a while it becomes negative. The most signicant bit becomes 1, but how to tell it to the compiler that it is not a sign.

//the declaration                  
char klaa[40];
//the code
while (1)
                    kellopulshit = *DWT_CYCCNT;
          sprintf (klaa,"Clock pulses  %d \n", kellopulshit);
            HAL_UART_Transmit(&huart2,(uint8_t *) klaa,c,1000);