comparing words

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello:

I need to compare a word (in r22 &r20) to 2 constants say 2000 & 3159 & check if it is within this range, taking a branch to do_err if it is not.

Any thoughts on how to code this effciently in assem?
what I've come up with seems quite convoluted

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

Is this Atmel application note any help?

http://www.atmel.com/dyn/resourc...

Especially the next to last section: Compare 16 bit register with 16 bit immediate

You can get a zipped file containing the actual code here:

http://www.atmel.com/dyn/product...

Just scroll down to AVR202 and right click the CD icon.

[edit] I am a little curious why you are posting assembler questions in the GCC Forum? Are you using the GCC assembler?

Regards,
Steve