Command - 1 byte Address - 3 byte (24-bit) Offset address - 2 byte (16-bit)
During simulation (in proteous), it is found that 4th byte (MSB of address) is overlapped by 5th byte (LSB of Offset).
Following is the code. Please help what are the changes I need to do in the code. Is the bit field operation for 16 or 24 bits ok?
Code: Select all
typedef struct {
unsigned char Command:8 ;
unsigned long Addr:24;
unsigned int Offset:16;
} ISD_Struct;
ISD_Struct ISD_Rec;
void main()
{
address = 0x563412 ;
OFFST = 0x9A78 ;
ISD_Rec.Command = 0xBC;
ISD_Rec.Addr = address;
ISD_Rec.Offset = OFFST;
Write_SPI(&ISD_Rec,6); //sending (1byte command + 3byte address + 2 byte offset)
//Delay_ms(1000);
}