Tamilmani T

MC9S12DT128, unsigned_32 variable passed to a function as void * is losing first byte

Discussion created by Tamilmani T on Dec 14, 2011
Latest reply on Dec 15, 2011 by kef

I am using MC9S12DT128, 16 bit controller.I am trying to send a 32 bit data from one function to the other using 'void pointer'. But after passing the data to that function, i could see one of the three bytes missing. I even tried typecasting the variable while storing the data. Even then i could see one btye missing. Can you please suggest me a work around for this? Thanks.

 

Please find below the syntax of my code, var2 value shown in comment below is missing first byte. I cannot update  

"Func1(void* var2)" as it is a production code.

 

Main.c:

Unsigned_32 var1;

var1= 0x12345600;

void main()

{

//var1 value here is 0x12345600

Func1(&var1);

}

 

Lib.h:

void Func1((void *) var2);

Lib.c:

void Func1(void* var2)

{

 

//    var2 value seen here is 0x00345600

 

}

Outcomes