Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - It is very urgent to translate the assembly of this ward pager into C language, although the integral is of little help.
It is very urgent to translate the assembly of this ward pager into C language, although the integral is of little help.
; Recently, I am also studying single chip microcomputer. I wrote this according to my own idea, but the circuit diagram is a little different from yours. Mine is also compiled, O(∩_∩)O~

Start:

MOV

P3,#0FFH

MOV

P0,#08H

x:

; Keyboard line scanning

MOV

R 1,# 1

MOV

P2,# 1 1 1 1 1 1 10B

call out

scan

y:

call out

SHRX

call out

scan

incorporated company

R 1

CJNE

R 1,#4,Y

JMP

X

SHRX:

; left shift

MOV

PSW,#0C 1H

; carry flag

MOV

I. P2

RLC

A

MOV

P2

Soak in water to soften

Scan:

; Keyboard column scanning

MOV

P3

XRL

b,#0FFH

; If the row circuit and the column circuit are connected, the column circuit becomes low voltage because the row circuit is low voltage and the column circuit is high voltage. (I don't know why, according to the data, it is related to TTL circuit. I don't know anyway. )

; After inversion, it is judged whether it is greater than 0. If it is greater than 0, press a key.

MOV

A, b

JNZ

print

Soak in water to soften

Print:

; led display

MOV

DPTR, No.600

XRL

P2,#0FFH

; Inverted, the line pressing position is 1, and others are 0.

MOV

I. P2

MOVC

1. @ 1 +DPTR

; Look up the table and convert the binary line code into the line start number.

MOV

DPTR, No.700

MOV

R0,A

; Save one

MOV

A, b

MOVC

I. @ I +DPTR

; Look up tables and encode binary lists into binary values.

Attention Deficit Disorder (ADD)

a,R0

; Add R0 (assigned by A above, which is the starting number of the line) to get the number of the current key.

MOV

b,# 10

discrepancy

AB; Now we separate the ten digits from the single digits for easy display. B is the remainder, that is, single digits, and A is the product, that is, ten digits.

MOV

R 1,A

; Save the value of a, and then the screen will loop.

MOV

DPTR, No.500

Experience English children's reading library

P0.2

; Activate the buzzer in the third position.

PRINT 1:

MOV

a,P0

CJNE

One, # 12, go

; Check whether the reset button is pressed, (er er er er er. Because I don't know the reset circuit for the time being. So I use this instead)

MOV

I. R 1

MOVC

I. @ I +DPTR

; table look-at

Experience English children's reading library

P0.0

; Activate the first LED display.

MOV

P 1,A

; Send a to the P 1 register to activate the display.

call out

stay

Clear (short for clear)

P0.0

MOV

A, b

MOVC

I. @ I +DPTR

Experience English children's reading library

P0. 1

; Activate the second LED display.

MOV

P 1,A

call out

stay

Clear (short for clear)

P0. 1

JMP

PRINT 1

Delay:

; Form visual persistence, resulting in static display.

MOV

R0,#08H

M 1:

MOV

Answer, #0FFH

Digital Equipment Corporation (digital equipment corporation)

R0

CJNE

R0,#0,M2

Soak in water to soften

M2:

Digital Equipment Corporation (digital equipment corporation)

A

JZ

M 1

JMP

The second part of money supply

(organic) organic

500

Form:

; lookup table

decibel

1 1000000B、 1 1 1 100 1B、 10 100 100B、 10 10 100 b、 1 10000B

(organic) organic

600

Table 1:

; Look-up table, binary line indicates the starting number of decimal line.

decibel

0,0,4,0,8,0,0,0, 12

(organic) organic

700

Table 2:

decibel

0, 1,2,0,3,0,0,0,4

end