Physics, asked by sankarsaranya2016, 6 months ago

Write a counter program to count continuously from 0 to 99 in BCD with a delay of 750ms between each count. Display the count at an output port.

Answers

Answered by ravilaccs
0

Answer:

The count at an output port is given by 17.5 microseconds

Explanation:

  • 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 the flowchart-

The register is loaded with an appropriate number such that the execution of the above loop produces a time delay of 1ms.

Program:

Address Label Mnemonics

2000H  MVI B, FFH

2002H NEXT DCR B

2003H  MVI C, COUNT

2005H DELAY DCR C

2006H  JNZ DELAY

2009H  MOV A, B

200AH  OUTPORT#

200CH  JMP NEXT

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 the loop

The delay loop includes two instructions- DCR C (4 T-states) and JNZ (10 T-states)

So TL = 14*Clock period*COUNT

=> 14*(0.5*10-6)*COUNT

=> (7*10-6)*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

Attachments:
Similar questions