Menu

Write C Programming Language 8 Bit Binary Number Assignment Info Array Parameter Holds 8 B Q43836557

Write in C programming Language. 8-Bit Binary NumberAssignment.

Info: Each array parameter holds an 8-bitbinary number, 7 6 5 4 3 2 1 0,where bits[7] = 7 and bits[0] = 0.

#include <stdio.h>

#include <stdint.h>

#include <stdarg.h>

#include <string.h>

#include <math.h>

#include “library.h”

#include “graphics.h”

***Write the necessary code to implement thesefunctions. ***

// Convert array of bits to signed int.

int32_t Bits2Signed(int8_t bits[8]);

// Convert array of bits to unsigned int

uint32_t Bits2Unsigned(int8_t bits[8]);

// Add 1 to value represented by bit pattern

void Increment(int8_t bits[8]);

// Opposite of Bits2Unsigned.

void Unsigned2Bits(uint32_t n, int8_t bits[8]);

Further Info: When the program runs, it shouldcycle through all the 8-bit patterns in sequence, displaying thebit pattern of the representation, as well as itsinterpretation as both unsigned and signed 2’s complementintegers.

Hint: The following is the most efficient wayto convert binary to decimal: Consider an 8-bit binary signedinteger, represented as 7 6 5 4 3 2 1 0, where the b’s are the 1’sand 0’s of the number. The corresponding polynomial would be:
= 27 7 + 26 6 +25 5 + 24 4 +23 3 + 22 2 +21 1 + 20 0
But note that you can rewrite this as:
= 0 + 2( 1 + 2( 2 +2( 3 + 2( 4 + 2( 5 +2( 6 + 2 7 ))))))
Which can be computed using a simple loop: ← 0 = 7 0: ← 2 × +

Expert Answer


Answer to Write in C programming Language. 8-Bit Binary Number Assignment. Info: Each array parameter holds an 8-bit binary number…

OR