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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/08/01 06:05
Read: times


 
#17396 - RE: A Comparision program needs check
This is what you do:
If the first value is greater than 03H, you jump to COUNT label.
There you prepare the next pointer to "samples area" and load R1 register with the content of R4 + 02H !!.
Then you decrement R5 and if is not the last "sample" to be checked, you jump to COMPARE routine again.
There, you reset the R4 value !!!!!.

Did you see what I see ?
Looking at your post "How can I do main program from subroutines ?", before geting sucesive compare, you load R1 with 21H.
There you want to put compare results which you will test in DECISION routine. I'm right ?
If the second sample is greater than 03H you jump again to COUNT. But with R4 value equal to 00H.
Thus for two succesive sample that are greater than 03 you overwrite R1. I want to say the area pointed by R1 because this is your first mistake. You load R1 register and not the RAM pointed by R1.
The second one is the overwriting that I talk above. You can avoid this leaving MOV R4, #00H outside from COMPARE routine, at the begining.
You can change, too.
From :
MOV A,R4
MOV R1,A
To:
MOV R1, R4

Regards,
Silviu


List of 2 messages in thread
TopicAuthorDate
A Comparision program needs check             01/01/70 00:00      
RE: A Comparision program needs check             01/01/70 00:00      

Back to Subject List