Joe Grand's Laser Range Finder--Speed Up
John Abshier
Posts: 1,116
I was disappointed that the time to take a measurement was 1.2 seconds. I started looking at the code. Here is a possible speed up. Tested on a demo board, not the range finder. The code does some byte swapping
I replaced that with this code
Attached is an archive of my test code.
John Abshier
repeat index from 0 to (5119) ' For each long in the buffer... 263 milliseconds val := LONG[fbPtr][index] ' Read value from memory tmp.BYTE[0] := val.BYTE[3] ' move Y0 into array location 0 tmp.BYTE[2] := val.BYTE[1] ' move Y1 into array location 2 LONG[fbPtr][index] := tmp ' write long back into main memory
I replaced that with this code
repeat index from 0 to (5119) ' For each long in the buffer... long[fbPtr][index] <-= 8Original is 264 milliseconds. Rotate version is 117 milliseconds. Savings of 147 milliseconds.
Attached is an archive of my test code.
John Abshier
Comments
Very cool - I'll add this to my list of optimizations. I'm open to any other suggestions people may find, as well. The beauty of an open-source design is allowing lots of sets of eyes (and brains) to examine the inner workings.
I do have a few ideas on how to increase the camera frame rate (currently at a 2MHz pixel clock), which would decrease the time-per-measurement. The current 1Hz sample rate is OK for certain applications, but the faster the rate, the more potential uses there are!
Take care,
Joe
John Abshier
John Abshier
Great! I'll take a look into this. I've also added it to my optimization list and will do some testing (when time permits) on the speed increases. I think these, coupled with some frame grab optimizations, will be a very nice improvement.
Joe
Can't help there.
Thanks!
Joe
Just to be correct, I was responding to the Aculux sensors portion of the post, not the speed of the current Parallax product.
BTW, this link works for me:
http://www.aculux.com/Products.htm