Vernier LabPro User Manual

LabPro
Technical Reference
Manual
Calculator-Based Laboratory, CBL, CBL 2 , and Incorporated. LabPro is a registered trademark of Vernier Software & Technology.
2000 Vernier Software & Technology. All rights are reserved.
This document is modified and reprod uced from CBL 2 Technic a l Reference  2000 Texas Instruments
TI-GRAPH LINK
are trademarks of Texas Instruments
Revision Date: 08/02/02
Revision Date: 08/02/02
Incorporated, with permis s ion of the publisher.
Contents
ABOUT THIS MANUAL.............................................................................................................................5
INTRODUCTION.........................................................................................................................................5
PROGRAMMING LABPRO ......................................................................................................................6
PROGRAM STRUCTURE..........................................................................................................................6
NITIALIZATION
I
HANNEL ACTIVATION
C
............................................................................................................................................6
.................................................................................................................................7
DATA COLLECTION MODES..................................................................................................................7
Data Collection Mode Comparison Table
IMEBASE
T
ATA RETRIEVAL
D
....................................................................................................................................................9
.........................................................................................................................................9
.............................................................................................8
MISCELLANEOUS REFERENCE INFORMATION.............................................................................9
ABPRO SOFTWARE UPGRADES
L
RCHIVING IN LABPRO’S
A
YPICAL PROGRAM IMPLEMENTATIONS
T
...................................................................................................................9
FLASH M
EMORY
................................................................................................9
.....................................................................................................10
Analog Data Collection ........................................................................................................................10
Analog RT Data Collection...................................................................................................................12
Motion Detector Data Collection .........................................................................................................13
Monitoring Inputs During NRT ............................................................................................................13
Monitoring Inputs without Data Collection .........................................................................................13
Interrupting Data Collection ................................................................................................................13
Keeping Power on During Analog Data Collection .............................................................................14
Digital Data Collection ........................................................................................................................14
Digital Outputs .....................................................................................................................................18
OMPUTER PROGRAMMING
C
........................................................................................................................21
Basic communications ..........................................................................................................................21
Data Formats........................................................................................................................................21
Serial Port Communication Details......................................................................................................22
USB Communication Details................................................................................................................22
OMMUNICATIONS SPEED LIMITATIONS
C
ALCULATOR PROGRAMMING
C
....................................................................................................................24
.....................................................................................................23
Basic Communication...........................................................................................................................24
Retrieving Data.....................................................................................................................................25
Data Control.........................................................................................................................................26
Calculator Limitations..........................................................................................................................27
LABPRO COMMAND SUMMARY ........................................................................................................28
OMMAND
C
OMMAND
C
OMMAND
C
OMMAND
C
OMMAND
C
OMMAND
C
OMMAND
C
OMMAND
C
HANNEL SETUP
1C
ATA COLLECTION SETUP
3D
ONVERSION EQUATION SETUP (ANALOG
4C
ATA CONTROL
5D
YSTEM SETUP
6S
EQUEST SYSTEM STATUS
7R
EQUEST CHANNEL STATUS
8R
EQUEST CHANNEL DATA
9R
.................................................................................................................31
..................................................................................................35
..................................................................................................................41
...................................................................................................................44
..................................................................................................45
...............................................................................................47
..................................................................................................48
).........................................................................39
LabPro Technical Manual2
Revision Date: 08/02/02
OMMAND
C
OMMAND
C
OMMAND
C
OMMAND
C
OMMAND
C
OMMAND
C
OMMAND
C
OMMAND
C
OMMAND
C
OMMAND
C
OMMAND
C
10 A 12 D 102 P 115 R 116 R 117 R 201 A 401 A 1998 S 1999 S 2001 D
DVANCED DATA REDUCTION
IGITAL DATA CAPTURE ORT POWER CONTROL COMMAND EQUEST SET-UP INFORMATION EQUEST LONG SENSOR NAME EQUEST SHORT SENSOR NAME
RCHIVE OPERATIONS COMMAND
NALOG OUTPUT SETUP
ET OUND COMMAND
IRECT OUTPUT TO DIGITAL-OUT PORT
LED C
OMMAND
....................................................................................................70
........................................................................................................71
.......................................................................................49
................................................................................................51
................................................................................56
.....................................................................................57
......................................................................................61
.....................................................................................62
..................................................................................63
.................................................................................................63
.......................................................................72
LABPRO HARDWARE.............................................................................................................................73
ONNECTOR PINOUTS
C
ECHNICAL SPECIFICATIONS FOR LABPRO
T
................................................................................................................................73
..................................................................................................74
General Specifications..........................................................................................................................74
Analog Inputs........................................................................................................................................74
Analog Inputs (Cont.)............................................................................................................................75
Analog Output.......................................................................................................................................75
Digital I/O.............................................................................................................................................75
ABPRO SENSOR DETAILS
L
..........................................................................................................................76
Voltage Sensor......................................................................................................................................76
Auto-ID Sensors....................................................................................................................................76
Custom Sensors.....................................................................................................................................77
APPENDIX A: GLOSSARY........................................................................................................................1
APPENDIX B: BEEPS, LIGHTS AND ERRORS.....................................................................................1
EEP AND LIGHT SEQUENCES
B
RROR CODES
E
..............................................................................................................................................2
.......................................................................................................................1
APPENDIX C: DATAMATE SENSOR SETUP DEFAULT SETTINGS...............................................1
APPENDIX D: COMPUTER PROGRAMMING EXAMPLES..............................................................1
General Structure of a VB Program.......................................................................................................1
Example 1: Temperature Non-Realtime Data Collection.....................................................................1
Example 2: Temperature Realtime Data Collection.............................................................................1
Example 3: Distance and Velocity Non-Realtime Data Collection.......................................................2
Example 4: Digital Output.....................................................................................................................2
Example 5: Digital In Data Collection..................................................................................................3
Data and String Manipulation................................................................................................................3
Comm Object Settings.............................................................................................................................4
APPENDIX E: CALCULATOR PROGRAMMING EXAMPLES.........................................................1
Example 1: Temperature Non-Realtime Data Collection......................................................................1
Example 2: Temperature Realtime Data Collection..............................................................................1
Example 3: Distance and Velocity Non-Realtime Data Collection........................................................1
Example 4: Multiple Channels Non-Realtime Data Collection.............................................................2
Example 5: Conversion Equation Setup (Command 4)..........................................................................2
Example 6: Data Control Setup (Command 5).......................................................................................2
Example 7: Digital In Data Collection...................................................................................................3
Example 8: Digital Out...........................................................................................................................3
Example 9: LabPro LED Display...........................................................................................................3
Example 10: Playing Music on LabPro..................................................................................................3
LabPro Technical Manual 3
Revision Date: 08/02/02
Example 11: Command 8 Program.........................................................................................................4
Example 12: Command 9 Program.........................................................................................................4
Example 13: Command 10 Program.......................................................................................................4
Example 14: Archive Program (Command 201)....................................................................................5
LabPro Technical Manual4
Revision Date: 08/02/02
About This Manual
This technical reference is intended for LabPro users who want to write their own programs for LabPro and computers or Texas Instruments graphing calculators. This document includes technical data such as syntax for LabPro commands, sample programs, error codes, specifications for sensors and miscellaneous other topics.
We have created and have available for download from our web site starter software for REALbasic (Macintosh), Visual Basic 6 for Windows and LabView for Windows, Macintosh and Linux/X-Window.
Most people who use LabPro do not need to refer to this manual. Instructions for using LabPro with the DataMate calculator program or app are given in LabPro package. Instructions for using LabPro with the Logger Pro computer program are in the Logger Pro manuals and help files. Again, this manual is only needed if you are writing your own programs.
LabPro can be used to collect data or to control digital or analog lines when connected to either computers or Texas Instruments calculators. The commands sent to LabPro and the results returned from LabPro are usually the same, no matter what kind of computer or TI calculator is used. In this manual we will use the term host to refer to either calculator or computer used to control LabPro. In a few cases, the commands are different on calculators, and we will use the term “calculator”.
Getting Started with LabPro
, which is included in
If you plan to use LabPro with Texas Instruments calculators, this manual assumes that you are somewhat familiar with the calculator, and the use of to the calculator. If you are not, we encourage you to look over calculator manuals for this information.
If you plan to use LabPro with your own computer software, this manual assumes that you are somewhat familiar with the computer, the programming environment, and how the serial or USB port of the computer is controlled. If you are not, we encourage you to look over other hardware and software manuals for this information.
TI-GRAPH LINK
for transferring programs from a computer
TI-GRAPH LINK, TI Connects,
and
Introduction
LabPro is a small handheld computer dedicated to the task of data collection and control of output lines. It contains a microprocessor that can communicate with a host calculator or computer. By using the command set documented in this manual, the host (computer or calculator) can customize the parameters of the data collection or control to suit specific applications.
LabPro contains different types of on-board memory; ROM and FLASH RAM. The ROM contains the most fundamental functions that allow LabPro to begin operation and load its operating system. The operating system is stored in the 8Mbits of FLASH memory. Having the operating system in FLASH memory provides the flexibility of future upgrades and feature enhancements. The FLASH memory is also used to store programs such as the DataMate calculator program. The FLASH memory has a user accessible portion that may be used for long term data storage or other programs.
LabPro has no ON/OFF switch. Instead, it uses an on-board power controller. When the LabPro goes into an IDLE state, it automatically enters a micro power mode. Any outside stimulus, such as activity on any of the communication ports or a button press will cause LabPro to “wake up” and return to a normal power state. When collecting data slowly, LabPro will power down unused elements in order to maintain a low power state between sample points.
The LabPro has three methods for communicating with a host; through the GraphLink port at the bottom of the device, through the RS-232 port or through the USB (version 1) port. Only one of these ports may
LabPro Technical Manual 5
Revision Date: 08/02/02
be used at a time. The GraphLink port is used almost exclusively with a TI Graphing calculator while the USB and RS-232 ports are used with a computer.
LabPro has six interface ports for data collection. The ports labeled CH1 through CH4 are used to collect analog data from sensors such as temperature, pH, force etc. The ports labeled DIG/SONIC1 and DIG/SONIC2 are used to collect digital data from such sensors as photogates, motion detectors, radiation monitors, and rotary motion sensors. LabPro may also be used to control 8 digital output lines and one analog output line (see connector information for pin assignments).
Programming LabPro
Programming of LabPro consists of sending a series of commands to configure the desired operation. There are a few dozen commands to control LabPro and request its status. Within a program, different commands are used to set up the number of active channels, rate of data collection, quantity of data collected, and how data is to be processed. Since the command set is rather extensive, this manual will detail some building blocks to illustrate how the commands are used within the context of a program.
Each command consists of a series of numbers that are sent to the LabPro. For example, the data rate for data collection is set with a Command 3, like this:
3,1,1,0
If you are using a TI calculator to write the programs, you typically store the data in a list and then send it to LabPro. If you are using a computer to control LabPro, you send these commands to LabPro using either the serial or USB port. Refer to the Calculator Programming and Computer Programming sections of this manual.
While error checking and command parsing are built into LabPro, it is preferred that the program use the commands as defined. That is to say, do not terminate commands in midstream. Complete requests for data by retrieving requested data prior to sending a new command. In general, attempts to keep a synchronous command/response sequence intact will add to the reliability of the design.
Program Struct ure
Programs for data collection with LabPro usually follow this basic pattern:
Initialize LabPro
Activate Channels from which data is to be collected.
Define and Initiate data collection mode.
Retrieve data from LabPro.
Initialization
Initialization takes place whenever the data collection settings need to be changed. The command used to search for an attached LabPro is Command 7 (status command). Besides indicating if a LabPro is attached, it provides valuable information regarding current status of the attached LabPro unit. Upon launch of the program it may be particularly important to search for LabPro by only using a Command 7. This is due to the fact that there may be data in the buffer from a previous experiment that needs to be accessed prior to reset and setup commands being sent.
LabPro Technical Manual6
Revision Date: 08/02/02
In order to clear all settings, send a reset, 0 command. This command clears data collection RAM, channel assignments and data collection modes that are currently assigned in LabPro. This is a good first step to put LabPro into a known state before configuring the channels. However, this is not to say that a reset should always be sent to LabPro. In fact, since reset clears previous data, it is important to send reset only when you are sure the user is done with the current configuration and data. Example:
7 //Ask for status from LabPro Get response //Evaluate response 0 //Reset LabPro to prepare for channel activation etc.
Channel Activatio n
In order to collect data from LabPro, the program must activate one or more channels. The channel setup commands (Command 1 and Command 12) provide a means by which the program configures LabPro to collect data from certain ports. This part of the program is where the channels are activated, calibration equations are loaded and post-processing options are set. Channel activation tells LabPro which ports are active and how to collect data from that port. Calibration equations are used to convert the raw voltage reading to units specific to the sensor connected to the port. Post processing options further process the data prior to returning the information to the host.
Data Collection Modes
Once LabPro has been initialized and the channels have been activated, the data collection details must be programmed. Data may be collected and returned in several different formats depending on the host. However, there are two basic modes of data collection, real time (RT) and non-real time (NRT). These terms are a little misleading in that data is always collected in real time. The modes differ in how data is stored in and retrieved from LabPro.
In RT data collection, data is collected at regular intervals and available to the host on a point by point basis. Data collection begins after LabPro has processed the command. Only the most recent point is stored in LabPro. If the program does not ask for the data often enough, data could be lost. In this mode, data collection is performed as part of the main processing loop. Therefore, other tasks and processing will determine when an opportunity for data collection occurs. LabPro attempts to take data as close as possible to the programmed time interval. The accurate time between samples is reported back for each data point. This is usually within 100 ms of the requested time. LabPro continues taking data until the host stops data collection or resets the unit. This mode is useful for relatively slow time-based data collection where an unlimited number of data points is necessary; such as a scrolling strip chart recorder.
In NRT data collection, data is collected at regular intervals. Data collection is interrupt-driven to achieve accurate sample periods. Using a wide variety of definable triggers, the program may control when data collection begins. LabPro stores the data in internal RAM until the requested number of data points have been collected. The unit will return the list of data only after receiving a get request from the host. If the host sends the get request before data collection is complete, LabPro will begin data transmission after the last point is sampled. It is possible to monitor the data as it is being collected by using Command 8. This feature could be used to give the user a real-time view of data being collected in a NRT mode. Due to its flexibility, this is the most commonly used mode. A special case of the NRT mode is FastMode sampling. It is designed for use when a single channel must be sampled very quickly. This mode is used primarily when sampling sound with a microphone, or to approximate an oscilloscope. In general, FastMode is identical to non-realtime sampling with the following exceptions:
The sampling is limited to a single analog channel.
The selected channel must not be in operation mode 5, 6, or 7.
LabPro Technical Manual 7
Revision Date: 08/02/02
The communications with the host are turned off during sampling.
Note: In FastMode sampling, it is very important that the program not issue any commands until after sampling has been completed. If LabPro receives any command, it will abort FastMode sampling with an error in order to respond to the command.
Data Collection Mode Comparison Table
The table below shows some of the differences between the data collection modes.
Realtime Mode Non-Realtime Mode FastMode
Order of data ret ur ned when doing the GETs from the host computer
(n = # of samples taken)
Number of samples limited?
Sample time limits (approximate)
Number of channels limited?
{ch1_1, ch2_1, … deltatime_1}
{ch1_2, ch2_2, … deltatime_2}
: : {ch1_n, ch2_n, …
deltatime_n}
Not limited by LabPro, but may be limited by the host computer
This is determ ined by host communication speed. Sample Time > 0.002 second to 16000 seconds
Yes, only CH1-4 and 11, 12
{ch1_1, ch1_2, … ch1_n}
{ch2_1, ch2_2, … ch2_n}
{ch3_1, ch3_2, … ch3_n}
{ch4_1, ch4_2, … ch4_n}
{time_1, ti m e_2, … time_n}
Yes, limited by available memory in LabPro
Sample Time ≥ 1e-4 seconds to ≤ 16000 seconds
No Yes, only a single
Same as Non­Realtime
Same as Non­Realtime
Sample Time ≥2e-5 seconds to ≤ 1e-4 seconds
channel from CH1 to CH4
Can use Triggering? Not by LabPro,
performed in host software
Communication maintained during sampling?
Notes:
1. Checksums are not returned when in ASCII mode communication with a computer, but they are returned when using binary data transfer.
2. In Non-Realtime Mode, any post-process data will follow the input data for the respective channel.
In addition to RT and NRT modes, there is a single point mode. Using Command 9, a single point of data may be read from an active channel. No time is associated with this reading. This command is extremely useful for monitoring inputs, checking status of channels, and for very long term collection that may be statistical or have the time base controlled by the host.
Yes Yes No
Yes Yes, however, manual
triggering is not available.
LabPro Technical Manual8
Revision Date: 08/02/02
Timebase
Regardless of which type of data collection is used, the user must set the data collection rate based on the available rates offered by LabPro. The range of possible times between readings is from 16,000 seconds to
-5
2 x 10 same time, the shortest sampling time is 2 x 10
The data collection mode used affects the sample times allowed with LabPro. In normal mode, a system tick of 100µs is used to set the sample time. The sample time must be an integer multiple of 100µs. Many programmer designers choose to limit them to a finite number of rates, such as 10K, 5K, 2.5K, 2K, 1K, 500, 250, 200, 100, 50, 25, 20, 10, 5, 2.5, 2,and 1. At rates slower than 1 sample per second, the 100µs clock allows reasonable timing accuracy for any sample time requested.
In fast mode, a system tick of 400ns is used to set the sample rate. The sample time must be time period multiplied by 400ns resulting in an integer value. Many programmers limit the choices to rates of:
50K, 33K, 25K, 20K, 10K
Refer to the LabPro Command Summary section for further details.
seconds for analog data collection with a single channel. With two analog channels read at the
-4
seconds.
Data Retrieval
Data may be retrieved from LabPro in a several different ways. The most common way to collect data is to send a get request. This will cause LabPro to return the next point in RT mode or to return the collected data in NRT mode. Command 9 will collect a single point outside active data collection. This is useful when wanting to monitor or test a channel. Command 8 can be used to return the most recent data point collected during an NRT mode. Commands 5 and 12 is used to select specific data to be returned from memory.
Miscellaneous Reference Information
LabPro Software Upgrades
LabPro uses FLASH technology, which allows you to easily upgrade to new software without buying a new LabPro. As new functionality becomes available, you can download the software from the Vernier web site to your computer and upgrade your LabPro.
Check the Vernier website ( compatibility statements. Directions for downloading upgrades will be given on the web site.
http://www.vernier.com
Archiving in LabPro’s FLASH Memory
LabPro has 24KB of FLASH memory that can be used for several purposes. In addition to allowing updates to the operating system and storing the DataMate and other calculator programs, the FLASH memory serves as an archive space for other programs and data.
To preserve collected data so that it can be retrieved at a later time, data sets can be stored in the FLASH archive. To distinguish between different stored data sets, each data set can be given a name.
) for upgrades, paying special attention to
The FLASH archive can also store calculator programs and applications. This provides a convenient location for storing frequently used programs or as a temporary storage to create more available memory
LabPro Technical Manual 9
Revision Date: 08/02/02
on the calculator.
Calculator user can use the DataMate program to Save, Load and Delete data sets in the FLASH archive. This can be very useful for performing and retaining multiple experimental trials in the field. Directions for using this feature are given in the
You can write a program to review the list of stored data sets and retrieve the desired one for
DataMate Guidebook
.
further analysis. (See the sample archive program.)
Calculator users can use the DATADIR program (available on the TI web site at
http://education.ti.com/calc
FLASH memory. Directions for using the DATADIR program are given in the
Guidebook
Command 201, in conjunction with the Link menu on the calculator, provides access to these FLASH
.
or the Vernier web site http://www.vernier.com/calc) to manage
DataMate
archive operations. For details about Command 201, see the LabPro Command Summary section.
Typical Program Implementations
Analog Data Collect i on
Analog data collection is the easiest to learn and will be introduced in the next two sections.
Here is pseudo-code for a very simple LabPro data-collection program. This program takes readings from a Vernier Barometer sensor. It will take 50 readings, 0.25 seconds apart. The general pattern is that you transfer lists of numbers (commands) to LabPro.
0 1,1,14,0,0,1 4,1,1,8.729,8.271 3,0.25,50,0,0,0,0,0,1 Get analog data Get time data
We will go over the program one command at a time below:
The first command initializes the LabPro using a Command 0. (Remember that the first number in the command is the command type.) This is good practice prior to setting up data collection or when changes take place. This command clears data, channel assignments and data collection modes that are currently assigned in LabPro. However, this is not to say that a reset should always be sent to LabPro. In fact, since reset clears previous data, it is important to send reset only when you are sure the user is finished with the current configuration and data.
The second command configures the channel for reading data. Command 1 tells LabPro a number of things about how data is to be collected. The official syntax for this command, when used with sensors, is:
1, channel, operation, post-processing, delta, conversion
You may not require all these features and you will rarely use some of them. (Use zeros, or leave them out so the default value is used.) Here are the commonly used parameters:
channel
= The input channel is specified with the second number in the list. For analog sensors, you can use 1, 2, or 3, or 4 (for CH1, CH2, CH3, or CH4). For a motion detector you use 11 for a Motion Detector connected to DIG/SONIC1 or 12 for DIG/SONIC2.
operation
= The third number in the list provides more specific information regarding the channel setup. This includes input selection (each analog port has two inputs) and use of internal conversion information. In this example, we use a 14 to indicate that for this port, LabPro should collect voltage data from the 0 to 5 V input. Most of Vernier analog sensors use this input. Many of Vernier sensors
LabPro Technical Manual10
Revision Date: 08/02/02
now support an Auto-ID feature. By using a 1 for operation in this command, LabPro will automatically determine input configuration, conversion information as well as other sensor specific information. If no sensor is found during an Auto-ID process, it defaults to the 0 to 5V input. Using 14 is a more manual example. It is more common to exploit the AutoID feature.
post-processing
= This option directs LabPro to process the collected data to calculate values such as first and second derivatives. Sometimes it is desirable for the host to calculate these values instead of LabPro. Here we use zero since it is not needed.
= not used often, use zero
delta conversion
= The sixth number in the list is either 0 or 1. If it is a 1, the LabPro will use a user programmed conversion equation to convert voltages to readings which correspond to a sensor like a force sensor, pressure sensor, magnetic field sensor, etc. If it is 0, either an internal conversion or no conversion equation will be used. You should use a 0 in this position if you are using an AutoID sensor or want to read back raw voltage values. Use a 1 if you are using a Vernier analog sensor with a DIN (5-pin) plug or other sensors that don't support AutoID.
Let's take a closer look at the second line of our sample program:
1,1,14,0,0,1
Command 1 used here sets up channel 1 to use a Vernier sensor and (since the 6th value is 1) to use a conversion equation.
The third line of our sample program uses a Command 4. Command 4 is only used to set up the calibration equation for an analog sensor, such as one of the Vernier probes with a DIN connector. With the proper Command 4, LabPro will read correct values (newtons, degrees Celcius, % dissolved oxygen, etc). If you are using an AutoID sensor, or you just want to read the raw voltage from an analog sensor, do not use a Command 4. Skip this line. Another way of saying this is that if the sixth number in your Command 1 line is zero, do not use the Command 4.
If an equation is to be used to convert voltages to other measurement units, Command 4 is used to load a conversion equation to LabPro. Almost all Vernier probes use linear calibrations (1st order polynomial). The calibration is specified by entering k0 (the y-intercept) and k1 (the slope). For this kind of calibration, the form of the Command 4 line will always be:
channel number
4,
,1,1,k0,k1
In our sample program, the following line is used to load the conversion equation:
4,1,1,8.729,8.271
In this case, channel 1 is being used, with a intercept of 8.729 and a slope of 8.271. This is the proper calibration for a Vernier Barometer, calibrated in atmospheres. Information on the proper Command 4 line values for each Vernier sensor is included in the sensor documentation.
Command 3 controls the actual data collection. Here is Command 3 from the sample program we are studying. It specifies taking readings every 0.25 seconds for 50 readings, and specifies that we should record the time of each reading.
3,0.25,50,0,0,0,0,0,1
The syntax for this command is:
3, samptime, numsamp, trigtype, trigch, trigthres, prestore, extclock, rectime, filter, FastMode
LabPro Technical Manual 11
Revision Date: 08/02/02
Many of these features may not be needed and left in their default state or set to zero. Here are the commonly used parameters:
samptime numsamp
= the time between samples (in seconds). The range is 0.00002 to 16000 seconds.
= the number of readings to be made. This can be any integer from 1 to 12,000. (Numsamp
= -1 puts LabPro into RT data collection mode as explained below.)
trigtype
= this specifies if the program should wait for a triggering event before starting the actual data collection. “0” instructs LabPro to begin data collection immediately without waiting for a trigger. “1” means wait for the Start/Stop button on Labpro to be pressed. Other numbers can be used to specify triggering on a certain signal level. The default is 1, which you usually do not want, so you should almost always have to put a zero here.
The last two commands of our sample program are used to retrieve data from LabPro.
Get Analog Data
Get Time Data
As the first four commands of our sample program are executed, LabPro will go about its business of collecting the data. The program should at some point send a command to LabPro requesting the data. The details of this are different depending on the computer or calculator being used. Each command will get a complete list of data from LabPro. The analog sensor readings will be retrieved first and then the times. If we had set rectime to 0 in Command 3, then we would not have had the times recorded, and we would have used only one retrieve command.
Analog RT Data Collect i on
The discussion above is about non-realtime data collection. That is, it assumes that you want to have a certain number of readings taken at specified intervals for later use by the host (e.g., making a graph). There is another variation of data collection that is sometimes used. We call this RealTime (RT) data collection. In this type of program, LabPro takes one reading, the computer retrieves the reading (and usually does something with it, such as put a point on a graph), and then the program loops and repeats.
Here is pseudo-code for a second sample program, similar to the first, but with RT data collection:
0 1,1,14,0,0,1 4,1,1,1, 8.729,8.271 3,1,-1,0 Label A Get value of I Display I Goto A
This program is the same as the previous sample through the first three lines. After that, the data collection portion is very different. Here is what is going on:
3,1,-1,0 Label A
Get value of I Display I Goto A
This is ju st a label, so the pro gram can loop ba ck h ere.
Note t he Comma nd 3 no w ha s a -1 for the number of samp les. This will tell LabPro to take one reading and continue on.
Get the one reading and store it in the variable I. Display this read ing. Loop back to Label A and repeat.
Note that in most real programs you need to provide a graceful way of breaking out of this loop.
LabPro Technical Manual12
Revision Date: 08/02/02
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 2nd 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,
LabPro Technical Manual 13
Revision Date: 08/02/02
send a Command 6:
6,0
This will terminate data collection while keeping intact the data buffer and the channel configuration.
Keeping Power on During Analog Data Collection
LabPro tries to minimize power consumption by turning power off to sensors when data is not being collected. There are some subtle issues involved with reading signals from sensors such as Vernier pH, Conductivity, Ion Selective Electrodes, Dissolved Oxygen, CO power to be supplied for some time to stabilize before readings are accurate. The way to solve this problem is to send a Command 102 as shown the sample below. This command can be sent right after the channel is set up. Command 102 controls how many seconds prior to sampling that power is applied to the sensor. The –1 operation tells LabPro to keep power applied to the sensor at all times.
102,-1
Note that if you do this battery life will be reduced.
, and Flow Rate. These sensors all require
2
Digital Data Collection
Digital data collection using photogates, radiation monitors, and rotary motion probes are handled very differently from analog data. In all cases, Command 12 is also used for setup and to retrieve the data. Experiments can be performed using analog, sonic and digital channels simultaneously, but will require additional steps during their set up and data recovery phases.
Important Note:
operating system does not collect data unless this is done. This is a known limitation and it may be eliminated in future operating system.
Currently, at least one analog channel must be active in order to collect digital data. The
Photogate Timing
Photogates operate a little differently than the analog channel since the event occurrences are not predetermined in time. There are many different timing modes as well. In order to allow the greatest flexibility, the operating system commands are implemented in a rather generic way. It is up to the program to process the data as needed to report the desired timing.
Photogate operation is also unique in that the same command (12) is used to setup data collection as well as request gathered data. Use Command 12 prior to data collection to set up the timing modes. Use Command 12 during and/or after data collection to retrieve the requested data.
In general, you will need to follow this sequence: Set up an analog channel (even if you will not use the data collected) Set up timing mode using Command 12 Start data collection using Command 3 Data collection terminates either manually or automatically (time interval is up) Retrieve data using Command 12 followed by a “get” Process data for desired timing information
A word about Command 3 setup. In most of the timing modes (except counter mode) the sampling period is not a concern unless analog data is really needed. In most cases, this will be set for an arbitrarily long experiment that is terminated by the user.
LabPro handles multiple digital inputs as separate measurements. The user is allowed to set up a wide variety of combinations to get the timing they desire. However, it is up to the host program to use the
LabPro Technical Manual14
Revision Date: 08/02/02
timing data from each of the LabPro channels and calculate the desired result.
The continuous pulse mode (time gate is blocked) is used for several modes of timing. The following examples detail some common timing tasks.
Timing how long a photogate connected to a DIG/SONIC port is blocked (Gate Timing)
This timing mode is used to time pulses through a single photogate. The times reported to the user represent the duration of the photogate being blocked. LabPro may be used in two modes; pulse width or continuous pulse width. The difference being that pulse width stops collection after a single value has been collected. Since Logger Pro currently supports multiple pulses under gate mode, it might be more useful to use the continuous pulse mode. The setup would be:
0 Clear all channels and reset the device 102,-1 Turn power on continuously. Not required, but a good idea. 1,1,14 Setup one dummy analog channel, if no other analog channels have been assigned 12,ch,3,1 Timing mode where ch is channel number 41 or 42 (DIG/SONIC1, DIG/SONIC2
respectively). The 3 parameter refers to continuous pulse mode and 1 refers to active low pulse.
3,60,1000,0 Send trigger information for arbitrarily long experiment unless real analog data is being
collected. This example sets the experiment length for 1000 minutes (1000 readings, each of 60 seconds).
The experiment will terminate after this 1000 minutes; however, we do not need to wait until the experiment is over to retrieve data. The Command 12 is used to poll for and retrieve available data. The program must poll LabPro to find the number of available data points that have been collected.
12,ch,0 Requests the number of available data
The number returned will corresponds to the number of available events. The program may use this number to set up data retrieval as well as when to update data tables etc. LabPro reports two types of data, the pulse width and the time at which the pulse ended relative to the beginning of the experiment. (Note that the time the pulsed ended, not the time it started, is reported.) These times are reported back in units of seconds.
12,ch,-1,n,
The program may either poll and retrieve only new data or retrieve the entire data set each time. When the user clicks on stop, the program should terminate data collection with a Command 6.
6,0
Timing how long each of two photogates is blocked, independently (Gate Timing with 2 Gates)
As mentioned before, the ports operate independently of each other so that the times reported back are relative to each port. Simply setup and retrieve data as mentioned above using both ch 41 and ch 42.
Requests the pulse width times beginning at event n and ending at event m.
m
For instance, if 10 data points were collected and only points 8 to 10 were needed this would correspond to n=8 and m=10. If n and m are omitted, all events are returned.
0 Clear all channels and reset the device 102,-1 Turn power on continuously. 1,1,14 Set up one dummy analog channel, if no other analog channels have been assigned 12,41,3,1 Set continuous pulse mode for digital input 1 12,42,3,1 Set continuous pulse mode for digital input 2 3,60,1000,0 Send trigger information for arbitrarily long experiment unless real analog data is being
collected. This example sets the experiment length for 1000 minutes.
LabPro Technical Manual 15
Revision Date: 08/02/02
Poll channel 1 for a new event. Once an event has occurred, poll for an event change on channel 2. Once this event occurs, retrieve the latest pulse widths from both these channels.
12,41,0 poll until you get a change in return value, store this in a variable, e.g., 12,42,0 After channel one event change is detected, poll channel two until you get a change in
return value, store this in a variable, e.g.,
12,41,-1,j, 12,42,-1,k,
Store these events and begin polling again until the user terminates the experiment.
Timing from the time of blocking of one photogate until the blocking of the second photogate (Pulse Timing)
This may be done by requesting the times back rather than the pulse width for the photogates. Setup is the same as that for time with two photogates as mentioned above. However, now the times of interest are different. Polling is done in the same manner in that an event must occur on channel one prior to channel
2. However, now the time of interest is the time from edge to edge of the pulses. Using Gate Timing with two gates as the model, data retrieval now changes to:
12,41,-1,j, 12,42,-1,k, 12,41,-2,j, 12,42,-2,k,
Calculate the time from the blocking of photogate one to photogate two as follows:
get pulse width from channel one
j
get pulse width from channel two
k
j
k
j
k
get pulse width from channel one. For equation below this is ∆t(j) get pulse width from channel two. For equation below this is ∆t(k) get pulse trailing edge time from channel one. For equation below this is rt(j) get pulse trailing edge time from channel two. For equation below this is rt(k)
k
j
T = (rt(k) - ∆t(k))-(rt(j) – ∆t(j))
The user terminates the experiment.
Motion Timing
This is used to measure a continuous stream of pulses. For example, if an object with clear and opaque sections (sometimes called a picket fence) is moved through a photogate. Many time measurements are made. Each represents the time between successive blockings of the photogate. This uses a slightly different mode than the previous examples, mode 4, for period measurement. For DIG/SONIC1, the setup is as follows:
0 Clear all channels and reset the device 102,-1 Turn power on continuously 1,1,14 Set up one dummy analog channel, if no other analog channels have been assigned 12,41,4,1 Set period - continuous pulse mode for DIG/SONIC1 3,60,1000,0 Send trigger information for arbitrarily long experiment unless real analog data is being
collected. This example sets the experiment length for 1000 minutes.
Events retrieved are:
12,41,-1,n,m Requests the a subset of the data beginning at event n and ending at event m.
For instance, if 10 data points were collected and only points 8 to 10 were needed
LabPro Technical Manual16
Revision Date: 08/02/02
this would correspond to n=8 and m=10. If n and m are omitted, all events are returned.
12,41,-2,n,m Requests the start times of each period measurement.
These two values are used to fill in the data table. Since the start times are referenced to the start of the experiment, the value for the first event should be subtracted from the times to get the first event starting at time t = 0.
Radiation Monitoring
Radiation counting is also set up using Command 12. It operates much like the photogate mode with the exception that the data rate set in Command 3 is used to set the counting period.
The following is an example of how to set up radiation counting on DIG/SONIC1:
0 Clear all channels and reset the device 102,-1 Turn power on continuously 1,1,14 Set up one dummy analog channel, if no other analog channels have been assigned 12,41,5 Set count mode for digital input 1 3,30,2000,0 Send trigger information for arbitrarily long experiment unless real analog data is being
collected. This example sets the experiment length for 1000 minutes. The sample rate determines the count information that is returned as the number of counts per 30 seconds.
Data is polled using: 12,41,0 returns number of available data points. This also is the number of sampling cycles that
have occurred since start.
12,41,-1,m,n returns data points starting with point m and ending at point n. Data is number of counts
that occurred during a sample period.
Rotary Motion Sensors
Reading data from a Vernier Software & Technology rotary motion sensor is also setup and monitored using Command 12. LabPro reports the position of the sensor as a number in either low or high resolution. The command to setup takes this form:
12, channel, 6, scale factor
where the scale factor should be 0 or 1 indicating whether you are in low or high resolution. If you use 0, the resolution will be 360 counts per rotation of the sensor. If you use 1, the revolution will be four times as many or 1440.
The following is an example of how to set up a rotary motion sensor on DIG/SONIC1.
0 Clear all channels and reset the device 102,-1 Turn power on continuously 1,1,14 Setup one dummy analog channel, if no other analog channels have been assigned 12,41,6,0 Set rotary motion mode for digital input 1 for low resolution measurements 3,30,2000,0 Send trigger information for arbitrarily long experiment unless real analog data is being
collected. This example sets the experiment length for 1000 minutes. The sample rate determines the count information that is returned as the number of counts per 30 seconds.
Data is polled using: 12,41,0 returns number of available data points. This also is the number of sampling cycles that
have occurred since start.
LabPro Technical Manual 17
Revision Date: 08/02/02
12,41,-1,m,n returns data points starting with point m and ending at point n. Data is position of the
rotary motion sensor, relative to its position when the data collection began.
Digital Outputs
The electrical characteristics of the digital outputs are:
Voutput-high ≥3.7 V @ -400 uA
Voutput-low ≤0.65 V @ 1.6 mA
Using Command 2001
This is the simplest way to set the status of the digital output lines. Just send the following command to LabPro: 2001, X, where X is a number between 0 and 255, that matches the binary pattern you want on the 8 digital output lines. For example, sending 2001, 7 will set the first three digital output lines on DIG/SONIC1 to high and all the other digital output lines to low.
Port
Bit Value
DIG/Sonic2
128 64 32 16 8 4 2 1
DIG/Sonic1
If you use a series of numbers after the 2001 in the command line, the data will be sent out at about 200-
µ
sec intervals.
Using the Digital Out put Buffer
A more complex method of controlling the digital output lines is to use the digital output buffer. This is especially useful when you want a pattern of outputs to be repeated. Examples include, flashing LEDs or stepper motors.
The digital output buffer (DOB) is a circular buffer that contains up to 32 elements. The output from the buffer is 4-bits wide, and the outputs are CMOS (0-5V) compatible. The data in Command 1 is entered as decimal representation of the digital value that is output. For example, 0=0000, 5=0101, and 15=1111. At the beginning of each sample, a pointer into the digital output buffer is incremented and the next available data is sent to the output lines.
The number of times that the DOB outputs the contents of the buffer depends on the number of data elements defined in Command 1 and the number of samples defined in Command 3.
LabPro Technical Manual18
Revision Date: 08/02/02
Digital Output B uf fer Example
Command 1 list is {1,31,5,1,2,3,4,5} where: Command 3 list is {3, 1, 100}
where:
1=Channel Setup. 31=DIG OUT. 5=Five data elements. 1=0001 (digital nibble). 2=0010 (digital nibble).
3=Sample and Trigger Setup. 1=One second sample time. 100=One hundred samples. (Trigger T ype defaults to m anual
triggering.)
3=0011 (digital nibble). 4=0100 (digital nibble). 5=0101 (digital nibble).
The DOB outputs pulses that correspond to the five digital nibbles (1234512345...12345 etc.). This sequence is repeated 20 times (100 samples/5 data elements) to the DIG OUT channel. The diagram below shows a portion of this output for the first five data elements.
Sample Clock
D3
D2
D1
D0
12345
1
Figure 1. Digital Output Example
Analog Outputs
The analog output is present on line 1 of CH4. Once the channel has been setup, the output is enabled immediately regardless of data collection mode. It will remain active until the unit is reset or until it is disabled using Command 401
When the output is activated using Command 401, the driving voltage may be monitored by reading Vin on CH4.
The voltage out is limited to +/- 3 V and to +/- 100 mA. By changing the parameters you may change the output value. A variety of waveforms are supported. Command 401 allows the program to set a waveform, amplitude, offset and period and the analog output will generate the desired waveform. The official syntax for this command is:
401, waveform, amplitude, offset, period
The current Lab Pro operating system revision understands the following parameter:
waveform amplitude offset
= DC voltage, ramp up, ramp down, triangle, sine
= the peak to peak voltage
= the voltage relative to ground
LabPro Technical Manual 19
Revision Date: 08/02/02
= time (in milliseconds) to complete one cycle
period
The DC output voltage is set by the equation:
= 2.4mV*amplitude – 1.2mV*offset
V
out
The command
401,1,1024,1024,0
will output a 1.25V signal. To turn off the analog output:
401,0,0,0,0
When the analog output is off, the Vin line (pin 1) of CH4 line may be used as a ± 5 volt analog input. Note that this is different from the other three analog input channels.
LabPro Technical Manual20
Revision Date: 08/02/02
Computer Programming
Basic communications
Commands are sent using the following format:
s{
command number
where the command number is required followed by one or more parameters that may or may not be required (see command reference section).
Data is returned either automatically or by requesting data by sending: the character "g".
Before you start programming, it is a healthy exercise to spend some time with a terminal program (Hyperterm for Windows or Zterm for Mac are two examples) sending commands and receiving data.
Data Formats
ASCII Data
Numbers are returned as ASCII representation of 32-bit floating point numbers in the format of
sm.dddddEsee (sign mantissa_digit . digit digit digit digit digit E sign exponent exponent)
Hex Data
Binary mode is requested by the command {4,0, -1} but is only supported on the active analog and motion channels. It reports the raw ADC output (i.e. calibration equations and derivatives are ignored). The data format is 16 bits of ADC output that is zero filled, left justified according to the interfaces ADC resolution.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 | | |<------- LabPro 12 bit data ----------| 0 0 0 0| | or | |<---- CBL2 10 bit data ------ | 0 0 0 0 0 0| | |
The data is transferred most significant byte first. No carriage return or line feed is transmitted.
In real time sampling mode, all active channels plus the 32-bit time counter are returned.
Ch1_MSB Ch1_LSB ... ChN_MSB ChN_LSB T_MSB T_B2 T_B1 T_LSB Chk
Where CH1_MSB indicates the most significant byte of data from the lowest number channel that is active. After all the data has been transferred for a sample point, a checksum is included verifying the data integrity (serial port only, does not apply to USB communications). The checksum is a single byte computed by exclusive-ORing all bytes in the line and ones-complementing the result.
For example, assume you request a single data point with time. LabPro will transmit the following bit pattern for a data value 8CH, a time of 00e0H and the checksum of 93H:
0000-1000 1100-0000 0000-0000
In non-real-time sampling mode, all N data points for the current channel are returned. Less than N data points will be returned if windowing is turned on with Command 5. Each successive "Get" iterates through
MSB LSB
16-bit data 32-bit time ChkSum
, parameter 1,…, parameter n}
0000-0000 0000-0000 1110-0000 1101-0111
LabPro Technical Manual 21
Revision Date: 08/02/02
the active channels, just as it does in the ASCII or calculator mode. For instance, with two channels active, the following would be returned:
g (sent by host) Pt1_Ch1_MSB Pt1_Ch1_LSB Pt2_Ch1_MSB Pt2_Ch1_LSB ... PtN_Ch1_MSB PtN_Ch1_LSB Chk g (sent by host) Pt1_Ch2_MSB Pt1_Ch2_LSB Pt2_Ch2_MSB Pt2_Ch2_LSB ... PtN_Ch2_MSB PtN_Ch2_LSB Chk
As in the real time mode, each case, the checksum is a single byte computed by exclusive-ORing all bytes in the line and ones-complementing the result (serial port only, does not apply to USB communications). After the checksum, transmission stops, i.e., no carriage return, linefeed or other stop character is sent after the data.
Serial Port Communicati on Details
The serial port transmits commands and data requests in ASCII. Serial port setup is 38400,N,8,1. LabPro will return command/response information in ASCII but has the option of returning collected data in either ASCII or binary.
When communicating over the serial port, a carriage return character follows each command.
Since LabPro may be running from batteries, it may be in a low power state. In that case, if the host is communicating over the serial port, the first byte will be missed. For safety, if the time since the last communications is unknown, then the host should send an “s” followed by a carriage return to wake up the LabPro. If it is not asleep, the “s” will be ignored. As an example, a status request would look like:
s<CR> s{7}<CR>
While a setup sequence would look like:
s<CR> s{0}<CR> s{1,1,14}<CR> s{3,.1,-1,0}<CR>
USB Communication Detail s
If the host is connected with USB, each time the program requests data, LabPro will send the data as soon as the sampling occurs. If the program does not ask for the data often enough, data could be lost. If the host is a computer connected through the serial port, LabPro automatically sends a continuous stream to the host. This continues until the host stops data collection or resets the unit.
The LabPro enumerates with VID=08f7 and PID=0x0001. There is 1 input bulk endpoint and 1 output bulk endpoint. The USB packet size for bulk transfers is 64 bytes. Transfers from LabPro to PC are always in multiples of 64 bytes.
The USB connection operates in much the same way as the serial port. It transmits commands and data requests in ASCII. LabPro will return information in ASCII but has the option of returning collected data in ASCII or binary. Some differences should be noted due to transport.
LabPro Technical Manual22
Revision Date: 08/02/02
One significant difference is that trying to read from USB will not return 0 bytes of data, like an empty serial port call. Instead, the call blocks until data is available from the LabPro. This occurs because LabPro sends a NAK (Not Acknowledge) response until data is valid. The device driver will then wait, blocking on the read, until the data is there. This means that the software read function will not return until the data is ready. If this is an issue, the read request can be put in a separate thread so that the main thread can continue to run. Third party drivers are available to create the abstraction of an input buffer similar to the serial port operation.
The operating system in LabPro was written to make the USB interface as similar as possible to the RS232 serial interface. Getting data using USB works similar to getting data through the serial port, with some subtle differences.
There is no checksum character for binary data, since the USB protocol already includes error detection.
Since the data is transmitted in multiples of 64 bytes, it is possible that there will be extraneous data in the last 64-byte packet. The application software needs to know when to stop reading the buffer. In ASCII mode, looking for a carriage return character can do this. In binary mode, it is only necessary to keep track of the number of samples requested, and read the appropriate number of bytes.
In real time binary mode, each real-time sample is returned as 16 bits. The data is formatted as in the RS232 design, then 0-padded up to 16 bytes. Real-time binary data is normally returned with 1 real-time sample per USB packet. This allows roughly 1 sample/ms transfer rate, depending on loading conditions and host controller design. If real-time sampling occurs faster that USB packets are delivered to the host, there will be gaps in the real-time data. To allow deeper buffering of the sample data (and thus faster sampling rates), there is an option to pack more than one sample per USB packet. The binary mode command has an optional parameter to specify this packing. The command format is {4, 0, -1, X} where X is the number of samples to place into one USB packet. X must be a value from 1 to 4. If no value is specified, the default is 1. One consideration in applying this scheme is this: if USB packet delivery is sufficiently delayed in this case, each delayed packet results in a gap that is larger than a single sample time.
Communications Speed Limitations
LabPro may operate in two modes; real time (RT) and non-real time (NRT). In RT mode, LabPro returns each sample as it is collected. However, the serial port or USB port have limitations on how fast they may transfer data. The setup limitations depend on the data rate, the number of samples requested and the length of the experiment. The primary factor for decision making is the number of active channels. From that information, the determination of maximum rates etc. can be calculated.
When using LabPro in RT, the samples are not stored internally. Therefore, the max number of samples and, consequently, the experiment length is limited by the software.
When using LabPro in RT mode over the serial port, the number of bytes per data point is 2*# of active channels+4 (time bytes) + 1 (checksum) (see above information for details). This translates to 7,9,11,13,15,17 bytes per data point for 1 to six channels (four analog and two sonic) respectively. Therefore, at a transmission rate of 38400, we can assume 10 bits/byte for a throughput of 3840 bytes/second. Using the timebase options above, we have the following theoretical limits imposed on real time collect mode for serial port:
500 samples per second max. 1 channel active 250 samples per second max. 2 - 4 channels active 200 samples per second max. 4 - 6 channels active
LabPro Technical Manual 23
Revision Date: 08/02/02
When using LabPro in RT mode over USB, the number of bytes transmitted back is always 16 (see above information). For an unloaded USB bus (i.e. no other peripherals), we should have a limit of 1k samples per second for RT mode for 1 to 6 channels active.
If you try to use RT at higher data rates, loss and corruption of data can occur. When the RT mode limit is exceeded, the software must switch to utilize the NRT mode of LabPro. Data rate limitations change as follows:
50K samples per second max. 1 channel active 5k samples per second max. 2 channels active
2.5k samples per second max. 3-4 channels active 2k samples per second max. 5 channels active 1k samples per second max. 6 channels active
Since the data is stored internally to LabPro prior to sending it to the host computer, the number of data points being collected is limited to 12k samples/# of channels.
One implication of this is that the user may set up an experiment to take data from one channel at 1k samples/second for 12 seconds. LabPro would not complete the data transfer for 18.25 seconds (12 seconds for the experiment + 6.25 seconds to data transfer over the serial port for 24000 bytes at 3840 bytes/second). Having such a delay may give the impression something is wrong. The software and the user need to be aware of the times involved in such a situation.
Programming tips
Since the System Setup command (Command 6) must be processed while not disturbing data collection, it is possible for additional data points to be transmitted after the Command 6 has been sent. These points may be ignored but be aware that the receive buffer may not be empty immediately after sending this command.
We have found that commands delimited by a carriage return character can be stacked in LabPros input buffer. The input buffer can hold up to 300 characters. The benefit of stacking commands is that the simple example
Calculator Programming
LabPro is designed to work with the TI-73, TI-82, TI-83 TI-83 Plus, TI-85, TI-86, TI-89, TI-92 and TI-92 Plus calculators. Programs are created on a TI calculator to set up specific LabPro operations, depending on the experiment or other function that you want to perform. LabPro operations are controlled by commands sent in the form of lists from a calculator. In the majority of cases, the data returned by LabPro is also in the form of a list. As a rule, when a TI calculator is the host, LabPro is a passive communicator, which must first receive a command list to provoke a response. Data is never automatically sent to the calculator from LabPro.
Basic Communication
Below is a general example of communication between any TI calculator and LabPro:
command number
{ Send(listname) Get(variable)
, parameter 1,, parameter n}→listname
LabPro Technical Manual24
Revision Date: 08/02/02
where the first line stores the second line actively sends the list called listname to LabPro and the third line retrieves the requested data from LabPro to variable on the calculator.
In the command list the or may not be required. See the section titled LabPro Command Summary for details on the commands and their parameters. We will use Command 7, the Request System Status command in the examples to follow. This command has no parameters and is thus is sent as a single element list.
Any listname is acceptable when using Send to transfer the command list to LabPro. Refer to your calculator guide book for the restrictions on list names and their syntax requirements. In the following examples we will use the calculator list L6 for listname.
There are a number of types of variable that can be used in the “Get“ request. Most cases call for using a calculator list. It is even common to use the same list for both listname and variable. For clarity we will use the list called L1 to “Get“ data from LabPro to the calculator.
Only the TI-82 and TI-85 calculators need to store the command to a list in order to send it to
Note:
LabPro. All of the other calculators can omit the first step and simply use
{
command number
in the “Send” command.
Below is a working example which commands LabPro to generate and prepare to return a 17-element list of status information and then places the requested information into the list called L1on the calculator. It is shown in three ways to give the syntax for all of the supported calculators.
TI-73, TI-82, TI-83/83Plus, TI-86 TI-89, TI-92/92Plus TI-85 {7}→L6
Send(L6)or simply: Send({7}) Get(L1)
, parameter 1,,parameter n}
command number
command number
{7}→L6 Send L6or simply:Send {7} Get L1
and parameters to the calculator list called listname, the
is required followed by one or more parameters that may
{7}→L6 Outpt("CBLSEND",L6) Input "CBLGET",L1
During the “Get”, the list L1 is deleted from the calculator and reformed by the data coming in from LabPro. Regardless of the lists length and contents prior to the “Get” request in our example, L1 should look something like this:
{6.0112,0,0,888,0,0,0,0,0,0,0,0,0,1,0,0,0}
These steps can be executed from within a calculator program or line by line from the calculator home screen. The TI-82 can only send commands from within a program. On the TI-73, TI-82 and TI-83/83Plus calculators the lists called L1 and L6 are system-defined lists found on the keyboard or in the List Names Menu. On the TI-85, TI-86, TI-89 and TI-92/92Plus calculators the lists called L1 and L6 are user­defined-lists which can be directly typed from the keyboard as the letter ‘L’ followed by the numbers ‘1’ or 6. In either case, it is always best to initialize all variables prior to their use.
Retrieving Data
In the vast majority of cases, LabPro will be prepared to return data in calculator list format. However, LabPro will return data in the format specified by the variable in the “Get(variable)” command. The choices are: lists (as we used L1 above); list elements; real numbers; and in some cases strings or categorical lists (TI-73 only). Below are examples and explanations of each of these (using the TI-83 syntax):
Get request with a list element: Send({7}) Get(L1(2)) In this case, only the second element of the list called L1is specified in the “Get” request. Therefore only the second element of the list will be deleted and populated with the requested data. All other elements in
LabPro Technical Manual 25
Revision Date: 08/02/02
L1 will remain as they were prior to the “Get“ request. Since LabPro was prepared to return a 17-element status list on the next “Get“ request, and only a single list element was specified in that request, only the first in the status list was returned as data. If L1 was {1,2,3,4,5} prior to the “Get“; after the “Get“ it would be {1,6.0112,3,4,5}.
Get request with a real number: Send({7}) Get(A) In this case real number variable A was specified in the “Get” request. Regardless of its contents prior to the Get request, the real number variable A will be erased and populated by the first value in the commanded data. In this case A would be: 6.0112, the first element of the 17-element list requested by the status command.
Get request with a string or categorical list
: When using some of the specialized archive commands (see section titled Archive Operation Commands) it is possible to retrieve text directly from LabPro FLASH memory. There is a 20-character limit to the length of each string and not all characters are supported. The format of this text depends on the data type specified in the “Get” request. See below for details on individual calculator types. For the TI-83/83Plus, TI-85 and TI-86:
If the data type specified is a string, LabPro will return a 20-character name of item.
If the data type specified is a list , LabPro will return a 20-element list, each element representing an ASCII character code in the text string.
For the TI-73:
If the data type specified is a categorical list, LabPro will return 4 elements of 5 characters each. Concatenate these 4 elements to form the complete text string.
If the data type specified is a list , LabPro will return a 20-element list, each element representing an ASCII character code in the text string.
For the TI-89, TI92/92Plus:
The only allowable data type is a list. LabPro will return a 20-element list, each element representing an ASCII character code in the text string.
Data Control
LabPro accepts over 20 different commands, each with a variety of parameters. Some of these, such as Command 0 and Command 102, are used for experimental setup, power control or other administrative purposes and do not generate data in response. While others, such as Command 7 and Command 201, will generate data and prepare the LabPro to respond only to the next “Get” request. Data gathered from experiments will remain in the LabPro data buffer, available for multiple retrieval, until the buffer is cleared either by a loss of power or a command of type 0, 1 or 3. Be aware that pressing the Quick Setup button will also clear the data buffer and reset any existing LabPro setup. If there is data in the buffer that has been gathered from an experiment, successive “Get” requests will retrieve the data in an orderly fashion. Each successive "Get" iterates through the active channel and time data, beginning with the lowest active channel. For Example: CH1a, CH1b, CH1c, CH2a, CH2b,,CHnc, Record Time, CH1a,etc. (Channel 1 is assumed to be the lowest active channel, a is raw data, b is d/dt, and c is d
2
/dt2 )
Refer to Command 5 for further information on data control.
LabPro Technical Manual26
Revision Date: 08/02/02
Calculator Lim i tations
Calculator memory is an important factor to consider when collecting data with LabPro. Even though LabPro can store up to 12,000 points, if a calculator has insufficient memory when using a “Get” request, no data will be retrieved. Each element of a list, and therefore each data value takes up about 10 Bytes of calculator memory (regardless of the calculator) and calculator programs also occupy memory. Each calculator supported by LabPro has unique limitations on memory availability for program and data storage and other limitations that may need to be considered while programming for LabPro. The table below highlights some calculator features.
User available
memory (in
Calculator TI-73 25 K No limit* 999* 2500 TI-82 28 K 6 99 594 TI-83 27 K No limit* 999* 2700 TI-83 Plus 24 K No limit* 999* 2400 TI-85 28 K No limit* 2800* 2800 TI-86 96 K No limit* 6000* 9600 TI-89 188 K No limit* No limit* 18800 TI-92 68 K No limit* No limit* 6800 TI-92 Plus 188 K No limit* No limit* 18800
Bytes) # of available lists
*Number will vary depending on available memory. **These numbers are approximate, are based on a free memory, using 10 Byte/data point standard. The TI-82 is limited to 6 lists of 99 points/list.
Maximum list
length
Maximum # of
data points**
LabPro Technical Manual 27
LabPro Command Summary
The table below lists the commands you can use in writing programs for LabPro.
Command
Number Command Description
Revision Date: 08/02/02
0 Reset: 1 Channel Setup: 3 Data Collection Setup:
4 Conversion Equation Setup (Analog):
5 Data Control: 6 System Setup:
7 Request System Status:
8 Request Channel Status:
9 Request Channel Data:
10 Advanced Data Reduction:
Resets all channels to default conditions.
sets up a channel for data collection.
Sets up the collection parameters for an
experiment.
convert physical units measured by LabPro into a more useful measurement unit such as newtons or °C.
Selects the type and range of data to be retri eved.
Turns sound on or off; sets an ID number for
LabPro; selects a filter to be applied to data.
Generates and prepares to ret ur n st atus
information.
Generates and prepares to ret ur n sensor type, last valid data, and last valid data position f or t he requested channel.
Generates and prepares to ret ur n one data point before sampling starts. Used to verif y that set up i s correct.
Sets up LabPro to process certai n time-intensi ve algorithms instead of processing them in the calculator.
Sets up parameters to
12 Digital Data Capture:
from the digit al input channel.
102 Port Power Control Command:
power-saving; or designat ed power up.
105 Baud Rate Selection: 106 Motion Detector Under sam pl e Rat e: 107 Oversampli ng Burst : 115 Request Set-up Information:
designated channel.
116 Request Long Sensor Name: 117 Request Short Sensor Nam e: 119 Request Alternate Calibrat ion:
the smart sensor.
Sets up the capture or measur em ent of data
Sets the power to always on;
Sets
Sets
Returns status information for the
Returns long sensor name.
Returns short sensor name.
Selects an alternate calibration for
Sets
LabPro Technical Manual28
Revision Date: 08/02/02
201 Archive Operations Command: Allows the calculator to determine
the contents of LabPro’s
401 Analog Output Setup: Thi s command sets up parameters t o
control the analog output driver i n LabPr o.
1998 Set LED Command: Turns LEDs on and off on comm and. 1999 Sound Command: Specifies length and frequency of LabPro
sounds.
2001 Direct Output to Di gi tal-Out Port: Out put s data to the digital
output port.
Detailed information about each command is given below. Functionality is continually being added to each command and the feature is denoted by a firmware version where it first appears.
FLASH
memory.
A table listing valid values follows the syntax of each command. Default values appear in The syntax of each command is presented in terms of what is required and what is optional. Every command must be enclosed in curly brackets, “{“ and “}”. The command # and the option parameters are comma delimited.
Syntax: { command #, [option [,option]] }
The command # represents the command to be issued to LabPro. The reset command has the simplest syntax: s{0}.
[option] indicates an optional parameter. In many instances, using one optional parameter requires additional optional parameters be specified. The channel setup command is a good example. It can take one, two or five optional parameters.
boldface
type.
LabPro Technical Manual 29
Loading...
+ 67 hidden pages