Intel mcs-48 manual Example Program

Models: mcs-48

1 478
Download 478 pages 26.88 Kb
Page 232
Image 232

8155/8156/8155-2/8156-2

EXAMPLE PROGRAM

Following is an actual sequence of program steps that adjusts the 8155/56 count register contents to obtain the count, extracted from Intel@ Application Note AP38. "Application Techniques for the Intel8085A Bus." First store the value of the full original count in register HL of the 8085A. Then stop the count to avoid getting an incorrect count value. Then sample the timer-counter, storing the lower-order byte of the current count register in register C and the higher-order count byte in register B. Then, call the following 8080A/8085A subroutine:

ADJUST,78

MOV A,B

;Load accumulator with upper half

 

 

; of count.

E63F

ANI3F

;Reset upper 2 bits and clear carry.

1F

RAR

;Rotate right through carry.

47

MOV B,A

;Store shifted value back in B.

79

MOV A,C

;Load accumulator with lower half.

1F

RAR

;Rotate right through carry.

4F

MOV C,A

;Store lower byte in C.

00

RNC

;If in 2nd half of count, return.

 

 

;If in 1st lialf, go on.

3F

CMC

;Clear carry.

7C

MOV A,H

;Divide full count by 2. (If HL

 

 

;is odd, disregard remainder.)

1F

RAR

 

67

MOV H,A

 

70MOV A,L

1FRAR

6F

MOV L,A

 

09

DAD B

;Double-precision add HL and BC.

44

MOV B,H

;Store results back in BC.

40

MOV C,L

 

C9

RET

;Return.

After executing the subroutine, BC will contain the remaining count in the current count cycle.

6-89

Page 232
Image 232
Intel mcs-48 manual Example Program