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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/21/04 17:40
Read: times


 
#65273 - RE: help please
Responding to: ???'s previous message
Hi Mohamed.

I reformatted your code so that it is more readable. Your first instruction is incorrect in that it should be a jump (JMP START) rather than a call (LCALL START) instruction.

You are also missing a loop after your initialization.

Your program fails at that point.

You also need to add comments to the program so that others can understand what it is doing

Regards,

Charles Bannister
ORG 0000H 
	LCALL START 		;; Should be LJMP START here -cb
ORG 0003H 
	LJMP ISR2 
ORG 000BH 
	LJMP DEBOUNCE 
ORG 0013H 
	LJMP ISR 
ORG 0050H 
ISR2: 	CLR EX0 
	MOV TL0,#00H 
	MOV TH0,#00H 
	SETB TR0 
	MOV A,R1 
	INC A 
	MOV R1,A 
RANGE2:CJNE R1,#01H,RANGE3 
	SETB P3.5 
	CLR P3.6 
	CLR P3.7 
	LJMP ER2 
RANGE3:CJNE R1,#02H,RANGE4 
	CLR P3.5 
	SETB P3.6 
	CLR P3.7 
	LJMP ER2 
RANGE4:CJNE R1,#03H,RANGE5 
	SETB P3.5 
	SETB P3.6 
	CLR P3.7 
	LJMP ER2 
RANGE5:CJNE R1,#04H,RANGE6 
	CLR P3.5 
	CLR P3.6 
	SETB P3.7 
	LJMP ER2 
RANGE6:CJNE R1,#05H,RANGE7 
	SETB P3.5 
	CLR P3.6 
	SETB P3.7 
	LJMP ER2 
RANGE7:CJNE R1,#06H,RANGE8 
	CLR P3.5 
	SETB P3.6 
	SETB P3.7 
	LJMP ER2 
RANGE8:CJNE R1,#07H,RANGE1 
	SETB P3.5 
	SETB P3.6 
	SETB P3.7 
	LJMP ER2 
RANGE1:CJNE R1,#08H,RANGE2 
	MOV A,#00H 
	MOV R1,A 
	CLR P3.5 
	CLR P3.6 
	CLR P3.7 
	LJMP ER2 
ER2:	RETI 
ORG 0250H 
DEBOUNCE: 
	CLR TF0 
	CLR TR0 
	JNB EX1, STEX1 
	JNB EX0,STEX0 
STEX1:	SETB EX1 
	LJMP ER3 
STEX0:	SETB EX0 
	LJMP ER3 
ER3:	RETI 
ORG 0350H 
ISR: 	CLR EX1 
	MOV TL0,#00H 
	MOV TH0,#00H 
	SETB TR0 
	MOV A,R0 
	INC A 
	MOV R0,A 

SINE:	CJNE R0,#01H,TRIANGLE 
	CLR P1.0 
	SETB P1.1 
	LJMP ER1 
TRIANGLE:CJNE R0,#02H,SQUARE 
	SETB P1.0 
	CLR P1.1 
	LJMP ER1 
SQUARE:	CJNE R0,#03H,SINE 
	MOV A,#00H 
	MOV R0,A 
	CLR P1.0 
	CLR P1.1 
	LJMP ER1 
ER1: 	RETI 
ORG 0500H 
START: 	MOV R0,#00H 		
	MOV R1,#00H 		
	MOV SP,#02FH 		
	MOV IE,#087H 		
	MOV TMOD,#01H 		
	MOV IP,#07H 
	SETB IT1 
	SETB IT0 
	;; This part of program requires a loop
	;; loop1:	...
	;;	...
	;; loop2:    SJMP LOOP1
END 


List of 8 messages in thread
TopicAuthorDate
help please            01/01/70 00:00      
   RE: meaningless subject            01/01/70 00:00      
   RE: help please            01/01/70 00:00      
   RE: help please            01/01/70 00:00      
      Take care of yourself..            01/01/70 00:00      
         RE: Take care of yourself..            01/01/70 00:00      
            None of which brings us to...            01/01/70 00:00      
               RE: None of which brings us to...            01/01/70 00:00      

Back to Subject List