Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Jumptable

2005-05-17 by Leon Heller

----- Original Message -----
Sent: Tuesday, May 17, 2005 11:31 AM
Subject: [AVR-Chat] Jumptable

All,

Is it possible to impliment a jump table based on the value read from an IO
port?
What I want is to have a 8 routines, and when the value from a port is read
(3 bit value) it jumps to the appropriate routine, I want to avoid CMP and
BREQ if possible as I need a constant length for this, using multiple
CMP/BREQs would result in a variable excution time.

Oh, I'm doing this in assembler....

Any thoughts?

I've not actually done it but it should be quite easy: something like using the ICALL instruction after setting the Z registers to the start of the jump table and adding the input value to ZL. It's actually more complicated than that, but you should get the idea.
Leon
--
Leon Heller
http://www.geocities.com/leon_heller

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.