Not sure if this is what you are looking for, but attached program converts a "degrees" value (and range), to coordinates (X,Y) value, using the sin table.· Understand that this DOES NOT USE FLOTING POINT (FP) MATH.· It uses INTERGER MATH.· Thus, your return value is an integer value.· If you want "FLOATING FOINT" output, then let me know.· I can modify the program to use FP.· Modify the CON (constant) values (degree and range) (in the constant block) to get coordinate value.· You should be able to get an idea from my source code (to help you understand the sin table).· If not, please reply.· Once you start the program, you will need to start "PST" (and “enable” (before 2 seconds) ) to see the results.
This is for my book for beginners
I need to show them how to read a value from the Log, SIN tables etc.
If I can read a memory location, I think I can do the rest.
I don't have a clue as to how one reads a memory location
I may be missing something.
But I do want to do it in SPIN, no PASM
Harprit said...
This is for my book for beginners
I need to show them how to read a value from the Log, SIN tables etc.
If I can read a memory location, I think I can do the rest.
I don't have a clue as to how one reads a memory location
I may be missing something.
But I do want to do it in SPIN, no PASM
Harprit
Fascinating ....
You can read any memory location with something like ... result := word[noparse][[/noparse]$E000]
The fine example tronsnavy posted is written entirely in SPIN ... surely you can translate that.
Thanks guys, that was extremely helpful.
A great big thanks to all.
I can demonstrate what I want in integer math now.
It remarkable how much easier thing are with some expert guidance
Now to convert it to a floating point result.
HSS, Here is an example of using FP math to manipulate the sin table.· If you wish to display a FP value on PST, you must convert any FP value to a string.· Pay close attention to the "attached" objects (to see how the "objects" manipulate the sin table).· I simply modified the program that I sent you earlier (using "objects" from OBX)·.· Did not get a chance to add comments, but I'm sure you can figure it out.· Remember, the "Propeller Object Exchange" is your best friend.· No need to reinvent the wheel.· Good luck. Best Regards, Bob
You can avoid floating point with http://obex.parallax.com/objects/501/ This is the first Fixed-Point object at OBEX. It is faster than FloatMath, does trigonometry without extra COGs, hase the fastes ROM table reader routine ever.
Cheers,
Istvan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Intentionally Left Blank
Post Edited (cessnapilot) : 11/22/2009 7:41:39 PM GMT
Istvan, Nice Object.· Got a chance to look at it last night.· I will certainly use it, from this point forward, for all future ·Math functions.· Have a good one. By the way, I think oral hygiene is over rated.· What say you?
Those are propeller related (chopped) bugs and 100% bio, at least. Oral hygiene is important, that's why we need orally administered alcohol after the flight.
Istvan, Washing "chopped-up" bugs down with alcohol (A high protein treat)... That's got to increase the "halitosis" effect.· A man after my own heart.· Cheers right back at ya. Bob
Comments
I need to show them how to read a value from the Log, SIN tables etc.
If I can read a memory location, I think I can do the rest.
I don't have a clue as to how one reads a memory location
I may be missing something.
But I do want to do it in SPIN, no PASM
Harprit
You can read any memory location with something like ... result := word[noparse][[/noparse]$E000]
The fine example tronsnavy posted is written entirely in SPIN ... surely you can translate that.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Andy
A great big thanks to all.
I can demonstrate what I want in integer math now.
It remarkable how much easier thing are with some expert guidance
Now to convert it to a floating point result.
Regards
HSS
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Here is an example of using FP math to manipulate the sin table.· If you wish to display a FP value on PST, you must convert any FP value to a string.· Pay close attention to the "attached" objects (to see how the "objects" manipulate the sin table).· I simply modified the program that I sent you earlier (using "objects" from OBX)·.· Did not get a chance to add comments, but I'm sure you can figure it out.· Remember, the "Propeller Object Exchange" is your best friend.· No need to reinvent the wheel.· Good luck.
Best Regards,
Bob
Cheers,
Istvan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Intentionally Left Blank
Post Edited (cessnapilot) : 11/22/2009 7:41:39 PM GMT
Istvan,
Nice Object.· Got a chance to look at it last night.· I will certainly use it, from this point forward, for all future ·Math functions.· Have a good one.
By the way, I think oral hygiene is over rated.· What say you?
Those are propeller related (chopped) bugs and 100% bio, at least. Oral hygiene is important, that's why we need orally administered alcohol after the flight.
Cheers,
Istvan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Intentionally Left Blank
Washing "chopped-up" bugs down with alcohol (A high protein treat)... That's got to increase the "halitosis" effect.· A man after my own heart.· Cheers right back at ya.
Bob