Write a program to build bcd countdown timer, Programming Languages

Assignment Help:

Many applications require entering a number from a button and then the device counts that number down.  If it is a 2 digit number it can be stored in a single register.  If it is larger a register pair can be used.  When a button is pressed the number associated with that number is put in the LSN of the register.  The MSN is usually 0.  In other words, if 5 is pressed on a microwave oven or a calculator, the number 05 is placed in a register of the microcomputer. 

If the sequence 5, 4, 3 and 2 were pressed each number would be stored in a separate register. 5 would be consider the most significant digit.  When the start button is pressed, the microcomputer consoldates the 5 and the 4 into a single register, and the 3 and the 2 into a single register.  The 5 in its register is shifted to the left by 4 bits placing it in the MSN of the register.  The 5 and 4 can now be placed in a single register.  Since one register has 50 and the other is 04, they can be scored together to produce 54 in a single register.  This procedure is repeated for the 3 and the 2. 

If 2 ASCII numbers were received via the com port on a pc, it is not as simple as above.  5 is 35h and 4 is 34h. The 3 must be stripped from the MSN, before the 5 is rotated to the MSN position and for 4 the 3 has to be stripped from the MSN position.  To do this of is ended with the 2 ASCII numbers.  This makes the MSN 0 and keeps the LSN as it was.

Another problem that occurs is that the DAA instruction does not work with subtraction.   This means that if 1 is subtracted from 10, the result will be 0fh.  A way around this is to test the result every time one is subtracted from it.  Some microprocessors have an instruction that will test one bit or a group of bits to see if they are 1's or 0's.  The 8085 does not have an instruction that will do this.  The MSN has to be stripped from the number and the LSN tested to see if it is f or not.  The short program below will do this:

Label   nmen   operand           comments

test      mov     h,a       ;save the result in h register

            ani       $0f       ;strip the MSN from the number

            cpi       $0f       ;test the LSN

             jz         fix        ;if the LSN is $0f, then go to fix

fix        mov     a,h       ;put the number in the a reg

            ani       $09      ;make the LSN 09, strip the MSN

            mov     l,a        ;save the LSN

            mov     a,h       ;move the number with f in it to the a reg

            ani       $f0       ;strip the LSN

            ora       l           ;combine the MSN and the LSN

            mov     h,a       ;save the number

246_Develop a BCD Countdown Timer.png

Write a program from the flowchart in the above.  Refer to previous experiments to write the program.  Test each stage after you write it, to make sure that it works properly.

 


Related Discussions:- Write a program to build bcd countdown timer

What is url describe their protocol, What is URL describe theri protocol? ...

What is URL describe theri protocol? URL basicallt stands for uniform resource locator. A URL is a pointer to a particular resource on the Internet at a particular location.

Pseudo code for random numbers, Pseudo code the shows logic for a program ...

Pseudo code the shows logic for a program that generates a random number, then ask the user to think of a number between 1 and 10

C++, fow to I write a emplate that reads a set of numbers typed at the keyb...

fow to I write a emplate that reads a set of numbers typed at the keyboard into an array of T

What is jvm-java virtual machine, What is JVM-Java Virtual Machine  A J...

What is JVM-Java Virtual Machine  A JVM stands for java virtual machine. This is virtual computer or an abstract computer that runs the complied java programs. In fact JVM is

C# xna game project, I need to finish my game project within two weeks usin...

I need to finish my game project within two weeks using XNA. Would you guys can help me to finish it? Thank you

Create an application to run in the amazon ec2 service, In this assignment ...

In this assignment you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application. You

Systems of differential equations, In this section we need to take a brief ...

In this section we need to take a brief look at systems of differential equations which are larger than 2 x 2. The problem now is not like the first few sections where we looked at

Create a clickable map - web operating system, You are required to develop ...

You are required to develop a content management system for the following scenario:   "A Travel Information (NTIK) system is to be designed to allow travellers to access to an elec

Maximization, A company produces three sizes of window fans small, medium a...

A company produces three sizes of window fans small, medium and large. the manager has formulated an LP model for fan production Maximize 6x1+8x2+5x3

Create a raptor program - use class in raptor and in python, In this porti...

In this portion of the lab you will analyze a problem and create a Raptor program to solve it.  Make sure you use a class in Raptor and in Python to solve the problem.  Read the fo

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