BasicMicro - Forums

www.basicmicro.com
It is currently Mon May 21, 2012 8:02 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: hservotime returns 0
PostPosted: Sun Feb 13, 2011 4:34 pm 
Offline
New User

Joined: Thu Feb 03, 2011 4:24 pm
Posts: 2
Hi Guys,

I am hoping someone can help me. I am trying to use hservotime on my ARC32 however it just seems to return zero when I call it. To try it out I have the following code which was pretty much lifted from the ARC32 datasheet.

Code:
ENABLEHSERVO2
sethserial1 H38400

starttime var long
stoptime var long
main
starttime = hservotime 0 ;get current time
do
stoptime = (hservotime 0)-starttime
hserout ["Start Time = ", dec starttime, " : Stop Time = ", dec stoptime, 13]
while stoptime < 10000000

hserout ["Time (usec) = ", dec (stoptime-starttime)/2, 13]
toggle p44
goto main


I seem to get stuck in the loop as stoptime = 0. The first hserout prints the following continuously...

Code:
Start Time = 0 : Stop Time = 0


So am I doing something wrong and if so what?

I am using Basic Micro Studio 2.0.0.8 although this was the same with 2.0.0.7

Any help would be much appreciated.

Thanks

iain


Top
 Profile  
 
 Post subject: Re: hservotime returns 0
PostPosted: Sun Feb 13, 2011 4:52 pm 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 528
I think I heard awhile ago that maybe just using HSERVOTIME may not properly startup the hservo system. Could be wrong.

Also I think EnableHservo2 is not needed or used anymore.


Maybe try something like: hservo [0/-30000] and see if that gets it rolling...


Top
 Profile  
 
 Post subject: Re: hservotime returns 0
PostPosted: Sun Feb 13, 2011 5:19 pm 
Offline
New User

Joined: Thu Feb 03, 2011 4:24 pm
Posts: 2
Hi Kurt,

Your a genuis. ;)

That sorted it right out.

Thanks

iain


Top
 Profile  
 
 Post subject: Re: hservotime returns 0
PostPosted: Mon Feb 14, 2011 1:46 pm 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
Just so future people know, the correct method of using hservotime requires atleast one hservo command is used. If you don't want any servos running but you want to use hservotime you can use a no move hservo command like this:

hservo [p0]\-31000]

The -31000 tells it to stop moving the servo(P0 in this case). Since the servo wasn't moving it doesn't do anything to P0.

The hservo command has to be run once in order to use any of the hservo functions, even if you aren't actually driving any servos. This is because back in version 2.0.0.5 we removed the ENABLEHSERVO directive and now use the hservo command to tell the compiler it needs to include the hservo backend.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO