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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/20/10 15:29
Read: times


 
#173362 - code and comments
Responding to: ???'s previous message

GETCMD:
      MOV A,#0
      ACALL CHAR_IN ;WAIT FOR PC TO SENT A CHARACTER
      CJNE A,#'1',NOT1 ;IF ITS NOT 1 THEN CHECK NEXT POSSIBILITY
SUB1: MOV A, #01h ; TURN ON PORT2 PIN0
      SJMP SUB1234            
;;    SJMP ENDCHK ; avoid undefined ACC behavior of other subroutines
       
NOT1: CJNE A,#'2',NOT2 ;IF ITS NOT 2 THEN CHECK NEXT POSSIBILITY
SUB2: MOV A, #02h ; TURN ON PORT2 PIN1
      SJMP SUB1234             
;;    SJMP ENDCHK ; avoid undefined ACC behavior of other subroutines

NOT2: CJNE A,#'3',NOT3 ;IF ITS NOT 3 THEN CHECK NEXT POSSIBILITY
SUB3: MOV A, #04h ; TURN ON PORT2 PIN2
      SJMP SUB1234                 
;;    SJMP ENDCHK ; avoid undefined ACC behavior of other subroutines

NOT3: CJNE A,#'4',ENDCHK ;IF ITS NOT 4 THEN END CHECK
SUB4: MOV A, #08h ; TURN ON PORT2 PIN3                        
      SJMP SUB1234                 
ENDCHK:
RET

                  
SUB1234:
      MOV P2, A ;TURN ON PORT2 SPECIFY PIN( 0 TO 3)
      ACALL DELAY ; CALL 3s DELAY
      MOV P2, #00h; TURN OFF PORT2 ALL PIN
      SJMP ENDCHK


COUNT EQU -10000 ; THIS IS PUT ON THE HEADER OF CODE

DELAY: MOV R6, #3
AGAIN1: MOV R7, #100
AGAIN2: MOV TH0, #HIGH COUNT
				MOV TL0, #LOW COUNT
				SETB TR0
WAIT: JNB TF0, $
			CLR TF0
			CLR TR0
			DJNZ R7, AGAIN2
			DJNZ R6, AGAIN1
			RET

 



so this is the code with comments and the delay code

;; SJMP ENDCHK ; avoid undefined ACC behavior of other subroutines

may i know what does the ;; at the code do?
can i dont put the ;;?

List of 16 messages in thread
TopicAuthorDate
Question on asm code            01/01/70 00:00      
   2 things            01/01/70 00:00      
   some change            01/01/70 00:00      
      even simpler            01/01/70 00:00      
         thanks for the simplified            01/01/70 00:00      
            yes, and even simpler            01/01/70 00:00      
               code and comments            01/01/70 00:00      
                  ;; ??            01/01/70 00:00      
                     thanks for the explanation            01/01/70 00:00      
   Short?            01/01/70 00:00      
      need some helps            01/01/70 00:00      
         Your circuit should work            01/01/70 00:00      
            Getting Rid Of Power On Relay Energize            01/01/70 00:00      
               Thank You All            01/01/70 00:00      
   document what happens to ACC.            01/01/70 00:00      
      noticed and questions            01/01/70 00:00      

Back to Subject List