04.03.2013 Views

Basic Micro Studio Syntax Manual

Basic Micro Studio Syntax Manual

Basic Micro Studio Syntax Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

HSERVOWAIT<br />

hservowait [pin1, ..., pinN]<br />

Commands<br />

In some situations it may be necessary to wait for the HSERVO command to fi nish updating the servo<br />

position before program execution resumes. The HSERVOWAIT command is used to delay program<br />

execution until HSERVO has fi nished moving the servos specifi ed.<br />

Example<br />

The example below will pause program execution until servos attached to PO through P4 are fi nished<br />

being moved to new positions.<br />

hservowait [p0,p1,p2,p3,p4]<br />

HSERVOPOS<br />

hservopos pin<br />

To determine the current position a particular servo is set to, the HSERVOPOS command is used.<br />

The value returned is the position the HSERVO system is currently driving the servo at. Typically,<br />

there is no feedback from a servo for a true position.<br />

Example<br />

The example below sets a word sized variable and loads it with the last position used for a servo<br />

attached to P0.<br />

temp var word<br />

temp = hservopos p0<br />

HSERVOIDLE<br />

hservoidle pin<br />

To determine if a servo is still being moved to a new position by HSERVO, the HSERVOIDLE<br />

command is used. It will return a value of 0 if the servo specifi ed is not idle. If the specifi ed servo has<br />

reached its new position a value not equal to 0 (0xFFFFFFFF) will be returned.<br />

Example<br />

The example below will update a servo on PO. The program will loop and report until the servo is idle.<br />

hservo [p0\0]<br />

pause 1000<br />

hservo [p0\1000\100]<br />

main<br />

if (NOT hservoidle p0) then<br />

serout s_out,i9600,[“Servo P0 is not idle”,13]<br />

endif<br />

goto main<br />

124

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!