Branch limitations when using includes - diyAudio
Go Back   Home > Forums > General Interest > Everything Else

Everything Else Anything related to audio / video / electronics etc) BUT remember- we have many new forums where your thread may now fit! .... Parts, Equipment & Tools, Construction Tips, Software Tools......

Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 2nd May 2008, 11:13 AM   #1
diyAudio Member
 
Circlotron's Avatar
 
Join Date: Jun 2002
Location: Melbourne, Australia
Default Branch limitations when using includes

Part of my job involves designing hardware and embedded software. I always use assembly language and have just moved up from 'HC05 to 'HC08 micros. I have always written my code as one long sheet of stuff and have never used "includes" that grab external listings of code.

Now, I got to thinking, with a branch instruction you are limited to branching +/- 127 so sometimes you get the "parameter out of range" error if your code is too long. If though, I included several pieces of external code would I still have this branch limitation seeing each section of code is not in a specific place? Or is it, and you have to state where it is?
__________________
Best-ever T/S parameter spreadsheet.
http://www.diyaudio.com/forums/multi...tml#post353269
  Reply With Quote
Old 2nd May 2008, 12:24 PM   #2
diyAudio Member
 
Circlotron's Avatar
 
Join Date: Jun 2002
Location: Melbourne, Australia
Sorry, I should have said *conditional* branch.
The guts of the problem is using things like
BRSET 1,PORTA,LABEL_NAME where that label is too far away.
__________________
Best-ever T/S parameter spreadsheet.
http://www.diyaudio.com/forums/multi...tml#post353269
  Reply With Quote
Old 2nd May 2008, 07:49 PM   #3
diyAudio Member
 
I_Forgot's Avatar
 
Join Date: Jan 2005
Location: Phoenix, Az.
I don't know specifically about HC08s, but I've run into similar problems with smaller PICs that have a limitation of 256 byte - 2kB memory pages. If you try to branch beyond a page boundary, you can run into problems. There are work-arounds such as explicitly loading the upper byte of the program counter before EVERY branch and RETURN instruction, but you would probably have to do that in your included code, too. If your whole program is less than the memory page size, you can issue commands to the assembler to load specific code at specific addresses and thereby prevent accidentally spilling over a page boundary.

There are a bunch of macros people have written for PICs that include things like "long goto", etc. Probbaly some of those for HC08s out there in the tubes of the inter web if you look for them.

The root of the problem is that the program counter isn't big enough to address all the program memory without resorting to paging. I ran into this problem on a project about 6 months ago and ultimately decided to go with a bigger uC ($2 higher price) that has a larger program counter so the memory isn't paged.

This sort of nit-picky stuff is why many people prefer to program in C. Programming in assembly is hard enough without keeping track of all that stuff, too.

I_F
  Reply With Quote

Reply


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
The Limitations of an EL34 in UL alexmoose Tubes / Valves 30 8th May 2010 12:40 PM
LM317 CCS - Any limitations? Archwn Power Supplies 8 16th December 2007 04:12 PM
Why two diodes per branch on a full wave rectifier? photo_marc Tubes / Valves 31 27th August 2006 07:32 AM
50 pieces TDA1543 @ USD2.00each, includes Shipping tone Swap Meet 10 7th May 2003 04:56 PM
TDA1543 @ USD2.00, includes Shipping tone Swap Meet 0 20th January 2003 03:36 AM


New To Site? Need Help?

All times are GMT. The time now is 05:49 PM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright 1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2