This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

long data types

Hi all,
Can anyone help me with the following problem?
I'm writing a long data to a long variable but instead of passing 4 Bytes it pass 3 Bytes. I'm using C51 v6.22.

long var = 0xBD3C00BD; -> var=0x3C00BD;

Thanks a lot,
Reuven

Parents
  • Really? Then the Keil compiler is completely broken. Hmm, I doubt that. How are you inspecting the value? Don't say printf(). If you say printf() then besure you tell printf() that the object to be printed is of type %lu or %lX. Remember too that in the small model printf will only handle up to 15 bytes of stacked args, 40 in the large model (I think). So if you're printing this 4 byte unsigned long after a bunch of other longs you'll get garbage.

Reply
  • Really? Then the Keil compiler is completely broken. Hmm, I doubt that. How are you inspecting the value? Don't say printf(). If you say printf() then besure you tell printf() that the object to be printed is of type %lu or %lX. Remember too that in the small model printf will only handle up to 15 bytes of stacked args, 40 in the large model (I think). So if you're printing this 4 byte unsigned long after a bunch of other longs you'll get garbage.

Children