Maximum Amount of Variable ?
Duke
Posts: 21
Hello,
I'm a Basic Stamp 2P novice, I've been·working with a pulse detect device (Photo interupter + disc).
I would like to know·is the memory of Basic Stamp 2P enough to keep the data of 200 train pulses,
So that I count use these data to calculate later ex. Average, Max ,Min.
Like this..
w1=5.7 ms
w2=6.3 ms
w4=8.5 ms
...
w200= 11.3
or can I store these data into array
Thank you in advance.
Duke..
I'm a Basic Stamp 2P novice, I've been·working with a pulse detect device (Photo interupter + disc).
I would like to know·is the memory of Basic Stamp 2P enough to keep the data of 200 train pulses,
So that I count use these data to calculate later ex. Average, Max ,Min.
Like this..
w1=5.7 ms
w2=6.3 ms
w4=8.5 ms
...
w200= 11.3
or can I store these data into array
Thank you in advance.
Duke..
Comments
·· You don't need to store 200 pulses to calculate Average, Min and Max values.· You can do that on the fly using·maybe 4·variables.· One could store the Min value, one could store the max value, one could store the current value, and one to keep a running average based on the current value.· You could also store 5 samples at a time and run that average into a variable.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Thank you,
Im sorry but my question is not so clear about the propose of those data.
I will use them for Max Min Average and .. Data Recall. As I finished monitors those pulse 1 time I want to see the serie data in backward.
Like this..
w200=11.3 ms
press a button then show
w199=10.5 ms
...
In this case, how many data can I store or do I have to learn to keep them in EEPROM address
Please help.
Duke..
·· If they are BYTE sized data, you have 26 BYTES available, if you don't use any other variables, which is unlikely.· If they're WORD sized, you have 13 WORDS.· Now, storing them in EEPROM may be possible depending on how fast the data is coming in, and exactly how much you need to store.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
You could also use the BS2 to take data, then immediately send it to a PC using the "SEROUT 16" command. Then save and do the math on the PC.
FOR idx=0 TO 126
GOSUB detect_pulse
PUT idx,result ' 57 for 5.7 milliseconds and so on, 63, 85 ... 113
NEXT
FOR idx=0 TO 126
GET idx,result ' 57 for 5.7 milliseconds and so on, 63, 85 ... 113
DEBUG DEC result/10,".",DEC1 result,CR
NEXT
If you use the Stamp's internal eeprom, remember that the Stamp pauses until the WRITE completes, a delay ususally of around 5 miliseconds. If you use an external eeprom, the Stamp could aquire a new reading while the eeprom is still busy writing the old one, so the throughput could be faster. That is an issue only if the pulses follow one another closely. If you do use eeprom, be sure to implement a scheme that rotates around the entire eeprom space, that is, don't start each and every run at address zero. For each new run, start at a base address above the last run, and come back to the beginning only when the eeprom is full. A 32k eeprom could last a long time with that strategy.
I use an AT45 flash memory chip on my data loggers, and it has 528 bytes of RAM for this kind of buffering, apart from the flash memory.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com