define register with bit fieldswe could define


Define register with bit fields?

We could define register simply with bit fields:

struct DISK_REGISTER
{
unsigned ready:1;
unsigned error_occured:1;
unsigned disk_spinning:1;
unsigned write_protect:1;
unsigned head_loaded:1;
unsigned error_code:8;
unsigned track:9;
unsigned sector:5;
unsigned command:5;
};

To access values stored at a exacting memory address, DISK_REGISTER_MEMORY we can allocate a pointer of the above structure to access the memory via:

struct DISK_REGISTER *disk_reg = (struct DISK_REGISTER *)
DISK_REGISTER_MEMORY;

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: define register with bit fieldswe could define
Reference No:- TGS0305235

Expected delivery within 24 Hours