When is a lock needed?
lardom
Posts: 1,659
in Propeller 1
My goal is to digitally control the position of a robotic arm that has five DC motors. The idea is to place potentiometers at pivot points along the arm and control them with another set of potentiometers.
I wrote my first PASM object so I could control multiple motors with one cog. The problem is the object seems to hang at odd times.
Ultimately I want to control the arm wirelessly using a controller that mirrors the arm instead of using joysticks.
I wrote my first PASM object so I could control multiple motors with one cog. The problem is the object seems to hang at odd times.
Ultimately I want to control the arm wirelessly using a controller that mirrors the arm instead of using joysticks.
Comments
-Phil
I've never used one myself. I think they are mostly used for common system resource allocating schemes.
Whatever the problem is, a lock is unlikely to help you.
I've never ever needed locks and never used them but recently I had some code from one cog conflicting with a common resource on my main cog. At first glance it looked like it needed a lock around that part of the code to keep it atomic but I hated the idea of that. I solved the problem by using a different method that avoided conflicts in the first place and the code is better and faster.
Even so, the PASM object probably has 'beginner' written all over it.
The cogs all run at the same speed, that which you set at the beginning of the code with the clkmode and xinfreq statements.