HSERVO with Atom pro 28

First, 8.0.1.8 does appear to have a problem with hservo. Of course thats why it is beta.

As for 8.0.1.7 I just downloaded and installed a fresh copy of it and ran this program from above:

ENABLEHSERVO main: sound 9, [100\880, 100\988, 100\1046, 100\1175] hservo [p0\0\0,p1\0\0,p2\0\0] goto main

And it works as I expected. I have 1.5ms servo pulses on p0, p1 and p2 and I have frequecies on p9. I didn’t have a speaker so I looked at the sound out with my scope and it looks like it’s outoputing what I expected.

I also tried this program:

[code]ENABLEHSERVO

i var sword

main:
high p4
high p5
high p6
for i = -10000 to 10000 step 1000
low p4
hservo [p0\i\255]
toggle p6
pause 150
;hservowait [p0]
high p4
next

for i = 10000 to -10000 step -1000
low p5
hservo [p0\i\255]
toggle p6
pause 150
high p5
next

hservo [p0-16000\255]
low p4
low p5
low p6
pause 2000

goto main [/code]

I see a servo pulse on P0 that goes from -10k to 10k and back and then goes to -16k. I also see the toggling of p4, p5 and p6 as appripriate in your program. i’m not sure what you are trying to do but it all appears to be working as expected in 8.0.1.7

If you have 8.0.1.8 installed at the same time as 8.0.1.7 you may have problems. You should not install both at the same time because files from one will overwrite files from the otherone. I installed 8.0.1.7 clean(eg 8.0.1.8 was removed from my computer first) before I ran these programs you guys are having trouble with.

I was just sort-of playing around. At first it sounded like a command may be hanging so I put some toggelling of LEDs on and off to see where it made it. Later it appeared like the servo was being held in some position so I thought I would try moving the servo from one side to another. I did not want to go the full range as I have not checked this servo out. Then I was courious if the servo would be released so I tried the -16000 which is supposed to stop the servo…

I understand it is a beta release, I was just soft-of suprised that no one tried out the brat on this release until now.

Kurt

Awesome, everything works!!
Thank you!!! :smiley:

Looks like my install of 8.0.1.7 must have a problem then. I will un-install then reinstall, man I hate doing that, and I’m sure it will work like it used to. :blush: Sorry to add confusion to the thread… :frowning:

The BRAT tutorial specifically directs the users to load 8.0.1.7, so that’s probably why no one has reported problems with it.

Well it turned out to be the Atom Pro chip itself that was causing the problem. I un-installed then re-installed the 8.0.1.7 editor and it still didn’t work. I put a new chip in and viola hservo would work! Talk about a weird coincidence…

Hey guys,

I came across this post and I think I am having the same problem. I tried running the code on the first response and had the same experience (compiles and downloads fine, but will not play the sound unless I comment both ‘enablehservo’ and the ‘hservo’ command. Also I tried a couple other things such as mservo and servo, following the commands in the BasicMicro manual. Servo worked but not MServo. Oh yeah annnnd P0 through P3 don’t seem to work so I’ve been using P4 and P5 for all my tests. I ran the BBII (I’m using the BBII and Atom Pro) test program with success so I think, especially after reading this post I have a bad chip. Any advise?

oh yes and I am using ATOM-Pro IDE 08.0.1.7

Thanks in advance

It has been awhile since this post. But if I remember correctly, that this was the problem that was caused by a change that Nathan (AcidTech) did that now by default interrupts are not enabled and he forgot to endable them when the HSERVO system was used.

The fix was to add an ENABLE command. For example in the test program, simply add the enable command just before the lable main.

Kurt

Do you mean the ‘enablehservo’ line. I have that one in my code for sure. I also just tried something else, with the Beta version I ran the same prog from above (sound then hservo) and whereas I get nothing with 8.0.1.7 when I use 8.0.1.8 (beta) I still get no servo movement but I do get sound. Weird, huh? I’m stumped.

The EnableHServo line tells the compiler to include the hservo support.

The Enable command tells the processor to enable interrupts, which are needed by HSERVO. He had an issue with the current version, where before he always started out with interrupts enabled. He changed it to have them disabled by default. He fixed the enableHSERIAL support to enable interrupts properly to handle the interrupts he used internally. However in …8 version he had not done so for HSERVO and as such the servos did not work.

So the code should look something like:

ENABLEHSERVO enable main: sound 9, [100\880, 100\988, 100\1046, 100\1175] hservo [p0\0\0,p1\0\0,p2\0\0] goto main

Thanks for your reply kurte, but still no luck. Uninstalled …8 completely, restarted, and installed …7 again. I copy and pasted your code and deleted all of my previous code and still had the same issue. This encouraged me to run a barge of tests, these are the results:

for all of these my servos are plugged into p4 and p5 and all of these progs compiled and uploaded successfully
HSERVO

ENABLEHSERVO enable main: sound 9, [100\880, 100\988, 100\1046, 100\1175] hservo [p4\0\0] goto main
robot, no move, clicks once or twice though, resetting maybe?
HSERVO commented

;ENABLEHSERVO enable main: sound 9, [100\880, 100\988, 100\1046, 100\1175] ;hservo [p4\0\0] goto main
I hear music, tones work and of course no movement
SERVO

main servo p4,1000,50 goto main
works correctly, servo connected to p4 only moves (also if I change it to p5, only the servo connected to p5 moves)
MSERVO

main mservo p4,1000,-1000 goto main
only moves p4 servo, while it should move both p4 and p5 if I’m reading the manual correctly

I also began methodically removing jumpers and retesting just to see what would happen, that didn’t make a difference either. There isn’t some fancy way to run two servos at the same time using just the servo command or even just code to send the right PWM to the correct pins, is there?

I am totally out of ideas, please help

One thing we should also eliminate is the possibility of power issues, which is probably the number one issue.

So what power do you have going to your BB2/Atom Pro? Do you have seperate power going to VS and VL? What jumpers do you have power going to P4 and P5? VS? or VL?

Kurt

Ok so I’ve got two different power sources I’ve tried. The first one is a normal AA holder (4 AA’s in series) and the second one is a rechargeable 6V 17mah batt pack. I took a voltmeter to each of them and found the 4 AA’s to be putting out >5.4V and the batt pack to be putting out >6.0V so I think I am good there.

When I connect the battery packs they are screwed into the VS power posts. As for jumpers I have the VS=VL jumper installed (I found the board gets no power without this installed). And P4 and P5 are both jumped to get VS power.

I am still not sure you are not having power problems. The 4AA battery holders typically have very small wiring and usually not good for servos and the like. I also assume your rechargeable is not 17mah but instead 1700mah…

To test with hservo, you might try without looping back to hservo so quick… Here is part of one I have played with to have a servo move back and forth. Note: I did not compile this from my edits…

ENABLEHSERVO
ENABLE
Sound 9, [100\880]
main:
	hservo [p4\-5000\128]
	hservowait[p4]
	hservo [p4\5000\128]
	hservowait[p4]
	hservo [p4\0\128]
	hservowait[p4)]
	pause 500
	goto main

You should only hear the sound once. If you hear it multiple times you are probably resetting.

Kurt

Hey Kurt,

So first off, yes you are right the battery is a 1700mah and second, I have the battery holder soldered to a switch and an additional wire so the leads being plugged into the power posts are untinned copper wires of about 34 AWG (something around there I forget the exact gauge).

Ok so went I ran the code you provided I got nothing, just a single ‘click’ noise. If I comment out all the enable/hservo stuff, then I hear the tone.

Again, if I use the SERVO comand I can get the servos to run continuously in either direction. I actually had the little guy driving around last night with no issues except that the programming is very inefficient b/c I can’t get HSERVO to work.

I remember reading somewhere one of the versions of the IDE had a problem with Hservo. You might have a problem with the IDE. I recently had issues with the AD hardware not working and to fix my problem, I had to completely uninstall the IDE and then reinstall. Not sure what version of the IDE you are using but I would install version 8018. Also note: you must uninstall all previous versions of the IDE or there can be problems. This bit of advice came from Basic Micro.

After you reinstall the IDE then try Hservo.

Good point:

Try downloading the 8.0.1.11 as that is the one I am using…
basicmicro.com/downloads/software/basicatomprosetup_80111.exe

Kurt

sorry jim i had posted this in another link but soon realised it should have been here. NOT SPAMMING!
**
ok my question:**
Is there a small command that i can use to get the servos to pulse at “1500”

im using ABB2 with BApro and IDE: 08.0.1.7

;-----------------------------[SSC PIN NUMBERS]
P0 ;Rear Right leg Hip Horizontal
P1 ;Rear Right leg Hip Vertical
P2 ;Rear Right leg Knee
P8 ;Front Right leg Hip Horizontal
P9 ;Front Right leg Hip Vertical
P10 ;Front Right leg Knee
P16 ;Rear Left leg Hip Horizontal
P17 ;Rear Left leg Hip Vertical
P18 ;Rear Left leg Knee
P24 ;Front Left leg Hip Horizontal
P25 ;Front Left leg Hip Vertical
P26 ;Front Left leg Knee

thanks.

Correct me is I am wrong, but couldn’t you just use HSERVO to initialize the servos?

This may not be the appropriate place either, as your servos are connected to the SSC-32 and as such you won’t be using the HSERVO command. I think the code you had in the other spot would work although it would hit every pin which may or may not be what you want.

I think the code you had was:

ALL1500 for Index = 0 to 31 serout SSC_OUTPUT,SSC_BAUD,"#",DEC Index,"P1500#"] next serout SSC_OUTPUT,SSC_BAUD,"T200",13] return

You could do it in a similar way but specifiec to you IO pins, possibly indirecting through a byte table. This is the way my hacked up Arm Rover zero program does it. Something like:

[code]
BasePin con P0 ;Base Connection
ShoulderPin con P1 ;Shoulder Connection
ElbowPin con P2 ;Elbow Connection
WristPin con P3 ;Wrist Connection
GripperPin con P4 ;Gripper Connection
WristRotatePin con P5 ;Wrist Rotation Connection (Optional)
IRScanPin con P6 ;IR Scanner pin (optional)

RMotorPin con P10 ;Sabertooth CH1
LMotorPin con P11 ;Sabertooth CH2

NUMSERVOS con 9
ServoTable bytetable BasePin,ShoulderPin, ElbowPin,WristPin, GripperPin, WristRotatePin, IRScanPin, RMotorPin,LMotorPin
swServoVal var sword
i var byte

for i = 0 to NUMSERVOS
serout SSC_OUTPUT,SSC_BAUD,"#",DEC ServoTable(i),“P1500#”]
next
serout SSC_OUTPUT,SSC_BAUD,“T200”,13]
return [/code]

Note: I hacked the code up from what I had as mine does use HSERVO, but the idea is the same.

You of course could do this all with one serout, by blasting it out like:


Kurt
  serout SSC_OUTPUT, SSC_BAUD,"#0P1500#1P1500#2P1500...", 13]

ok great thanks