Hi there,
is there any one that knows 8051 assembly.
I've created a code that a character received on the serial port is compared to a list of characters on the table
that I have definded.
What I need to do is to receive a string from a serial port and compare it to a list of strings.
I will put the code in here
any body that know how to do this please help.
thanks in advance

ORG 0000H
LJMP MAIN

ORG 0023H
LJMP SEARCH

ORG 0030H
;;;;;;;;;;;;;;;;;
MAIN:
;;;;;;;;;;;;;;;;;

LCALL SERIAL_INIT

PRITJE: LJMP WAIT
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;
SERIAL_INIT:
;;;;;;;;;;;;;;;;
MOV A,PCON
SETB ACC.7
MOV PCON,A    ;SMOD=1
MOV SCON,#52H ;ENABLE TI, MODE 1
        MOV TMOD,#20H ;TIMER 1, MODE 2, 8-BIT AUTO RELOAD MODE
        MOV TH1,#-35  ;1200 BPS AUTO RELOAD VALUE
        SETB EA      ;GLOBAL INTERRUPT ENABLE
        SETB ES      ;SERIAL INTERRUPT ENABLE
        SETB PS      ;HIGH PRIORITY FOR SERIAL INTERRUPTS
        SETB TR1      ;START TIMER
        RET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;TRANSMISSION OF ONE CHARACTER IN BAFER (SERIAL PORT)
;;;;;;;;;;;;;;;;
OUTCHAR:
;;;;;;;;;;;;;;;;
JNB TI,$
CLR TI       
MOV SBUF,A
RET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;READING ON SERIAL PORT
;;;;;;;;;;;;;;;;
SEARCH:
;;;;;;;;;;;;;;;;
JNB RI,EXIT
CLR RI
MOV B,SBUF
MOV DPTR,#LIST
MOV R0,#00H
MOV A,'W'

RPT: CJNE A,#00H,PROCEED
MOV DPTR,#MESSG2
LCALL MESSG1
EXIT: RETI

PROCEED: MOV A,R0
MOVC A,@A+DPTR
CJNE A,B,PROCEED1
MOV DPTR,#MESSG1
LCALL MESSG
MOV A,B
LCALL OUTCHAR
LJMP EXIT
PROCEED1: INC R0
LJMP RPT
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;
MESSG1:
;;;;;;;;;
MOV A,#0AH
LCALL OUTCHAR
MOV A,#0DH
LCALL OUTCHAR
MOV R1,#00H

RPT1: CJNE A,#00H,VAZHD2
RET
PROCEED2: MOV A,R1
MOVC A,@A+DPTR
LCALL OUTCHAR
INC R1
LJMP RPT1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

LIST: DB 'A','B','C','D','E','F','G','H','I',00H
MESSG1: DB ' SEARCH COMPLETED SUCCSESFULY, CHAR FOUND : ',00H
MESG2: DB ' THIS CHAR DOES NOT EXIST ON THE LIST',00H


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


END
Posted on 2007-06-22 05:45:00 by stardust
keil (search google) has 8051 sim and is easy to use and test 8051.
I have written complete code for the controller in PC.
It is faster to sim what you need through keil than asking.
Posted on 2007-06-22 15:38:18 by genomist
I just find it so hard and unbelievable to think that there is no one
out there that knows how to do this.

I managed to compare a character that I type on the terminal (that is received from serial port) to the table of characters that I've defined on the code that i published. But I can not find how to do it with the list of words not characters
Ex LIST:    DB  5'Hello' 
              DB  4'8051'

so if i type hello on the terminal the word should be checked and if matched there is a message on the code that will put on terminal the word has been found successfully.

Thanks in advance to all the ones that are trying to help
P.S.
let's lookup this as a challenge, I'm still working on it and if i find how to do it I'll put a code on this forum.
Posted on 2007-06-23 11:20:34 by stardust