I don't think so, not normally, I'm working on a odometer project & for me I had to use an XXX,YYY.Z Format, Z being 1/10th mile, YYY being 0-999 miles & XXX being 1k to 999K Miles, all saved as separate data locations. This is how I had to do it. However you could use an XXXX,YYYY,ZZZZ format giving you up to 9999 in each data location.
Joe
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm going insaine. It's SOOOOOO much fun. lol
Post Edited (jknightandkarr) : 8/17/2009 12:19:26 PM GMT
The best way to figure out something like dev/null's program is to work it out on lined paper or even use a spreadsheet. Each column becomes a variable (or element of an array) so you'd have column 1 for idx and columns 2 through 11 for Counter. The first line is the initial condition which is zero for each. Just do what each statement says in order to make line 2 from line 1. Then start over again with the values in line 2. Once you've got the pattern in mind, you can skip ahead to a boundary condition (where the pattern changes), then continue for a while to see the new pattern.
That's good advice Mike. The code counts to 65535 10 times. The variable idx tells you how many 65535's you've counted. If you exit the loop at any point, you will know the total count by multiplying idx by 65535 and adding the last counter:
Total count = Counter(idx-1) + 65535 * (idx -2).
This might be hard to understand, but it's fairly straight forward.
Just for your information, the Total count procedure can't be done in Stamp Basic. If you want to calculate and use a number larger than 65536 you have to use another computer, like your PC. The reason for this is that the Stamp can only hold 16 bit variable. 65535 is what you get with 2^16.
Here is an alternative that keeps the counters in a neat easy to read decimal format for DEBUG display. The low counter rolls over at 10000 and the high counter can go up to 65535 for a total count of 655,350,000. At 10 milliseconds per DO:LOOP, it would take about 75 days to count that up.
counter0 VAR Word
counter1 VAR Word
DO
counter0 = counter0 + 1 // 10000 ' low count rolls over at 10000
IF counter0 =0 THEN counter1 = counter1 + 1 ' increment high count at rollover
DEBUG DEC5 counter1,DEC4 counter0,CR ' display 9 digit result
LOOP
This may or may not be on topic, but since the BS2 has 16 pins, 16 bit. Would the BS2P40 be 32 bit? Since it has 32 I/O pins & there for be capable of doing math more then 65535? Up to around 4,294,967,296 which is 2^32. Like I said may or maynot be off topic.
Joe
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm going insaine. It's SOOOOOO much fun. lol
Post Edited (jknightandkarr) : 8/18/2009 2:48:35 AM GMT
Have you thought about switching to the Propeller? It can handle 32 bits natively (+/- 2 billion roughly).
It is also incredibly easy to learn and FAST!
Comments
Joe
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm going insaine. It's SOOOOOO much fun. lol
Post Edited (jknightandkarr) : 8/17/2009 12:19:26 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
Joe
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm going insaine. It's SOOOOOO much fun. lol
Total count = Counter(idx-1) + 65535 * (idx -2).
This might be hard to understand, but it's fairly straight forward.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
micromegacorp.com/downloads/documentation/uMFPU-V3%20Basic%20Stamp.pdf
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
Joe
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm going insaine. It's SOOOOOO much fun. lol
Post Edited (jknightandkarr) : 8/18/2009 2:48:35 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
Correction: 2^16 gets you 65536; there are, however, 65536 numbers that can be stored with a 16-bit variable, if zero is included.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
http://emesystems.com/BS2math6.htm#counter
i was working on project with BS2 & parallax GPS , the main problem were the values witch are bigger than 65536
i fininshed the project already with some tricks , but the website is really unbelievable
i like Parallax forum because of these new notes every day
thanks to you and to all above how share them knowledge
regards
MECHANO
It is also incredibly easy to learn and FAST!
Doug