P2 Floating Math with Power function
I have found a couple floating point math objects for the P2, but none of them contain the Power function. The attached object from Total Spectrum contains a power function, but it is commented out as under development. It appears the Catalina plugin contains a power function, but I don't know how to use the plugin in Spin. Does anyone have a floating point math object that has the power function for the P2? I only need trunc, abs, add, sub, mul, div, and power. I have found solutions (with this groups help) for all the other PASM routines I was using with my application on the P1 , except for this last hurdle of calculating my swr using the power function. Once I get past this, I think I will be in a position to start moving my application from a P1(Spin) to a P2(Spin2) with the new solutions.
Comments
There's a whole thread on this subject, with 3 different implementations posted in the first message. As noted there, BinFloat is pretty complete and includes an FPow() function.
The BinFloat object is also in the github OBEX.
I was under the impression that the BinFloat only handled integer exponents. I need to solve 10 to the power of x, where 0<x<1, i.e. 10 to the power of .312 , so I thought that BinFloat wouldn,t work. Am I wrong?
What gave you that impression? Is there something misleading in the documentation or comments? The BinFloat FPow() function accepts any arguments.
No, the documentation is not misleading if you read ALL of it(my bad), I had not taken a close look at BinFloat, I was focused on DecFloat. Now that I have downloaded your complete zip file from Mar22, and am using the BinFloat object, I am getting the right answers that I was looking for, thanks for pointing me in the right direction. I would like to understand your use of the Send command, because I cannot get anything out of the testbin program. I thought it was simply opening a PST window in the Propeller Tool which work off the same assigned pins, but that doesn't work. How do I see the text the Send statements are sending out through the serial smart pins?
Send does send data to the regular serial ports, at least as set up in my demos (with send := @ser.tx, after ser is set up at 230400 baud).
I'm used to running code with loadp2, which has a built in terminal and hence doesn't need any delay. If you're using a separate terminal program you'll probably need to insert a "waitms(2000)" or something similar into the main Spin function before the ser.start() call, to give time for opening up the new terminal.