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

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
  • "in this form other device can't get anything"

    You have two possibilities:

    1. Your code didn't send anything;

    2. Your code did send something, but the other device didn't receive it.

    Only you can answer that!

    Are you sure that your other device can cope with receiving bytes so close together?

Reply
  • "in this form other device can't get anything"

    You have two possibilities:

    1. Your code didn't send anything;

    2. Your code did send something, but the other device didn't receive it.

    Only you can answer that!

    Are you sure that your other device can cope with receiving bytes so close together?

Children
No data