BS2p40 variable space
Lloyds
Posts: 75
Hi,
I'm running out of variable space with the BS2 also. I've tried using constants and am careful with the size argument, but still, I'm barely squeaking by. I've fiddled with the size argument and have been able to bounce between Ok and not enough space.
I'm considering going to the BS2p40. I could make use of the 16 extra I/O pins but am confused about the availability of the extra RAM.
Page 82/83 of the Syntax manual shows 32 total bytes of Ram in the BS2, with 26 that I can use for variables. It says the p40 has 38 total bytes, so does that mean I'd have 6 more bytes for variables? But on the comparison charts, it looks like the 6 extra bytes are for pin assignments for the extra 16 pins only.
Bottom line... is it possible to get more variable space with any of the BS2 family?
Thanks,
Lloyd
I'm running out of variable space with the BS2 also. I've tried using constants and am careful with the size argument, but still, I'm barely squeaking by. I've fiddled with the size argument and have been able to bounce between Ok and not enough space.
I'm considering going to the BS2p40. I could make use of the 16 extra I/O pins but am confused about the availability of the extra RAM.
Page 82/83 of the Syntax manual shows 32 total bytes of Ram in the BS2, with 26 that I can use for variables. It says the p40 has 38 total bytes, so does that mean I'd have 6 more bytes for variables? But on the comparison charts, it looks like the 6 extra bytes are for pin assignments for the extra 16 pins only.
Bottom line... is it possible to get more variable space with any of the BS2 family?
Thanks,
Lloyd
Comments
Typically people use the same variables in different parts of their programs using what's called an "alias" to make the naming more sensible. You can have several different names for the same variables. You can also have one name for a word and two other names for the two bytes of the word. You can have 4-bit variables (nib) and named bits when the values to be used will fit in the smaller space. All of this can help, but you're still limited by the 13 word (26 byte) limit.
If your application really can't be fit into this constraint, you may have to move to something like the Propeller which has much more space available although it's programmed differently.
Thanks for the info. I read about the aliases and size, and also about modifiers like HIGHBYTE AND LOWBYTE. Sounds like I just need to experiment and find some solutions.
But I am now wondering about modifiers. If I define a new variable that is made using a modifier on a previous larger variable, does the new variable occupy its own new variable space, or does it use the same space as the original variable? In other words, does using modifiers allow you to cheat and get extra variables without using more RAM?
Thanks,
Lloyd
Got it. This gives me some options to try.
Thanks,
Lloyd
The BS2pe is my favourite Stamp!