Possible to condense this code?
JSGrewal
Posts: 9
Hello all.
I have been working on this code for a humidor controller. It will control the thermoelectric cooler ( Peltier), fans, and a display. I have blatently stolen demo examples I found here from Tracy Allen ( Sensirion Demo) and Chris from Parallax ( LCD Demo and 1302 Demo). Thanks to the both of them! It works fairly well at doing what I want.
What I would like to include is recording min/ max values to the RTCs RAM location for display when a button is pressed. I honestly have no idea how to do that, but I cant even start because I seem to have used all the variable spaces.
Any ideas to condense the code to gain more variable space? Also, any suggestions to use the RTCs RAM? I looked at the code example in the demo, but I havent even tried it since the variables were full. Not to mention it confused the heck out of me...
I have been working on this code for a humidor controller. It will control the thermoelectric cooler ( Peltier), fans, and a display. I have blatently stolen demo examples I found here from Tracy Allen ( Sensirion Demo) and Chris from Parallax ( LCD Demo and 1302 Demo). Thanks to the both of them! It works fairly well at doing what I want.
What I would like to include is recording min/ max values to the RTCs RAM location for display when a button is pressed. I honestly have no idea how to do that, but I cant even start because I seem to have used all the variable spaces.
Any ideas to condense the code to gain more variable space? Also, any suggestions to use the RTCs RAM? I looked at the code example in the demo, but I havent even tried it since the variables were full. Not to mention it confused the heck out of me...
BS2
16K
Comments
I've had to overcome this problem with my BS2e Boe-Bot which I'm determined to push to it's limits - all 8 program slots are nearly full, all work as part of a bigger program (like 8 massive gosubs!) and by using Scratchpad RAM to store the location of the originating program and also the place in the originating program from whence the program execution left, I can almost code as if it was one big program. Any variables which I need to keep between changes of the program slot are written to Scratchpad RAM and then read back in when the program execution changes back to the original program slot.
This does involve sharing of Scratchpad RAM space, but by carefully selecting SP RAM locations, I've managed to avoid too much conflict.
Anyway, according to my calculations and the memory map, you have plenty of variable space left, you have a total of 25 bits!
My best tip for trying to reduce the amount of used RAM is work out the highest value you are likely to require in each variable, and if you can step down from a byte to a nibble for example, do that.
Morrolan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Flying is simple. You just throw yourself at the ground and miss.
"I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image."
Stephen Hawking
memory usage is variable sharing between isolated
subroutines.
humanoido
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support