beautypg.com

Vernier LabPro User Manual

Page 13

background image

Revision Date: 08/02/02

LabPro Technical Manual

13

This type of data collection works great for many programs where you just want to monitor the reading
from a sensor as you collect data and take action if it exceeds a certain specified value; for example, a
program that turns on a fan if a temperature gets too high.

Motion Detector Data Collection

Programs for using motion detectors (also known as ultrasonic rangers) are somewhat like programs for
using an analog sensor. When using motion detectors, LabPro has the ability to return velocity and
acceleration. Below is pseudo-code for a typical motion detector.

0
1,11,1,2
3,.05,50,0
Get distance data
Get velocity data
Get acceleration data
Get time data

The Command 1 line is changed to use channel 11 for DIG/SONIC1. The parameter following the channel
number sets the units of distance the motion detector should read. In this case, LabPro will AutoID the
motion detector and read distance in meters.

The next paramteter in the list assigns a post-processing setting of data. The value of 2 tells LabPro to
calculate both velocities and accelerations (1

st

and 2

nd

derivative of the raw data with respect to time.)

In the sample program we requested that the velocity and acceleration be reported. Whenever either
velocity or acceleration is reported, the time of data collection will also be reported. As a result, we need to
get back four lists of numbers from LabPro.

Get distance data
Get velocity data
Get acceleration data
Get time data

Monitoring Inputs During NRT

Command 8 retrieves the most recent sample at request time and returns the value to the host. The
limitation is each channel must be requested individually.

8,1

request data point from channel 1

Note Command 8 only works for channels 1,2,3,4,11,12 and only returns values in ASCII.

Monitoring Inputs without Data Collection

Command 9 allows the program to sample a single point from a channel. It returns the current value at
request time to the host computer. The limitation is each channel must be requested individually.

9,1

request data point from channel 1

Note Command 9 only works for channels 1,2,3,4,11,12 and only returns values in ASCII.

Interrupting Data Collection

While in general it is best that commands and responses are kept synchronous and not interrupted, there
are situations when the user will need to terminate data collection. Using a reset command may do this.
However, if a reset is sent, all data is lost and the setup is erased. To gracefully terminate data collection,