2017-09-24 03:19 PM
Hello friends
I defined a variable uint16_t x;
in my code I will compare x >= 500 Most of the time works fine
But sometimes variable is Overflow in 256 i see in debug
variable is 0 after 255+1
i using IAR , STM32F103ZET6 , HAL
How can I fix this?
Thank
2017-09-24 04:21 PM
Are you looking at bytes in memory or words? 256 would appear as consecutive bytes 0x00 0x01
May be you can actually show an example of the code, and the state in the debugger?
The value could get constrained if you cast it through a char or uint8_t