Yahoo Groups archive

AVR-Chat

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

Message

Re: [AVR-Chat] Jumptable

2005-05-17 by Paul Maddox

Leon,

Thanks, I hadn't spotted that in the instruction set.
Just looking at IJMP, it may be simpler to use, no pushing/pulling from the 
stack and its 1 less clock cycle (speed is king)...

Paul

----- Original Message ----- 
From: "Leon Heller" <leon.heller@dsl.pipex.com>
To: <AVR-Chat@yahoogroups.com>
Sent: Tuesday, May 17, 2005 12:05 PM
Subject: Re: [AVR-Chat] Jumptable


  ----- Original Message ----- 
  From: Paul Maddox
  To: AVR-Chat@yahoogroups.com
  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.