Sign in

username:

password:



Not a member?

Search oopic



Search tips

Subscribe to oopic



Ads

Discussion Groups

Discussion Groups | | OOPic latency

OOPic latency - rayxunewhall - Jun 27 11:13:02 2008

Hi, I would like to know why the latency in one while loop is very big.
Heres the snippet:
While (Echo == 0)
// TICS prescale set to 2
{
If (TICS.MSB == 1 And Echo == 0)
{
Count = TICS.Count;
If (Count < 65535)
{
Count = Count+65535;
}
//Print.Clear;
Print.Locate(1,0);
Print.VString = "timeout " + Str$(Count) + " " + Str$((Count / 10)
* 8) + " us";
Timeout = 1;
Break;
}
}

I'm making an home-made ultrasonic ranger, which requires the use of
the OOPic and as much preciseness as it can be. For example, just for
this to loop once, TICS will increase by 2000 counts. is that normal?
Would writing this in Visual Basic have better results?

Thanks.

Ray Xu
r...@tx.rr.com
------------------------------------



(You need to be a member of oopic -- send a blank email to oopic-subscribe@yahoogroups.com )


Re: OOPic latency - rtstofer - Jun 27 11:46:02 2008

--- In o...@yahoogroups.com, "rayxunewhall" wrote:
>
> Hi, I would like to know why the latency in one while loop is very big.
> Heres the snippet:
> While (Echo == 0)
> // TICS prescale set to 2
> {
> If (TICS.MSB == 1 And Echo == 0)
> {
> Count = TICS.Count;
> If (Count < 65535)
> {
> Count = Count+65535;
> }
> //Print.Clear;
> Print.Locate(1,0);
> Print.VString = "timeout " + Str$(Count) + " " + Str$((Count / 10)
> * 8) + " us";
> Timeout = 1;
> Break;
> }
> }
>
> I'm making an home-made ultrasonic ranger, which requires the use of
> the OOPic and as much preciseness as it can be. For example, just for
> this to loop once, TICS will increase by 2000 counts. is that normal?
> Would writing this in Visual Basic have better results?
>
> Thanks.
>
> Ray Xu
> rayxu@...
>

You need to think in terms of 300 lines per SECOND for code execution.
What happens to your resolution if each line takes 30 mS (or more!)?

I haven't tried this with a virtual circuit but I'm not convinced the
resulution will be sufficient even with this approach.

Sound moves about 1100 feet per second or about 33 feet for each line
of code.

To measure to an accuracy of 1 inch, you need to be able to resolve 76
microseconds. That's pretty easy with a hardware timer but I'm not
sure how to do it with the OOPic.

Richard

------------------------------------



(You need to be a member of oopic -- send a blank email to oopic-subscribe@yahoogroups.com )