Define register simply with bit fields, C/C++ Programming

Assignment Help:

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;


Related Discussions:- Define register simply with bit fields

We need to decompile ex4 to mq4, We need to Decompile ex4 to mq4 I have ...

We need to Decompile ex4 to mq4 I have three expert advisors for mt4, which I need to decompile to its original mq4 code. Skills required are C Programming, C++ Programming,

Subrotine assembly language, You have to write a subroutine (assembly langu...

You have to write a subroutine (assembly language code using NASM) for the following equation.

C program for total & average in the array , C Program for TOTAL  & AVERA...

C Program for TOTAL  & AVERAGE IN THE ARRAY  #include stdio.h> #include conio.h> #include string.h> void main() {           int i=0,n[100],limit=0,a=0;

Develope a program, Develop a program to meet the following requirements: ...

Develop a program to meet the following requirements: 1. Must use at least one function in addition to main (you can use more) 2. Must use selection 3. Must use deference/indire

Calculate the area and circumference of a circle , Write a program which in...

Write a program which incorporates a function named compute and which is used to calculate the area and circumference of a circle. Use the main function for inputs and outputs.

Derivatives and symbolic math, #Hi, I''m planning to derive the escape velo...

#Hi, I''m planning to derive the escape velocity through C++. I would just like to know if it''s possible to differentiate symbolic functions? Do I need to download libraries,etc?

Help finish programming assignment, how much is it to fix a small data stru...

how much is it to fix a small data struct in a sorted list that pass itemtypes. all the code is written just logical errors

#superASC2 SRTING COST, A string S is said to be "Super ASCII", if it conta...

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''a''-''z'') and the asci

Which one would you prefer - a macro or a function, Which one would you pre...

Which one would you prefer - a macro or a function? Actually it depends on the purpose of program! - In case of macros, corresponding code is inserted directly into your sou

Define the data type qualifiers in c language, Define the Data Type Qualifi...

Define the Data Type Qualifiers in c Language? 1. const 2. volatile const: The const qualifier is used to tell C that the variable value can't change after initialization.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd