transfer spin to assem
ratronic
Posts: 1,451
I am trying to pass a number from a spin top obj to an assm servo obj following Graham's data transfer in the
assm step by step routines for an example. My top spin = h48c and the objects I am is using a trimmed down
version of the a48c Tri-axis accelerometer and my own serv1 servo object. I am using 1.5 ms for center. That's
the problem I am having is taking the y axis raw # (which I am) and adding 120000 to it (which I can) and sending it to my serv1 routine (where I am having the problem). I only get the start time # I started it with (1.5ms) . The off time is always set at 20ms. I have tried everything I can think of but I can't seem to update
the on time # (starts with 1.5ms) with y axis # with 120000 to it from the accelerometer routine.· Can anybody look at my code
and tell me why I am going wrong? My end result is I am at the start of a balancing bot and I know I have far to go but this is holding me up. Thanks Dave.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dave Ratcliff· N6YEE
assm step by step routines for an example. My top spin = h48c and the objects I am is using a trimmed down
version of the a48c Tri-axis accelerometer and my own serv1 servo object. I am using 1.5 ms for center. That's
the problem I am having is taking the y axis raw # (which I am) and adding 120000 to it (which I can) and sending it to my serv1 routine (where I am having the problem). I only get the start time # I started it with (1.5ms) . The off time is always set at 20ms. I have tried everything I can think of but I can't seem to update
the on time # (starts with 1.5ms) with y axis # with 120000 to it from the accelerometer routine.· Can anybody look at my code
and tell me why I am going wrong? My end result is I am at the start of a balancing bot and I know I have far to go but this is holding me up. Thanks Dave.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
D RatFix it if ain't broke·
Dave Ratcliff· N6YEE
Comments
Take a closer look at your 'H48C obj.spin' program·and make sure it is·providing the correct return values for 'H48c.y'.... I modified your 'ah48c.spin' to look like this...
... After connecting a scope to pin #7 and manually changing values for 'ya' , the 'serv1.spin' program you provided appears to function properly.
Hope this helps toward diagnosing your problem.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 5/31/2007 3:47:09 AM GMT
My problem is sending the 120000 + y axis which varies by the position of acc chip which is about in the range of +or- 250 +
120000. I can get the total # and display it. But I can't seem to send it to the serv1 object. It doesn't vary the on time of 120000 I started the object which. I can see on the scope it stays at 120000 I started it whith.?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ D Rat
Dave Ratcliff· N6YEE
"I see that you fixed the # by adding the line ya := 120000 , I am trying to update the y axis + 120000. I get that # ok."
Right, I understand that, my test was to make sure that the serv1 object was indeed working properly. Changing ya to 80000 produced a pulse width of 1000uS ...
likewise changing ya to 160000 produces a pulse width of 2000uS.
If the values returned from 'h48c.y' only ranges from +or- 250 then that is likely your problem....
250 + 120000 = 120250 ... divide this by 80 and you get·1503.125 uS for a pulse width
-250 + 120000 = 119750 ... divide this by 80 and you get·1496.875 uS for a pulse width
...a deviation of only 6.25uS is barely enough for a standard servo to register any change at all. Looks like the value returned from h48c.y needs to be scaled to something
the servo can actually recognize.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ D Rat
Dave Ratcliff· N6YEE