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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/26/09 06:16
Read: times


 
#165587 - Loops Something like this
Responding to: ???'s previous message
Dear Popa,

Note: This is not the only way. Also this may not be perfect. But it should give you some idea.


;considor following

;I am storing received bytes at RAM address 0x40 onwards pointed by R0
;bit 00h indicates reception is going on

Valid_ID: DB 30h,34h,31h,35h,44h,38h,41h,31h,46h,31h   ;Is this correct???
                                                     ;this is a valid tag ID

RX_ID: ds 10	;ONLY IF I DONT HAVE COMPLETE COMMAND OVER CODE

AJMP START

START:  MOV TMOD,#20h
        MOV SCON,#50h
        MOV TH1,#0F4h		;UART is configured for desired BAUD
        MOV TL1,#0F4h
	MOV SP, #60h		;Initialise Stack Pointer 
        SETB TR1			;Run T1 for BAUDRATE Generation

;If I have total command over program I will do something like this
        MOV R0,#40h    ;init counter
;If I dont have total command then I will do something like this
		MOV R0,#RX_ID

        SETB P2.0                ;the LED must be in off state

WAIT_RX:
		JNB RI, WAIT_RX

		MOV A, SBUF
		MOV R2, A
		CLR RI
		CJNE A,#0Dh,READ_NXT
		ACALL COMPARE
		SJMP WAIT_RX

READ_NXT:
		CJNE A, #0Ah, START_RX
		SETB 00h
		SJMP WAIT_RX

START_RX:
		JNB 00h, WAIT_RX
		CJNE R0, #4Ah, NO_SAVE	;or CJNE R0, #RX_ID + 0Ah, NO_SAVE
		MOV @R0, A
NO_SAVE:
		INC R0
		SJMP WAIT_RX

COMPARE:
		CJNE R0, #4Ah,NO_MATCH	;or CJNE R0, #RX_ID + 0Ah, NO_MATCH
									;if total bytes received in not 10 then mismatch
		MOV R2,#00h
		MOV R0,#40h ;or MOV R0,#RX_ID
		MOV DPTR,#Valid_ID

CMP_NXT:
		MOV A,R2
		MOVC A,@A+DPTR
		CJNE A,@R0,NO_MATCH

		INC R0
		INC R2
		CJNE R2,#0Ah,CMP_NXT

		CLR P2.0					;GLOW LED

NO_MATCH:
		CLR 00h
		RET

END

 


Regards,
Mahesh

List of 54 messages in thread
TopicAuthorDate
Project using 89s52            01/01/70 00:00      
   RET (Where?)            01/01/70 00:00      
      Loops?            01/01/70 00:00      
         Loops?            01/01/70 00:00      
            with a quick glance            01/01/70 00:00      
               with a quick glance            01/01/70 00:00      
                  search for ...            01/01/70 00:00      
            Loops Something like this            01/01/70 00:00      
               School work?            01/01/70 00:00      
                  Nope            01/01/70 00:00      
               Loops Something like this            01/01/70 00:00      
                  ?...Doesnot Work...?            01/01/70 00:00      
                     ?...Doesnot Work...?            01/01/70 00:00      
                        Correct            01/01/70 00:00      
                        You sure you get a line feed before RFID?            01/01/70 00:00      
                            You sure you get a line feed before RFID?            01/01/70 00:00      
                              Try This            01/01/70 00:00      
                                 Try This            01/01/70 00:00      
                                 error            01/01/70 00:00      
                                    it's bible time            01/01/70 00:00      
                                       it's bible time            01/01/70 00:00      
                                    Is it ERROR or DOUBT???            01/01/70 00:00      
                                       Is it ERROR or DOUBT???            01/01/70 00:00      
                                 Compare            01/01/70 00:00      
                                    Simulate your function.            01/01/70 00:00      
                                       Simulate your function.            01/01/70 00:00      
                                          Use the free Keil C compiler Evaluation            01/01/70 00:00      
                                    COMPARE            01/01/70 00:00      
                                       compare            01/01/70 00:00      
                                          Still not out of time for C            01/01/70 00:00      
                                             Still not out of time for C            01/01/70 00:00      
                                                Read up on pointer            01/01/70 00:00      
                                                   Read up on pointer            01/01/70 00:00      
                                                      Me or you?            01/01/70 00:00      
                                                   Or do not use a pointer            01/01/70 00:00      
                                                      working code            01/01/70 00:00      
                                                         Describe your work process            01/01/70 00:00      
                                                            v            01/01/70 00:00      
                                                               Did you read? Did you debug?            01/01/70 00:00      
                                                         Why dont you define correct id in "code" space            01/01/70 00:00      
                                                            Hoping to get someone relegated?            01/01/70 00:00      
   Reading or Transmitting Data            01/01/70 00:00      
      Reading or Transmitting Data            01/01/70 00:00      
   a trip to the wild blue younder            01/01/70 00:00      
      This is where it gets lost            01/01/70 00:00      
   The fundamental problem is...            01/01/70 00:00      
      Same as its always been,            01/01/70 00:00      
         Yep I cannot think            01/01/70 00:00      
            Yep I cannot think            01/01/70 00:00      
               Why too late?            01/01/70 00:00      
            for a simple task ...            01/01/70 00:00      
               More than one way to skin a cat            01/01/70 00:00      
                  my $0.02            01/01/70 00:00      
                     If you can not code it in ASM ...            01/01/70 00:00      

Back to Subject List