Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Why this code not get input true?

Status
Not open for further replies.

panda1234

Full Member level 2
Full Member level 2
Joined
Jan 22, 2015
Messages
125
Helped
4
Reputation
8
Reaction score
4
Trophy points
18
Activity points
1,172
Hi,
In below code i want to get 4 digit(First digit 1 then digit 2 then user press * and then digit 3 and then digit 4 and the press #) and i want to save data in R7 R6 R5 R4 but below code wrong?(in simulation R6 is equal to firtst digit)
why?
Thanks
PHP:
[PHP]ORG 0
	LJMP MAIN
	EX0ISR:   
	    
		MOV A,R0
		ADD A,#1
		MOV R0,A
		CJNE A,#1,Number_2
		ACALL Scan
		MOV A,R1
		MOV R7,A
			RETI
			Number_2:
            MOV A,R0			
		    CJNE A,#2,Nothing
		   ACALL Scan
		   MOV A,R1
		   MOV R6,A
			RETI
			Nothing:
			MOV A,R0
			CJNE A,#3,Number_3
			RETI
			Number_3:
           MOV A,R0			
		    CJNE A,#4,Number_4
		ACALL Scan
		MOV A,R1
		MOV R5,A
			RETI
			Number_4:
             MOV A,R0			
		    CJNE A,#5,Start
		ACALL Scan
		MOV A,R1
		MOV R4,A
			RETI
			Start:
	RETI
	ORG 0060H
		MAIN:
        MOV A,#00000111B	
        MOV P2,A		
		MOV IE,#85H
		SETB IT0
		SETB IT1
		MOV P1,R6
			SJMP MAIN
				
			
			Scan:
			MOV A,#11111111B		
        MOV P2,A	
			CLR P2.0	
		JB P2.3,J1
			MOV R1,#3
			J1:
			JB P2.4,J2
			MOV R1,#6
			J2:
		    JB P2.5,J3
			MOV R1,#9
			J3:
		   JB P2.6,J4
			MOV R1,#10
			J4:
		   SETB P2.0
		   CLR P2.1
		   JB P2.3,J5
			MOV R1,#2
			J5:
			JB P2.4,J6
			MOV R1,#5
			J6:
		    JB P2.5,J7
			MOV R1,#8
			J7:
		   JB P2.6,J8
			MOV R1,#0
			J8:
			SETB P2.1
		    CLR P2.2
		   JB P2.3,K1
			MOV R1,#1
			K1:
			JB P2.4,K2
			MOV R1,#4
			K2:
		    JB P2.5,K3
			MOV R1,#7
			K3:
		   JB P2.6,K4
			MOV R1,#11
			K4:
		RET
		
		
		END
[/PHP]
 

I write comments :D but i don't see the problem.
 

Well I can't see them!

A list of instructions like that means nothing without comments to give us a clue about what each line or routine is trying to achieve.

Brian
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top