Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[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
 

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
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

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top