This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28335: Combine four unsigned char into one unsigned long variable

Part Number: TMS320F28335


Hi,

I am trying to combine four elements of unsigned char array into one unsigned long variable,

this is my code,

rx_buf[4] is unsigned char array

temp1 is unsigned int variable

message_ID is unsigned long variable

temp1 = (unsigned int)((rx_buf[j-3])|(rx_buf[j-4]<<8)); //get the upper two bytes
 message_ID = (unsigned long)((temp1<<16) | ((rx_buf[j-2]<<8)|(rx_buf[j-1])));

But with this code not able to combine the same please suggest or any code if you have.

Thanks & Regards,

Sachin