[sdiy] DSPIC computed branch and include help

Scott Gravenhorst music.maker at gte.net
Mon Feb 22 19:44:59 CET 2016


"Richie Burnett" <rburnett at richieburnett.co.uk> wrote:
 >Your example is exactly what I'm trying to do.  But I have used the 
 >"goto" instruction instead of bra for some reason so it looks like:
 >
 >bra w0
 >goto light_red_led
 >goto light_amber_led
 >goto light_green_led
 >goto light_blue_led
 >
 >etc...
 >
 >I will change the goto instructions to bra and see if it works.

The GOTO Expr instruction consumes 2 words of program memory while the 
BRA Expr instruction uses one word.  This means that a GOTO table as 
shown above cannot work without some additional arithmetic on register 
W0.  If the relative branch range of the BRA Expr instruction is 
sufficient for your needs, it should be used instead of GOTO.

-- ScottG



More information about the Synth-diy mailing list