PDA

View Full Version : store/display very large numbers (700000)



ttease
- 18th March 2007, 21:49
Hi,

Okay, I'm new to the fw thing and have a few questions about storing, incrementing and displaying large numer.

I have a project where a user will enter a trigger-value between 100000-700000 using a keypad. A variable value will be incremented (from 0 to the trigger-value) until the trigger value is reached. Both the trigger value and the incrementing variable value will be stored in EEPROM on a 18FXXXX PIC.

What I question is working (comparing the two and incrementing the variable value) with these values using an 8-bit processor. I need a bit of help getting started. How do I dissect and write a large number in EEPROM and then read and reconstruct this for display on a LCD? This is not a time critical-task, the processor will be sitting idol.

Okay, oaky, I'm a recovering windows programmer and never had to deal with this :-)

I did search the archives and there were 6xx+ threads, if someone can point me to a particular thread(s), it would be appreciated!

thx,

Tim

skimask
- 18th March 2007, 22:08
Hi,

Okay, I'm new to the fw thing and have a few questions about storing, incrementing and displaying large numer.

thx,

Tim

A thousand different ways to do it...
One...use byte values, keep 2 digits in each byte
Byte0 = 0-99 (ones), Byte1 = 0-99 (hundreds), Byte2 = 0-99 (ten thousands), and so on...
Same thing with words...
Word0 = 0-9999 (ones), Word1 = 0-9999 (ten thousands)

If you have to do math on the bytes(words), do the math on one word at a time, roll the 'overflow' into the next byte(word)...
i.e. 50 + 75 = 125 in byte 0, roll the 100 into the Byte1, keep the 25 in byte0...and so on...and so on...

After that, it'll be a piece of cake to display on an LCD using the built LCD commands and same thing for storing the number...