sending a long with uart

xdata unsigned long var_long  _at_ 0x0150;

unsigned char * pointer;

pointer=0x0150;
var_long=0x45213256;

SBUF=*pointer;
...
SBUF=*(pointer+1);
...
SBUF=*(pointer+2);
...
SBUF=*(pointer+3);
...

my uart communication work, when i send datas byte one byte. when i try to send a long variable in above form , uart com. dont work. is this format illegal?
xdata unsigned long var_long _at_ 0x0150;
unsigned char * pointer;
pointer=0x0150;
var_long=0x45213256;

*pointer : 0x45 ??
*(pointer+1) : 0x21 ??
*(pointer+2) : 0x32 ??
*(pointer+3) : 0x56 ??

Parents
  • "uart com. dont work"

    What do you mean by "don't work"?

    Does it not transmit anything at all?

    Does it transmit something, but just not the expected data? - if so, what does it transmit?

    Have you single-stepped this in the simulator?

    How do you know that it's your UART comms that "don't work" rather than whatever is receiving the data?

    Are you correctly waiting for the transmittion of one byte to complete before loading the next into SBUF?

Reply
  • "uart com. dont work"

    What do you mean by "don't work"?

    Does it not transmit anything at all?

    Does it transmit something, but just not the expected data? - if so, what does it transmit?

    Have you single-stepped this in the simulator?

    How do you know that it's your UART comms that "don't work" rather than whatever is receiving the data?

    Are you correctly waiting for the transmittion of one byte to complete before loading the next into SBUF?

Children
More questions in this forum