Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/07/01 20:08
Read: times


 
#17379 - A Decision problem
Dear Friends,

Please check the following program. Any help will be appreciated. Kind Regards.

Nutty Blue


Within the following program values at the registers are integer numbers from 0 to 4, If the contents of 21H register is greater than 3, then the LED which is connected at the OUTPUT1 (at P1.0 pin ) will be on. For that reason it will be set. Values are stored sequentially, starting from 21H register. Four registers, from 21H to 24H controls the pins from 1.0 to 1.3 respectively.

Org 2700h
; decision for the final control element
DECISION: MOV R1,#21H ; comparision value is stored at 21H
DECIDE1: CLC
MOV A,R1
SUBB A,#03H ; 03 is an integer number, If R1 is greater than 3 then
JNC OUTPUT1 ; output1 will be enabled
INC R1 ; R1 is incremented to compare
CLR P1.0 ; the contents of 2nd register
DECIDE2: CLC
MOV A,R1
SUBB A,#03H
JNC OUTPUT2
INC R1
CLR P1.1
DECIDE3: CLC
MOV A,R1
SUBB A,#03H
JNC OUTPUT3
INC R1
CLR P1.2
DECIDE4: CLC
MOV A,R1
SUBB A,#03H
JNC OUTPUT4
INC R1
CLR P1.3
RET
Org 2800h
; Output
OUTPUT1: SETB P1.0
INC R1
AJMP DECIDE2
OUTPUT2: SETB P1.1
INC R1
AJMP DECIDE3
OUTPUT3: SETB P1.2
INC R1
AJMP DECIDE4
OUTPUT4: SETB P1.3
RET




List of 4 messages in thread
TopicAuthorDate
A Decision problem            01/01/70 00:00      
RE: A Decision program - Friends            01/01/70 00:00      
RE: A Decision problem            01/01/70 00:00      
RE: A Decision program - Friends            01/01/70 00:00      

Back to Subject List