#### Equip your Genius

Welcome to the Parallax Discussion Forums, sign-up to participate.

Forum Update - Announcement about May 10th, 2018 update and your password.

# I need uM-FPU V2 help

Posts: 105
edited May 2015
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_StartWrite
Fpu_Write SELECTA, XOP, LEFT
Fpu_Write XOP, LOADONE, FSET
Fpu_Write FWRITEB, TmpW2, ATOF
Fpu_Write FDIV, XOP, RIGHT, FLOAT
Fpu_Wait
Fpu_stop

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
Mike

• Posts: 2,300
edited April 2015
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.

Robert
• Posts: 7,880
edited April 2015
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.

Bean

Esterline Research & Design
thitt@esterlineresearch.com

We offer consulting on the following areas of expertise:
- Parallel Frequency Measurement Equipment
-Frequency Control Products
-Micro-Controller/Processor Products
-Oscillator Testing and Automation

• Posts: 105
edited May 2015
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
thank's
Mike W
• Posts: 105
edited May 2015
Bean
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.

Mike