Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Text string comparison with PIC

Status
Not open for further replies.

koky

Full Member level 2
Joined
May 12, 2001
Messages
145
Helped
11
Reputation
22
Reaction score
8
Trophy points
1,298
Location
Italy
Activity points
1,097
what is the best way for compare text string in assempler with PIC, for example I must receive a 16 char text from uart port and I want to compare it with a series of texts that I have stored in eeprom (or I have stored as movlw)???
 

Using FSR (indirect access) to the string that you received from USART.
Simce
p.s. Tell me the exact problem and i'll try to make code for you in asm. But contact me after Monday
 

HI,

Use the indirect addressing.

For example.

If your 16 text chars are stored from address 0x20

Then

Movlw 0x20
Mowf fsr

Next:
Movf indf,w ; Read the value at address stored in fsr
call compare
incf fsr,f
btfss fsr,4 ; Are you read 16 values
goto next ; NO

your compare routine may be as shown

compare:

sublw N ; you want to compare w with N value
btfsc status,z
; W=N
;W<>N
return

; if w=N then z flag =1(Set)
; if w<>N then flag=0 (clear)


Bye
SphinX Of Egypt
:)
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top