Write a program to build bcd countdown timer, Programming Languages

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.

 

Posted Date: 3/19/2013 2:55:04 AM | Location : United States







Related Discussions:- Write a program to build bcd countdown timer, Assignment Help, Ask Question on Write a program to build bcd countdown timer, Get Answer, Expert's Help, Write a program to build bcd countdown timer Discussions

Write discussion on Write a program to build bcd countdown timer
Your posts are moderated
Related Questions
Extend the AirRaid game, so that the planes drop a bomb on the gun as they go over it. The gun has to move out of the way otherwise it will be destroyed if hit. Provide three lives

Modularity, Abstraction, and Modelling Whether proving a theorem by creating up from lemmas to simple basic theorems to more accurate results, or designing a circuit by creati

1)      Go to Start -> Programs->Accessories->Notepad. 2)      Start with a document type tag & an opening tag. Enter the given line in your doc.

need a program of any multiplication algorithm implemented in assembly language x86 without using mul command

do you solve questions of assigments?

I need someone to make an ER diagram.

I am building wpf application and i want to install this application on a server pc and share it to other pces on a net work , my question is i have static class that contain data

Type of Linear Programming - DEA The Express Dry Cleaners currently has four locations in the Chicago area and willing be opening the fifth in the very near future.  Mr. James,

What is the switch Statement? This is a different form of the multi way decision that It is well structured, but can only be used in certain cases where: 1. Here, Only one var

Problem: (i) Define Remote Procedure Call (RPC). (ii) Explain with diagram how RPC works? (iii) A remote procedure is uniquely defined by (a) Program number. (b)