Current location - Health Preservation Learning Network - Healthy weight loss - C language, about 16 serial port sending.
C language, about 16 serial port sending.
Define a union {unsigned int I;; Unsigned character AC [4]; } udata

udata . I = 1;

If (udata.ac [0] = =1)/small terminal, it will be sent from low to high.

{

udata . I = 123456789;

int j = 0;

while(j & lt; 4 )

{

send _ data _ UART(udata . AC[j]);

j++;

}

}

Else // big end machine, sending from high to low

{

udata . I = 123456789;

int j = 4;

while(j->; 0 )

{

send _ data _ UART(udata . AC[j]);

}

}

The first method to correct the upstairs is posture and:

Unsigned int val =123456789;

Uart (val&; 0x ff);

send _ data _ UART((val & gt; & gt8)& amp; 0x ff);

send _ data _ UART((val & gt; & gt 16); 0x ff);

send _ data _ UART((val & gt; & gt24)& amp; 0x ff);

Please give the sticker upstairs. I think method one works better.