Write a program to count continuously in hexadecimal from FFH to 00H in a system with clock frequency 0.5 microseconds. Use register C to set up a delay of 1ms between each count and display output at one of the output ports.
- The hexadecimal counter is set by loading a register with starting number and decrementing it till zero is reached and then again decrementing it to will produce -1, which is two’s complement of FFH. Hence, the register again reaches FFH.
- The 1ms time delay is set up by the procedure shown in flowchart-
The register is loaded with appropriate number such that the execution of above loop produces a time delay of 1ms.
|2000H||MVI B, FFH|
|2003H||MVI C, COUNT|
|2009H||MOV A, B|
The C register is the time delay register which is loaded by a value COUNT to produce a time delay of 1ms.
To find the value of COUNT we do-
TD = TL + TO where- TD = Time Delay TL = Time delay inside loop TO = Time delay outside loop
The delay loop includes two instructions- DCR C (4 T-states) and JNZ (10 T-states)
So TL = 14*Clock period*COUNT
Delay outside the loop includes-
DCR B : 4T
MVI C, COUNT : 7T
MOV A, B : 4T
OUTPORT : 10T
JMP : 10T
Total : 35T
TO= 35*Clock period => 17.5 microseconds
So, 1ms= (17.5+ 7*COUNT)microsecond
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- 8085 program to convert an 8 bit BCD number into hexadecimal number
- 8085 program to convert a hexadecimal number into ASCII code
- 8086 program to convert an 8 bit BCD number into hexadecimal number
- 8086 program to convert a 16 bit decimal number to Hexadecimal
- 8085 program for Linear search | Set 2
- 8085 program to convert a BCD number to binary
- 8085 program to find the element that appears once
- 8085 program to find maximum and minimum of 10 numbers
- 8085 program to search a number in an array of n numbers
- 8085 program to find maximum of two 8 bit numbers
- 8085 program to add two 8 bit numbers
- 8085 program to multiply two 8 bit numbers
- 8085 program to convert an 8 bit number into Grey number
- 8085 program to find the factorial of a number
- 8085 program to count the number of ones in contents of register B
- 8085 program to add two 16 bit numbers
- 8085 program to exchange a block of bytes in memory
- 8085 program to find square root of a number
- 8085 program to find 1's and 2's complement of 8-bit number
- 8085 program to convert 8 bit BCD number into ASCII Code
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : Kartikaybhutani