[SOLVED] 16_bit_struct to int convertion

Status
Not open for further replies.

h.galeh

Member level 3
Joined
Apr 16, 2008
Messages
66
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Tehran, Iran, Iran
Activity points
1,690
hello
I want to use () parantheses to convert a 16 bit to integer equivalent but error occurs
what should I do?
this is the wrong line:
LATB=(int)prt;
--------
my Compiler is "c30" of microchip
----------
error message is:
newmain.c:52: error: aggregate value used where an integer was expected
 

the best way is using a union in the form below:
struct mystructure {
int x:8;
int y:8;
};
union ff{
struct mystructure m;
int n;
}
it is fantastic
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…