I need uM-FPU V2 help

Mike WMike W Posts: 105
edited 2015-05-12 - 09:27:14 in Microcontrollers
Forum members

I am trying to implement the use of the uM-FPU V2 Coprocessor into a project I got involved in. And I will admit it is way over my head.
I happened to still have a SX48 PROTO BOARD and an uM-FPU V2 Coprocessor sitting in my parts box and thought this would finally be a good project for the both of them. Having built two infrared sensors and by mounting them one foot apart I could easily keep track of the time an object takes to move between them.

I am using this line of code to configure the interrupt.
INTERRUPT 10_000 ' ISR rate is 0.1ms = .00001 us
' =========================================================================
I think I am calling an interrupt every .1 ms this should give me a precision of .00001 microseconds.
Counting starts with a pulse at Sensor1 and stops with a pulse at Sensor2,
Then the count is stored in TmpW2.

Using the formula: Velocity = Distance / Time
1 foot in .00005 microseconds = 2000 Feet Per Second.
1 foot in .1 microsecond = 10 Feet Per Second.
These limits would be all that would be needed.

Here is where I need the help I am asking for!

When counting stops.
I then want to send TmpW2 to the uM-FPU.

1) Convert it to floating point and put the 5-digit value to the right of the decimal point.
2) Invert that number (INVERSE) to the uM-FPU {TmpW2 = 1 / TmpW2}
3) Return TmpW2.

After the conversion, the value of TmpW2 will be displayed on a 5 digit - seven-segment display,

Formatted to display ####.# Feet Per Second.

My last attempt to achieve this is listed below.

TmpW2 = 00081 ‘as an example number - needs to be .00081

Fpu_Write FWRITEB, TmpW2, ATOF
TmpW2 = Fpu_ReadWord

Print_float TmpW2 ‘ Output should read 1234.5

I know that the SX has reached the E.O.L. but I was hoping that some of you older members might be able to send some help my way

For Now


  • RobotWorkshopRobotWorkshop Posts: 2,300
    edited 2015-04-27 - 07:48:13
    Hello Mike,

    It has been a while since I have had to do some wok with the SX48 chips but I do have a few comments that I hope will help. Are you writing your SX48 code in SX/B or in Assembler? Can you post some of your code? Having the actual code may help people comment.

    Concerning the Interrupt code one thing to keep in mind is that all the code in the ISR needs to complete before the next Interrupt occurs. If not then you'll have all sorts of issues.

    For keeping track of the time you could probably do that in an ISR or you may be able to leverage the timers in the SX48 to capture the elapsed time. It may be cleaner and easier using the timers.

    How are you going to talk to the FPU? It was common to use the ISR to implement a Serial port. If the FPU is serial you may want to use the ISR Serial routine for that and a timer for the counting.

  • BeanBean Posts: 8,028
    edited 2015-04-28 - 05:24:50
    If your counts are in 0.1mSec, then speed in feet per second is 10,000 / counts.

    If you want 0.1 feet resolution then take the remainder and multiply it by 10 then divide by counts.

    The uFPU is kind of overkill for this.

  • Mike WMike W Posts: 105
    edited 2015-05-02 - 16:12:12
    Forum Members
    I thank you for your responses
    I have just experienced a computer crash
    and I am trying to get a new machine up and running
    I should be back in a couple of days
    Mike W
  • Mike WMike W Posts: 105
    edited 2015-05-12 - 09:27:14
    No doubt about it, simple problem simple solution.
    Thank You.
    When I got involved in this project I thought It would be
    a perfect place to use the uFPU I had sitting in a box of components.
    I really never thought about if I needed it or not, I thought it would
    be neat to use.

Sign In or Register to comment.