You might consider:
1. Scaling - as others have said so that you work in some basic unit that is acceptable - probably relates to the maximum error you can tollerate in the stock length.
2. consider using a 'maths co-processor' to handle complex calculations and numbers outside the range of your MCU - Ive had a preliminary play about with the MicroMega chip and it's amazingly powerful.
3. Keypad input. This is what I do:
define OSC 20 ' Define Xtal as 20 MHz, use "HS" for programming
X var byte ' Reusable variable
Y var byte ' Reusable variable
Key_Press var byte ' Keypad Read condition of keypad port
Key var byte ' Keypad Key pressed
Accumulate var word ' Keypad Accumulated input number
TRISD = %01110000 ' D0-D3 driven outputs, D4-D6 read inputs
Main:
gosub Keypad
' Use the returned 4 digit number here
goto Main
'----------------------------------------------------------------------------------------------------
Keypad:
for Y = 1 to 4 ' Accumulate four keyboard numbers
Get_Number:
PORTD = %00000001 ' Apply +5 to first row
for x = 0 to 3 ' Read the columns in turn
Key_press = PORTD & %01110000 ' Isolate the three columns
select case key_press
case %00000000 ' No key pressed
Key = 0
case %01000000 ' Righthand column
Key = 3 + 3*x
case %00100000 ' Centre column
Key = 2 + 3*x
case %00010000 ' Lefthand column
Key = 1 + 3*x
end select
if Key <>0 then Key_Done ' got a result so quit
PORTD = PORTD << 1 ' Moves +5 to rows 2,3 and 4
next X
Key_Done:
if Key = 0 then Get_Number ' No key pressed so do it again
IF Key > 9 then Key = 0 ' Treat the * and # keys as zero
Accumulate=Accumulate*10+Key ' Shift the accumulated result up and add last key press
high Heartbeat : pause 150 : Low Heartbeat
pause 300 ' If key is held down then repeat number
next Y
return
'----------------------------------------------------------------------------------------------------
end
And the circuit diagram of the keypad:
Bookmarks