Reading an absolute encoder with 9 bit Parallel ouput.. spin code .. need to co
Hi All
Thought I share this project with all you Prop heads..
I have attached a file .. started having a play with an absolute encoder
that we will be using on a little project with a local customer here in OZ..
The encoder has a 9 bit parallel output ( it is a renishaw magnetic absolute encoder)
Very robust device excellent for very harsh enviroment applications.
See the attached file it explains all as to what has been done and what we
would like to do.
Trying to get my brain to come up with a neat way to do this in asm..
Spin is probably fast enough for the initial application but in ASM it would
open up more applications .. like high speed cam controller swithces etc etc ..
Ronald Nollet··· Australia
Thought I share this project with all you Prop heads..
I have attached a file .. started having a play with an absolute encoder
that we will be using on a little project with a local customer here in OZ..
The encoder has a 9 bit parallel output ( it is a renishaw magnetic absolute encoder)
Very robust device excellent for very harsh enviroment applications.
See the attached file it explains all as to what has been done and what we
would like to do.
Trying to get my brain to come up with a neat way to do this in asm..
Spin is probably fast enough for the initial application but in ASM it would
open up more applications .. like high speed cam controller swithces etc etc ..
Ronald Nollet··· Australia
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
for example.. (not real spin code.)
temp :=input
if temp >256
temp := temp-256
(now case structure should be half as small, and thus somewhat faster).
Post Edited (JoannaK) : 2/9/2007 9:44:25 PM GMT
Had another stab at it .. why not break up the code and share the task using 3 COGS.
So have knocked up the attached spin file ... not tested but compiles okay.
First attempt ran okay pretty fast even with all the case statements.
Should run faster now.
Could work even faster with 6 COGS ... need 4 other cogs for something else..
so 3 cogs is the max I wanna use for this project..
Ronald Nollet
Australia
For assembler version.. (1 cog)
- Code size ain't problem.
- Data table could be stored by Nibbles,. => 512 long table would use only 64 Long's of cog memory
For shorter table, see Sin/Cos table lookup routines for reference. There's only one table and that 1/4th of a full circle. In this case.. I'd say 1/2 would be easy and 1/6 quite doable. In this case the table size dosn't matter a lot, but if there were other code running on same cog it might
Have tested the code and wired it up on a PRO DeV board from Parallax· + USB PropStick..
Your right the outa format is the wrong way around.
should be >>········· ·outa [noparse]/noparse]12..9] := Mydata [noparse][[/noparse]ina [noparse][[/noparse]8...0
Works wonderfull... awesome fast ..not·sure how fast it samples·..·but good enough
HAd a lookup table ready for 8 bit gray to dec ready so it was not such a big job after all.
The Propeller editor is cool being able to copy and paste and insert/overwrite/replace ·etc etc
Jeff Martin did a awesome job on that..
Still will work on getting this into asm .. need to sort an algo to do a zone compare function.
Ronald Nollet··· Australia