Jump to content

Force A Variable To Be Allocated In A Specific Bank


Recommended Posts

FredericG,

Is there a way to force a variable to be allocated in a specific bank?
Yes, by giving it a specific adress, eg

 

char z@0x43;

 

Regards

Dave

Link to post
Share on other sites

I can give any arbitrary value and this will not collide with other variables?

I need this in the ISR, so that more efficient code is generated.

 

I have sometimes seen that the amount of code decreases while I added some code and the other way around. Could this be explained by another distribution of the variables over the banks?

 

Thanks,

Frederic

Link to post
Share on other sites
I can give any arbitrary value and this will not collide with other variables?

I need this in the ISR, so that more efficient code is generated.

 

I have sometimes seen that the amount of code decreases while I added some code and the other way around. Could this be explained by another distribution of the variables over the banks?

 

Thanks,

Frederic

 

 

Yes. The compiler adds temporary variables (you can see them used in the .lst file). Depending on which bank they end up in, you might end up with more or less bank switching code. I have a post on a similar subject somewhere. Forcing a variable to a specific address resulted in a significant reduction in code for me.

 

Orin.

Link to post
Share on other sites

FredericG,

I can give any arbitrary value and this will not collide with other variables?
RAM locations that have associated variables with fixed addresses are not used by the compiler for any other use, so they won't collide unless you have another piece of code that uses a fixed address variable at the same address.

 

Regards

Dave

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...