• char to unsigned int
    Hi all Here is some code char prev_ch; unsigned int chksum_read; chksum_read += (WORD)prev_ch*256; chksum_read += (unsigned int)prev_ch<<8; if prev_ch has a value of 0xDB after one of of...
  • initialization of packed unsigned int
    I am trying to implement Mass storage device class using nxpusblib and got stuck in initialization of a packed structure. The structure is typedef ATTR_IAR_PACKED struct { unsigned DeviceType : 5;...
  • atoi and int value into unsigned char
    Can i store a int into a char if result is less than 255 ? or i need to store only the lower byte? unsigned char mychar[10]; unsigned int intvalue; intvalue = 1000; intvalue = 1000 - 950;//value...
  • char variables not initializing correctly
    I have a function in which I declare two variables as follows: unsigned char voltage = 0; unsigned char test = 0; When I run the code in the debugger, these variables are initialized to random...
  • Two Chars for a Counter vs 1 Int?
    I have a case where I need to count up a variable for more than 255 for a unsigned char. I have a friend who works on 8-bit MCUs and swears that you should not use anything but 8 bit data types ...