Hi,
New to the forum and relatively new to the C language (mainly used for embedded 8051). Porting code from Kiel to SDCC compiler for work and struggling as my code is not compiling... (it does compile in Kiel but then again I would love to know more how it works as I have not seen this behaviour before)..
So I've got a header file with a struct:
Code:
typedef union
{
unsigned long u32;
struct
{
unsigned char hh;
unsigned char hl;
unsigned char lh;
unsigned char ll;
} u8;
} HighLow;
On another header file I have a different struct:
Code:
typedef struct
{
unsigned char id;
unsigned char ef;
unsigned char rtr;
unsigned char dlc;
unsigned char buffer[MAX_PAYLOAD_SIZE];
} FRAME;
And in my source file I have a function that access’s both structures and assigns the value of a register to it:
Code:
Core_Rx(FRAME* myFrame)
{
Frame-> id.u8.ll = HW_get_8bit_reg(RXMESSAGE_REG);
}
Is this possible? How does this work if so?
Thanks!