Micromega uM-FPU Coprocessor output question
Hello All,
I have a question about the way my Micromega uM-FPU Coprocessor is outputting / calculating values. I am trying to do the Log (base 10) of a number, but the issue is only numbers under 100 are calculated correctly. Anything above 100 is output as **.*****· (my format is 85) with the exception of the number 300. When 300 is calculated it outputs the same value as the Log of 44 which is·1.64345. I've been reading through the manual over and over and I'm sort of stumped as to what to do to correct this problem. I'll post the code·that I wrote to use with the sample umfpu-spi.bs2 program that is provided.
" DO
· DEBUG CR, "Enter a number: "
· SERIN 16,84,[noparse][[/noparse]DEC CalcLog]
· SHIFTOUT FpuOut, FpuClk, MSBFIRST, [noparse][[/noparse]LogNum, LONGBYTE, CalcLog, LOG10]
· SHIFTOUT FpuOut, FpuClk, MSBFIRST, [noparse][[/noparse]LogNum]
· format = 85·············································· ' Determines how many values are shown; Tens digit stands for the total #
······························································· ' of variables to display, ones digit stands for the amount of decimal
······························································· ' places that are to be displayed. As an example, 51 stands for (5) total
· GOSUB Print_FloatFormat·····························' characters displayed, with (1) decimal place
· LOOP
· END "
If anyone has any ideas I'd be appreciative of a response..
·
I have a question about the way my Micromega uM-FPU Coprocessor is outputting / calculating values. I am trying to do the Log (base 10) of a number, but the issue is only numbers under 100 are calculated correctly. Anything above 100 is output as **.*****· (my format is 85) with the exception of the number 300. When 300 is calculated it outputs the same value as the Log of 44 which is·1.64345. I've been reading through the manual over and over and I'm sort of stumped as to what to do to correct this problem. I'll post the code·that I wrote to use with the sample umfpu-spi.bs2 program that is provided.
" DO
· DEBUG CR, "Enter a number: "
· SERIN 16,84,[noparse][[/noparse]DEC CalcLog]
· SHIFTOUT FpuOut, FpuClk, MSBFIRST, [noparse][[/noparse]LogNum, LONGBYTE, CalcLog, LOG10]
· SHIFTOUT FpuOut, FpuClk, MSBFIRST, [noparse][[/noparse]LogNum]
· format = 85·············································· ' Determines how many values are shown; Tens digit stands for the total #
······························································· ' of variables to display, ones digit stands for the amount of decimal
······························································· ' places that are to be displayed. As an example, 51 stands for (5) total
· GOSUB Print_FloatFormat·····························' characters displayed, with (1) decimal place
· LOOP
· END "
If anyone has any ideas I'd be appreciative of a response..
·
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
Try adding a line SEROUT 16, 16864, [noparse][[/noparse]"Your number is: ", DEC CalcLog, CR]
and see what the number the program is trying to use actually is.
I'm wondering if it has anything to do with the way the number is converted into a float?