The text of a manual · part 5 of 9
CBL 2 Technical Reference: Programming the CBL 2, pages 27 to 36
Pages 27 to 36 of 63, from CBL 2 Technical Reference
The original document is the PDF (424 KB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Texas Instruments CBL2 System
Page 27
Syntax: {3,samptime,numpoints,trigtype,trigchan,trigthresh, pre-store,(extclock) 1,rectime,filter,fastmode} Use this syntax for non-realtime data collection.
Sample Time
Number of Points
Trigger Type
Trigger Channel
>0 to 16000
0 = Invalid
0 = Immediate
1 to 12,000 = NON-REALTIME mode and number of points to collect
1 = Manual
0 = Disables trigger
Default = 0.5
2 = Rising edge/ rising edge 3 = Falling edge/ falling edge 4 = Rising edge/ falling edge 5 = Falling edge/ rising edge
1 = CH1 (channel must be active) 2 2 = CH2 (channel must be active) 3 3 = CH3 (channel must be active) 3 11 = CH11 (channel must be active) 3
Trigger Threshold - channel limit to + channel limit (channel limit is determined by sensor attached to the channel) Default = 1V
6 = Single sample
Pre-store Data
Record Time
Filter
FastMode 5
0% to 100% 4
0 = None
0 = None
1= Absolute
1 = Savitzsky-Golay 5-point filter
0 = OFF (normal operation)
2 = Relative Note: This is different from the original CBL. Default on CBL was 0.
2 = Savitzsky-Golay 9-point filter 3 = Savitzsky-Golay 17-point filter 4 = Savitzsky-Golay 29-point filter
1 = ON (FASTMODE sampling) 6
5 = Uses Median Pruning 3-point filter 6 = Uses Median Pruning 5-point filter
1
This parameter is ignored. 2 Hardware trigger only for Command 1 operation 5, 6, or 7; software trigger for all others. 3 Software trigger only. 4 Prestore is not valid for manual trigger or immediate trigger. Due to the delay in determining the start of sample, the actual amount of prestore may be smaller than the selected amount. 5 FASTMODE does not apply to the Sonic/Digital channels.
CBL 2 Technical Reference
27
Page 28
6
In FASTMODE, only one channel can be active, and it must be an analog channel. Sampling can be as fast as 20ms/sample in this mode. FASTMODE is operational only for sample rates from 50,000 sample/second to 5,000 samples/second. Each probe has a minimum sample time, which is listed in the table below:
Probe Type
Minimum Sample Time
Analog probes
100msec/per probe
Sonic probes
8 milliseconds
Digital In/Out
100msec/per probe
Note: TrigTypes 0, 1, and 6 cannot be used with frequency measurements (operation 6) or with period measurements (operation 5). Note 2: TrigTypes 2, 3, 4, 5, and 6 cannot be used with count transition (operation 7). Note 3: TrigTypes 1 and 6 cannot be used with FASTMODE sampling. Note 4: While CBL 2 is waiting for TrigThresh, you can press the START/STOP to start sampling immediately.
Command 4
Conversion Equation Setup (Analog)
This command sets up parameters to convert physical units measured by CBL 2 into a more useful measurement unit such as Newtons or ¡C. It has six syntaxes.
Syntax: {4,0} Clears the equation for all channels.
Syntax: {4,channel,M1} Channel 1, 2, or 3 Sets unary equation; returns raw data for the channel.
Syntax: {4,channel,1,N,K 0, . . .K n} Channel
N
K
1 = Sets CH 1
N = 1 through 9
No restrictions except overflow.
2 = Sets CH 2 3 = Sets CH 3 Sets up polynomial equation: K 0 + K 1X + K 2X 2 + ... + K nX n
28
CBL 2 Technical Reference
Page 29
Syntax: {4,channel,2,M,N, K m, K m-1,. . .K 0, . . .K n } Channel
M
N
M +N
X
1 = Sets CH 1
M = 0 through 4
N = 0 through 4
M+N>0
Xƒ0
2 = Sets CH 2 3 = Sets CH 3 Sets up mixed polynomial equation: K .mX .m + ... + K .1X .1 + K 0 + K 1X + ... + K nX n
Syntax: {4,channel,equtype, K 0,K 1} Channel
Equation Type
1 = Sets CH 1
3 = Power
2 = Sets CH 2
4 = Modified power
3 = Sets CH 3
5 = Logarithmic 6 = Modified logarithmic 7 = Exponential 8 = Modified exponential 9 = Geometric 10 = Modified geometric 11 = Reciprocal logarithmic 12 = Steinhart-Hart Model
Equation Type
Equation
Restrictions
K 0X (K 1)
X>0
4 Modified Power
K 0K 1
(X)
K 1>0
5 Logarithmic
K 0 + K 1ln(X)
X>0
6 Modified Logarithmic
K 0 + K 1ln(1/X)
X>0
7 Exponential
K 0 e(K1X)
No restrictions other than overflow.
8 Modified Exponential
K 0 e(K1/X)
Xƒ0
9 Geometric
K 0X (K1X)
X‚0
10 Modified Geometric
K 0X (K1/X)
3 Power
X>0 -1
11 Reciprocal Logarithmic
[K 0 + K 1ln(K 2X)]
12 Steinhart-Hart Model
[K 0 + K 1 (ln 1000X) + K 2(ln 1000X)3] .1
CBL 2 Technical Reference
K 2X>0 X>0
29
Page 30
Command 4
Sonic Temperature Compensation (Sonic)
This command sets the unit of measurement for sonic data.
Syntax: {4,channel,equtype,temperature,units} Channel
Equation Type
Temperature
Units
4 = Sets SONIC if equtype=13
0 = Clears the equation for the selected channel
Temperature value for which you want to compensate
0 = temperature in ¡Celsius
11 = Sets SONIC
13 = Sonic temperature compensation
Command 5
1 = temperature in ¡Fahrenheit 2 = temperature in ¡Celsius 3 = temperature in Kelvin 4 = temperature in Rankin
Data Control
This command selects the type of data to be retrieved, as well as the starting and ending data points to be retrieved by a TI calculator.
Syntax: {5,channel,dataselect,databegin,dataend} Channel
Data Select
Data Begin
Data End
.1 = Sets recorded time
0 = raw collected data (filtered)
0 = first point collected
0 = last point collected
0 = Lowest active channel
1 = d/dt (filtered)
1 through n = point selected
1 through n = point selected
1-3 = Analog
2
2
2 = d /dt (filtered)
11 = Sonic
3 = raw collected data (unfiltered)
21 = Digital input
4 = d/dt (unfiltered) 5 = d 2/dt 2 (unfiltered)
Note: If Data Select = 0, 1, or 2 and Command 3 Filter = 1-6, data will be filtered according to the filter selected in Command 3. If Data Select = 3, 4,or 5; the filter setting in Command 3 will be ignored. Note 2: Data End must be greater than or equal to Data Begin (unless Data End = 0). Both DataBegin and DataEnd must be less than or equal to the number of samples sent to the CBL 2 in the last Command 3. Note 3: Each Command 5 must be followed by a Get statement. Note 4: Sampling must be completed before sending Command 5 to control the data. Before sending Command 5, do a Get statement to ensure that sampling is completed or send Command 7 to check the status and verify that sampling is completed.
30
CBL 2 Technical Reference
Page 31
Command 6
System Setup
This command has three syntaxes. The first turns sound on or off, the second sets an ID number for the CBL 2, and the third selects a filter to be applied to data.
Syntax: {6,command} Command 0 = Abort sampling 2 = Abort sampling 3 = Turns sound off 4 = Turns sound on
Syntax: {6,command,parm} Command
Parameter
5 number you specify (any floating point number between M1038 to + 10 38) = Sets an ID number for CBL 2 that is used to identify a specific CBL 2 when multiple units are linked together
Syntax: {6,command,filter} Command
Filter
6
0-6 = number of new filter to be applied Default = 0
Command 7
Request System Status
Syntax: {7} This command generates and prepares to return the following status information: softwareID
Current software ID in format: X.MMmms where X=product code number, MM=major ID number, mm=minor ID number, and s=step ID number.
error
If non-zero, CBL 2 should be reset and the cause of the error corrected battery
Battery status. Can return the following values: 0 Battery is OK for use 1 Battery is low during sampling 2 Battery is low all the time
CBL 2 Technical Reference
31
Page 32
8888
Constant value. If the correct list location is set to zero prior to requesting and getting the list, this value can be used to ensure that the status message was received correctly.
Sample time
Sample time that was commanded by the host during the last sample run trigger condition
Triggering condition that was commanded by the host during the last sample run channel function
Triggering channel that was commanded by the host during the last sample run channel post
Post-processing setting that was commanded by the host during the last sample run channel filter
Filter that was commanded by the host during the last sample run num samples
Number of samples that was commanded by the host during the last sample run. (If sampling was aborted, this parameter reflects the actual number of samples taken.)
record time
This can have the following values: 0 No time was recorded in the last run 1 Absolute time was recorded in the last run 2 Relative time was recorded in the last run temperature
Temperature used for the temperature correction of the sonic data during the last run if a sonic sensor was selected piezo flag
This is the buzz/no-buzz value that was last commanded. Values are: 0 Sound is disabled (OFF) 1 Sound is enabled (ON)
system state
The following values are used for the system state: 1 Idle 2 Armed 3 Busy 4 Done 5 Self-test 99 Initializing code data start
First point of data available for transmission to the host unless the host has sent Command 5 to override this value data end
Last point of data available for transmission to the host unless the host has sent Command 5 to override this value systemID
The System ID that was set using Command 6
32
CBL 2 Technical Reference
Page 33
Command 8
Request Channel Status
Syntax: {8,channel,request type} Channel
Request Type
1, 2, 3, or 11
0 = returns current sampled data 1 = returns data stored when channel was last set up
This command generates and prepares to return a list with three elements: E 1, E 2, E 3: E 1 = sensor type (one of the operation options shown under Command 1) E 2 = last valid data read from sensor, if any [only valid when sampling is active] (not applicable to CH1 ops 5, 6, 7 or CH21 Digital In or CH31 Digital Out) E 3 = last valid data position (sample number where stored in the resulting list) [only valid when sampling is active] Note: Each Command 8 must be followed by a Get statement.
Command 9
Request Channel Data
Syntax: {9,channel,mode} Channel
Mode
1, 2, 3, or 11
0 = Re-test input auto-ID value 1 = Return stored auto-ID value
This command generates and prepares to return one data point before sampling starts. Used to verify that setup is correct. Note: Each Command 9 must be followed by a Get statement.
Command 10
Advanced Data Reduction
This command sets up CBL 2 to process certain time-intensive algorithms instead of processing them in the calculator.
Syntax: {10,channel,alg,P1,P2,P3} Channel
Algorithm
P1
P2
P3
1, 2, 3, 11
1 = HeartBeat algorithm
0% to 100% Lower Thld
0% to 100% Upper Thld
RejectThld in the units of the channel selected
P1 value determines when data transitions from “high” to “low.” P2 value determines when data transitions from “low” to “high.” P3 value determines the minimum difference in data between UpperThld and LowerThld. Note: P1 must be less than P2.
CBL 2 Technical Reference
33
Page 34
Notes on Operation Certain algorithms are very time intensive to run in the calculator, and the CBL 2 product team has made an effort to include those algorithms in the CBL 2’s optimized code. This allows large data sets to be processed much more quickly. Currently only one algorithm has been defined. This algorithm determines the number of cycles of a repetitive waveform in the sampling buffer. (This routine is known as the heartbeat algorithm for its frequent use in measuring the heart rate.) This algorithm works as follows:
1. First, the normal data collection (using commands {1, …} and {3, …}) must be completed.
2. Next, the algorithm must be started using the command {10,channel,1,P1,P2,P3}. 3. The CBL 2 starts by finding the maximum and minimum points of the data set. The lower threshold is set at P1 percent of the maximum point, and the upper threshold is set at P2 percent of the minimum point.
4. The CBL 2 checks the difference between the maximum point and minimum point against P3. If the difference is less than P3, the algorithm is aborted and a 0.0 is returned. (This is the case where the user expected the input data to have a certain variation but, for some reason, the variation was not found.)
5. The CBL 2 then finds the number of “rising edges” where the data in the data set is increasing from below the upper threshold and the number of “falling edges” where the data is decreasing to below the lower threshold. The total number of rising edges and falling edges is stored.
6. Next the CBL 2 determines how many samples are between the first edge and the last edge. The frequency is then determined as the number of edges divided by the number of samples and is returned to the host calculator or computer.
7. The user program is responsible for taking the result from the CBL 2 and dividing it by the sample time to get the true frequency in Hz.
Command 12
Digital Data Capture
This command sets up the capture or measurement of motion data from the digital input channel. It has seven syntaxes.
Command Sequence In general, when you want to sample data, you should send commands in this sequence: Reset the unit, setup the channels, start sampling, retrieve the data. The commands used to do this are shown below: ♦
♦
Command 6,0 to force the CBL 2 to stop executing any prior commands (This command may not be needed.) Command 0 to reset CBL 2 to a known state Command(s) 1 to set up any channels needed for sampling
34
CBL 2 Technical Reference
♦
Page 35
♦ ♦ ♦
Command(s) 4 to send the equations for any sensors that need special equations (use only if needed) Command 3 to start the sampling process GET commands (one or more) to retrieve data from the CBL2.
It is important to notice that the channels get setup before sampling starts and that the Command 3 starts the actual sampling. The GET command forces the host calculator to wait until the data is ready and then transfer the data from the CBL 2 into the calculator. Only a few of the commands that can be sent during sampling are useful; many of these commands will abort the sampling. For example, if you send a Command 1 during sampling, the sampling aborts, your data is lost, and the new channel is set up according to the new command. A more useful command to send during sampling is Command 7. If you send this command, you can then do a GET and see the status of the CBL 2. The status will show the sampling (ARMED – meaning that the unit has not gotten to the trigger condition yet, or BUSY – meaning that sampling is in progress). Another useful command to send while sampling is the Command 8, which reads back the most recent data sample collected for a single channel. This allows a sophisticated program to monitor data collection while the CBL 2 is collecting the data. One of the new features of the CBL 2 is its ability to automatically work with many digital sensors such as photogates. With a photogate, the timing of the data transitions is the parameter of interest. Using the standard command order defined above, the user would: ♦ ♦ ♦
Send {1, 21, …} to command a digital input channel Send a command 3 to start sampling Send a GET to retrieve the data.
In order to find the transition times, the data collection program must scan the data looking for each transition and then subtract the time of the start and end points to get the transition time. Using Command 12 automates this process (and makes it more accurate). There are a few things to be aware of, though. When using Command 12, the number of samples collected is not the same as the number of samples taken. If the photogate only transitions 12 times, there will be 12 transitions recorded. Even if there are 1000 analog data samples taken, there will still only be 12 transitions of the photogate data. Therefore, you should command a SEND {12, 41, 0} to find out how many transitions were recorded before requesting photogate data from the CBL 2. After getting the number of transitions, you can retrieve the actual transition timing.
CBL 2 Technical Reference
35
Page 36
When using a photogate, or other digital sensor, your command sequence should be as follows: ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦
Command 6,0 to force the CBL 2 to stop executing any prior commands (may not be needed) Command 0 to reset CBL 2 to a known state Command(s) 1 to setup any channels needed for sampling (you must setup at least 1 analog channel) Command 12, 41,3 to enable the photogate mode for digital CH 41 (Digital Input Port 1) Command(s) 4 to send the equations for any sensors that need special equations (only if needed) Command 3 to start sampling GET commands to retrieve the data from the CBL 2 (This forces the calculator to wait for sampling to finish.) Command 12,41,0 to command the CBL 2 to return the number of transitions recorded GET command to retrieve the number of transitions from the CBL 2 Command 12, 41,M1 to command the CBL 2 to return the transitions recorded GET command to retrieve the number of transitions from the CBL 2 Command 12, 41,M2 to command the CBL 2 to return the transition times recorded GET command to retrieve the number of transitions from the CBL 2
General Information There are six types of motion capture commands. Each digital data capture command is designed to support the capture or measurement of data from the digital input. Some commands capture data at periodic intervals while others are triggered by changes in the data. Each of the digital data commands is designed for a specific sensor and/or experiment as shown in the following table:
Send {12, 41, mode}
Use
Mode = 1
Sample Mode. This mode is used when none of the other modes (below) are useful. In this mode, each time the data changes, it is recorded in the CBL 2. This allows for any new digital probes to be used if the user is willing to write the program to process the data.
Send {12, 41, mode}
Use
Mode = 2 and Mode = 3
Measures pulse width of the data on the D0 line. This mode is used with a photogate to get very accurate measurement of the time the photogate is blocked. Generally, this measurement is used to determine the speed of an object (must know object’s length).
36
CBL 2 Technical Reference