??? 05/26/09 08:52 Read: times |
#165592 - Loops Something like this Responding to: ???'s previous message |
Thank you very much dear Mahesh!This is helpful for me.I've decided to let the comparing part aside for the moment and try to glow a led if i receive a string of 12 bytes starting with 0A and ending with 0D.For that i made some modifications over the code u provided. I tried it on the board but offcourse it did not work :(.Please help me figure out what i did wrong!!
;I am storing received bytes at RAM address 0x40 onwards pointed by R0 ;bit 00h indicates reception is going on ;bit 01h indicates reception of full tag ID Valid_ID: DB 30h,34h,31h,35h,44h,38h,41h,31h,46h,31h ;this is a valid tag ID 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 MOV R0,#40h ;init counter SETB P2.0 ;the LED must be in off state WAIT_RX: JNB RI, WAIT_RX MOV A, SBUF CLR RI CJNE A,#0Dh,READ_NXT SETB 01h SJMP CHECK READ_NXT: CJNE A,#0Ah, START_RX SETB 00h SJMP WAIT_RX START_RX: JNB 00h, WAIT_RX MOV @R0,A CJNE R0,#4Ah,INC INC: INC R0 SJMP WAIT_RX CHECK: JNB 01h,WAIT_RX SJMP GLOW_LED GLOW_LED: CLR P2.0 SJMP GLOW_LED END |