Determine the bits that should be set for it and shift them

Assignment Help Computer Engineering
Reference no: EM132383229

Assignment

Importantly, this function sets the bits in the integer pointed to by display which may or MAY NOT BE the global display variable.

To properly set the display bits, set_display_from_batt() will need to do bit shifting along with bitwise operations to construct the correct bit pattern for the display.

A good trick to use is to create a series of bit patterns that correspond to the various digits. For example, according to the diagrams above, the bit pattern for 9 is 0b1101111. If a 9 should appear on the display somewhere, this bit pattern should be shifted and combined with the existing bits in display so that a 9 will show. Creating similar constant mask patterns for each digit, the decimal place, the positions of the Voltage/Percent indicator, and the bars for the visual level indicator is a good way to make this problem manageable.

A detailed explanation of one approach to the problem follows.

Create an array of bit masks for each of the digits 0-9. The 0th element of the array contains a bit mask like 0b0111111 which represents the bits that should be set for a 0 digit, the 1th element of this array has a mask like 0b0000011 which are the bits to be set for a 1. There should be ten entries in this array in indices 0-9.

Use modulo to determine the integer value for right, middle, and left digits for the display from volts or percent. Each digit should have a value from 0-9 and be Stored in its own variable.

Start with an integer variable of 0 (all 0 bits).

Use left digit variable to index into your array of masks to determine the bits that should be set for it and shift them over an appropriate amount combining with the existin display bits.

Combining bits here is a logical operation of setting all bits that are one in the mask to 1 in the display variable.

Repeat this process for the middle and right digits shifting left by appropriate to where the digits should line up.

There are several special cases to consider such as leading 0's in a percent should be blanks so nothing should be drawn.

Don't forget to set the additional bits like the decimal place, the V/% indicator, and the level bars for the visual indicator.

Importantly make code as simple as possible as the target CPU has a limited amount of RAM and longer codes will occupy more RAM. Avoid nesting conditionals very deeply: if/else if/else structures are fine but nesting a conditional within this will be penalized.

Reference no: EM132383229

Questions Cloud

Create layers for different elements in the design : Create a multi-layer image that realistically places you (or someone else IF you strongly object in using your own photograph) in a significant event
CS5228 Knowledge Discovery And Data Mining Assignment : CS5228 Knowledge Discovery And Data Mining Assignment Help and Solution - National University of Singapore - Implement a Decision Tree Regressor
Use of blockchain for the protection of one of financial : Use of blockchain for the protection of one of medical, financial, or educational records.
Computer information security-mobile security : Computer Information Security- Mobile Security
Determine the bits that should be set for it and shift them : Determine the integer value for right, middle, and left digits for the display from volts or percent. Each digit should have a value from 0-9.
Describe the plain view doctrine : Describe the plain view doctrine, and why it has such a significant impact on digital forensics? What are three approaches to determining whether the doctrine.
How do you feel introduction of blockchain infrastructure : How do you feel the introduction of a blockchain infrastructure as discussed in the use case could strengthen the business your team evaluated.
Create a page using at least five images : Create a page using at least five images. Your page should be a resource page for a course concept, using images to illustrate the concept.
Presentation showing Future application of Artificial : Assignment - Prepare a presentation showing Recent/Future application of (Artificial) Intelligent Systems and discuss about the pro and cons

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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