Hmm, the malloc version returns 318, if I replace the memoryTest function with the following I get 381. I suspect the stack pointer version is not as future proof or accurate though. But it may still be useful enough. Your *10 malloc version also highlights the fact that the free memory may not be contiguous, since that returns only 170 bytes free when retrieved in 10 byte chunks.
Code:
extern int __bss_end;
extern int *__brkval;
int memoryTest(){
int free_memory;
if((int)__brkval == 0)
free_memory = ((int)&free_memory) - ((int)&__bss_end);
else
free_memory = ((int)&free_memory) - ((int)__brkval);
return free_memory;
}
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
Actually I did several ram optimizations and the malloc version did not register a change, but the above function showed 484 bytes free. And you are having issues with the malloc version, so lets go with the above function till it bites us I'll put it in the next version.
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
FYI, I currently have set up two guinos on the same signal generator running to see if there is any consistency. I expect the injector open times will be slightly different due to frequency variations, but the injector and vss counts should be very close and so far they are, but will let it run for a few days. Also it is all rigged to run on the one 7805, hence the heat sink wedged behind it I will try and leave it alone for a day or so.
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
You may need to mechanically affix the heat sync to the 7805. Something like a small screw, alligator clamp, etc. should do the trick and help dissipate the heat.
If/when you get your scope, hopefully it's a 2+ channel. Then you could run up both and look at the signals. You should be able to see any variance or drift.
But, then again, maybe it doesn't matter... It's only used for bench testing.
Update:
@ 511 minutes:
trip MPG on green unit 64.80
trip MPG on blue unit 64.79
Distance on both 270.21
Injector and vss counts in synch
MPG variance %0.015
7805 seems happy.
__________________
WINDMILLS DO NOT WORK THAT WAY!!!