HSERVO Command...

Yep, I know this is an old thread, but probably needed to post this somewhere!

With the current versions of studio, the command: GetHSERVO
no longer exists, It has been replaced by two new commands.

HSERVOIDLE pin
returns the IDLE state of the servo(eg not Zero if the servo is idle(holding position)

example:
	HSERVO [0\10000\100]
	while(hservoidle(0)=0) ;loop until the servo becomes idle
	   ;do stuff here
	wend

and

HSERVOPOS pin
Returns the current position of the specified servo

example:
	HSERVO [0\10000\100]
	while(hservopos(0)<>10000) ;loop until the servo reaches 10000
	    ;do stuff here
	wend

So there are several programs that will need to be modified in order to compile and run on the current versions of studio!

Kurt

I like the new commands. It’s a bummer that current programs that use GetHSERVO will have to be rebuilt. :neutral_face:

will the autonomous walk code for brat be re written at any point, the version in the tutorial is outdated.

Yes. They will be rewritten to work with the new version of BASIC Micro Studio. We’ve just been rather swamped here lately. It will happen, but it may be a little while.

Hi, it is not difficult to update. I can not get to Lynxmotion.com from two computers right now, so I don’t have access to the latest version that is up there. But I did take about two minutes to make the current version of abrat5.bas compile, by changing the code at sensorloop from:

[code]idle var byte
finished var byte
junk var word
sensorloop
finished = true
gethservo lefthip,junk,idle
if(NOT idle)then
finished=false
endif
gethservo righthip,junk,idle
if(NOT idle)then
finished=false
endif
gethservo leftknee,junk,idle
if(NOT idle)then
finished=false
endif
gethservo rightknee,junk,idle
if(NOT idle)then
finished=false
endif
gethservo leftankle,junk,idle
if(NOT idle)then
finished=false
endif
gethservo rightankle,junk,idle
if(NOT idle)then
finished=false
endif
;add sensor handling code here

;adin 19,ir
;if (ir > 490) then
;endif

if(NOT finished)then sensorloop

[/code]
To simply:

hservowait [lefthip, righthip, leftknee, rightknee, leftankle, rightankle]
However if you wish to add in some sensor detection code you could simply change the above code to something like:

while (not hservoidle lefthip) or (not hservoidle righthip) or | (not hservoidle leftknee) or (not hservoidle rightknee) or | (not hservoidle leftankle) or (not hservoidle rightankle) ; adin 19,ir ; if (ir > 490) then ; endif wend
Note: I have not tried this code out, other than to make it compile…

Kurt

They tell me it’s a DNS issue… :unamused:

Can we connect by IP address until it is resolved? If so what is it.
Kurt

Try it now. It’s supposed to be resolving properly now. :open_mouth:

If it doesn’t work, you’ll need to try a dns flush.

open cmd.exe (start menu -> run… -> then type cmd into the run box)
type in “ipconfig /flushdns” (Without quotes, of course)
restart your internet browser.

After you do that, the website should come up.

When I had the problem of getting to the lynxmotion main webpage I added Googles open DNS servers to my list of DNS servers and that fixed the problems. The more DNS servers you have the more likely you can get around one thats messed up but the longer it can take to resolve a lookup.

Google DNS servers are:

8.8.8.8
8.8.4.4

This comes from Nathan (posted in thread on Basic Micro Forums…)

How to get HSERVOSTATE on Arc32 using ASM…

and.w #0x1F,r0
add.w #_SERVOTBL,r0 ;calc table data address
mov.b @er0,r0l ;get table data
xor.b r0h,r0h ;isolate servo index

_hservostate_cont: 
shll.w r0 ;Multiply index by 2
mov.w @(_HSERVOSTATE:16,er0),r0
shlr.w r0
shlr.w r0
shlr.w r0
shlr.w r0
shlr.w r0
shlr.w r0
xor.w e0,e0

r0 needs the pin number you want the value for. Obviously only pins with analog support will return analog values.