The text of a manual · part 6 of 9
CBL 2 Technical Reference: Programming the CBL 2, pages 37 to 46
Pages 37 to 46 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 37
Send {12, 41, mode}
Use, continued continued
Mode = 4
Measures period of the data on the D0 line. This mode is used with a photogate to get very accurate measurement of the times between when the photogate becomes blocked. Generally, this measurement is used to determine the speed of a wheel or a picket fence.
Mode = 5
Counts the transitions on the D0 input line of the Digital input port. This mode is used when the frequency of a source with a TTL (or CMOS compatible) output must be measured.
Mode = 6
Measures the outputs of a Vernier Rotary Motion sensor. Generally this indicates the position of a wheel on the sensor.
The sections that follow explain more fully how to use the digital data capture commands. Note: Command 12 is valid only in non-realtime mode; it is not valid in realtime mode.
Digital Input Syntax: {12,41,1} At each transition of the digital inputs, the absolute time and state of the inputs is reported. See Fig 1.
D ig ita l/ S o n ic (D 1 , D 2 )
Figure 3. Digital Input Measurement
Inputs will be value 0-3 corresponding to 00, 01,10, or 11. Each transition stored takes three data point locations. This command can be run at the same time as analog sampling. After “getting” the analog channels, send the following commands to return the data from the CBL 2 to the host:
Command Syntax:
Comment:
{12,41,1} collect digital input data; send before Command 3
{12,41,0} return number of points collected on next get statement; send after “getting” the analog channels
{12,41,.1,Start,Stop} return state list on next get statement
{12,41,.2,Start,Stop} return time list on next get statement
CBL 2 Technical Reference
37
Page 38
Notes on Operation The digital inputs are sampled 10,000 times/second in the main timer ISR. (Transitions that are so short that they are not seen in the ISR will be lost.) Each time a change in the input bits is found, the time and the new value are written to a data buffer area. When the data buffer area overflows, data collection is halted and an error message is sent.
Pulse Width – Continuous Pulse Mode Syntax: {12,41,2 or 3,direction} Direction 0 = low active pulse 1 = high active pulse This mode is designed to measure the widths of pulses in a continuous stream of pulses. Each pulse is measured. See Figure 3.
Digital/Sonic (D0) ∆T
∆T
Figure 4. Continuous Pulse Period Measurement
After “getting” the analog channels, send the following commands to return the data from the CBL 2 to the host:
Command Syntax:
Comment:
{12,41,3} collect pulse width data in continuous pulse mode; send before Command 3
{12,41,0} return number of points collected on next get statement; send after “getting” the analog channels
{12,41,.1,Start,Stop} return @time list on next get statement
{12,41,.2,Start,Stop} return time list on next get statement
Notes on Operation The Sonic Timer is used to record the time of the rising and falling edges. The resolution is 1.6msec. At the start of the pulse the time is recorded and again at the end of the pulses. The difference (properly scaled) is returned to the host.
38
CBL 2 Technical Reference
Page 39
Period – Continuous Pulse Mode Syntax: {12,41,4,direction} Direction 0 = low active pulse 1 = high active pulse This mode is designed to measure the periods of pulses in a continuous stream of pulses. Each pulse is measured. See Figure 4. Digital/Sonic (D0) ∆T
∆T
∆T
Figure 5. Continuous Pulse Period Measurement
After “getting” the analog channels, send the following commands to return the data from the CBL 2 to the host:
Command Syntax:
Comment:
{12,41,4} collect period data in continuous pulse mode; send before Command 3
{12,41,0} return number of points collected on next get statement; send after “getting” the analog channels
{12,41,.1,Start,Stop} return @time list on next get statement
{12,41,.2,Start,Stop} return time list on next get statement
Notes on Operation The Sonic Timer is used to record the time of the rising and falling edges. The resolution is 1.6msec. At the start of the pulse the time is recorded and again at the end of the pulses. The difference (properly scaled) is returned to the host.
Counter Mode Syntax: {12,41,5} This mode is designed to count the transitions on the DIGITAL input line. (Use Command 1,1,7 to count the transitions on the ANALOG Channel 1 Hi input line.) The ECHO pin (D0) must be used for the input.
CBL 2 Technical Reference
39
Page 40
After “getting” the analog channels, send the following commands to return the data from the CBL 2 to the host:
Command Syntax:
Comment:
{12,41,5} collect data in counter mode; send before Command 3
{12,41,0} return number of points collected on next get statement; send after “getting” the analog channels
{12,41,.1,Start,Stop} return count list on next get statement
Notes on Operation The Sonic Timer is re-configured as a counter and will count the input transitions. The transitions count is limited to 65535 transitions per cycle. The cycle time is the same as the sample time. In other words, one count will be returned for each analog sample returned.
Rotary Motion Mode Syntax: {12,41,6,scalefactor,startpos} Scale Factor
Start Position
Number of user units to increment/decrement for each count change
Initial position (in user units)
This mode is designed to measure the position of a rotary motion sensor. Rotational motion information is determined by counting clockwise and counterclockwise signals from the Vernier Rotary Motion Sensor. See Figure 5. CWCNT (DI) CCWCNT (D0) Figure 6. Rotary Motion Mode
Each rising edge of the CWCNT (D1) line will cause the position to be incremented by 1. Each rising edge of the CCWCNT (D0) line will cause the position to be decremented by 1. The position will start at StartPos. Only a 16-bit counter will be used, giving a count range from .32K to +32K. One data point will be saved for each sample. Sampling will be commanded by the normal Command 3.
40
CBL 2 Technical Reference
Page 41
After “getting” the Analog channels, send the following commands to return the data from the CBL 2 to the host:
Command Syntax:
Comment:
{12,41,6} collect data in rotary motion mode; send before Command 3
{12,41,0} return number of points collected on next get statement; send after “getting” the analog channels
{12,41,.1,Start,Stop} return position list on next get statement
Additional Notes on Command 12 A few additional things to be aware of when using Command 12: ♦
When Command 12 is used, the power generally stays on all during sampling. (This is because the processor must look for the data at all times during the sample interval and not just at the sample times.) As a result, this mode tends to deplete the batteries very quickly.
♦
The number of data samples taken is limited only by the available memory after memory is reserved for the Command 1 channels that are set up. The CBL 2 has about 12,000 available memory locations. If X channels are setup and Y samples are selected using Command 3, the number of samples on CH 41 is limited to (12,000 – X…Y)/3.
♦
You absolutely must have at least one analog channel activated before sending the Command 3 to start sampling. You must do a GET of the analog data (to force the calculator to wait for the end of sampling) before retrieving the Command 12 CH 41 data.
Command 102
Power Control Command
Syntax: {102,pwrctl} Power Control .1 = Always ON; will automatically power down (APD) if running on batteries. 0 = Normal mode 1-1000 = Powers up this many seconds before data taken
CBL 2 Technical Reference
41
Page 42
Command 115
Check Set-up Information
Syntax: {115,channel} Channel 1, 2, 3, 11 This command returns the following status information: CBL 2 sig
CBL 2 significant figures
LabPro™ sig
LabPro significant figures
Y-min
Suggested Y-min for graphing
Y-max
Suggested Y-max for graphing
Y-scale
Suggested Y-scale for graphing sample rate
Typical sample rate number of samples
Typical number of samples to collect operation command
Typical operation command calculation equation
Suggested calculation equation for Command 4 sensor warm-up time
Sensor warm-up time (in seconds)
first coefficient
Suggested first coefficient for Command 4 second coefficient
Suggested second coefficient for Command 4 third coefficient
Suggested third coefficient for Command 4 number of pages
Sensor’s number of calculation pages (usually 0)
active page
Sensor’s active calculation page (usually 0)
Command 116
Check Long Sensor Name
Syntax: {116,channel} Channel 1, 2, 3, 11 This command returns the following information: long sensor name
42
Returns long sensor name in a format the calculator can handle
CBL 2 Technical Reference
Page 43
Command 117
Check Short Sensor Name
Syntax: {117,channel} Channel 1, 2, 3, 11 This command returns the following information: short sensor name
Returns short sensor name in a format the calculator can handle
Command 1998 Set LED Command Syntax: {1998,P1,P2 } P1
P2
1 = Red LED
0 = Off
2 = Yellow LED
1 = On
3 = Green LED Note: Leaving a LED turned on will run down the batteries in the CBL 2.
Command 1999 Sound Command Syntax: {1999,length 1,Pd 1 ,length 2 ,Pd 2 , . . .} Length
Pd
Sound stays on this long (in 100ms steps)
Tone half period in 100ms steps
Note: You can enter up to 32 pairs of values.
CBL 2 Technical Reference
43
Page 44
Command 2001 Direct Output to Digital-Out Port Syntax: {2001,data1,data2,data3. . .,dataN} Data1. . .DataN Must be between 0-15. For values outside this range, behavior is undefined. This command outputs data to the digital output port during a sampling run, thus giving the user interactive control of some types of hardware using the CBL 2 digital output lines. Please note the following: ♦
You can send from 1 to 16 data points. If you send more than one point, all the points will be sent out at about 200msec intervals before the next command is parsed. This allows you to clock data into a latch with a single command.
♦
The data you send goes to the SONIC channel. If you are collecting data on the SONIC channel and send this command, your data will be lost.
♦
Sending this command does not stop the sampling, and it should not affect the analog channels.
CAUTION: No protection of any kind is provided. Operation is not guaranteed; use this command at your own risk. If you are sampling via the sonic port, sending this command will corrupt your data.
Command 201
Archive Operations Command
Syntax: {201,operation,operand1,operand2,related_info_list} This command allows the calculator to determine the contents of FLASH memory.
Operation
Operand 1 1
Operand 2 1
0 = Delete/Write Enable
Not used
Not used
Related Information List 2 2.46802 = enable writing data to FLASH 1.35791 = enable deletion of data from FLASH
1* = Get directory size
Not used
Not used
2* = Get directory information
Directory type4 (except Saved Program)
n
3* = Get directory Label (n) 5
Directory type4 n
44
Calculator type3
Calculator type3
CBL 2 Technical Reference
Page 45
Operand 2
Related Information List 2
Operation
Operand 1
4 = Label directory entry 6
Directory type4 (except Saved Program)
n
11 = Clear directory entry (n)
Directory type4 n
Calculator type3
12 = Clear all directory entries
Directory type4
Not used
Calculator type3
13 = Clear all built-in user programs7
Not used
Not used
Calculator type3
21† = Save current data set
Number of elements in list
Not used
Ident 1 Ident 28
22 = Close data set (n)
n
Not used
23 = Restore data set (n)
n
Not used
24 = Save data set supplemental list (n) 9 n
Starting position to store in archive
25* = Get data set supplemental list size (n) 9 n
Not used
26* = Retrieve data set supplemental list (n) 9 n
Starting position (default = 1)
Number of elements (default = 0 {all})
31† = Allocate saved list
Number of elements in list
Not used
Ident 1 Ident 28
32 = Save list data (n)
n
Starting position to store in archive
List data (maximum 40 elements)
33 = Close list (n)
n
Not used
34* = Get list size (n)
n
Not used
35* = Retrieve List (n)
n
Starting position (default = 1)
Number of elements (default = 0 {all})
41 = Select programs 10
Not used
Not used
First item is calculator type (73, 83, etc.) followed by items to retrieve
42 = Deselect programs 11
Not used
Not used
1
1
List data (maximum 40 elements)
43 = Retrieve supplemental programs12 931-935, 941-945, 951-955 (RESERVED) 1001† = Perform garbage collection
CBL 2 Technical Reference
45
Page 46
1
Operand information relating to whatever operation is being performed. (must be integer)
2
Additional information about the operation to be performed.
3
The Calculator Type specifies the model of the calculator on which the user program is running. This determines which programs in the CBL 2 archive will be shown in the directory information. Available choices are: 73, 82, 83, 83.1 (for 83 Plus), 86, 89, 92, and 92.1 (for 92 Plus).
4
The Directory Type specifies the entries in the archive on which to perform the operation. Available choices are: 0 (Sample Data Set), 1 (Saved List), and 2 (Saved Program).
5
If a directory entry does not have a label assigned to it, the CBL 2 reports the label as ‘????????????????????’.
5,6
Because the TI-82, TI-89, TI-92, and TI-92 Plus do not receive string variables, the program names in the directory cannot be passed directly as strings. The Numeric List option in operation 3 provides an indirect way of representing the names. The list contains the ASCII code for each character in the name. These ASCII codes can be interpreted by the user program to display the correct letters on the calculator. 6
Send a command with Operation 4 to set up label directory entry; then follow it with another command that contains the label.
7
Built-in user programs: The CBL 2 stores a collection of calculator programs (DataMate) and look-up tables in its FLASH memory. These programs are intended to simplify the task of data collection and analysis. Because these programs are designed to work together, they can only be stored and deleted as a group. To free up memory in the CBL 2, you can delete the programs for calculators that you do not use. Upgrading User Programs: The FLASH Download software provides a way to update the user programs and lookup tables for all calculator platforms. The FLASH Download process automatically deletes all existing user programs (all calculator models) from the archive. The new look-up tables and programs are then installed into the archive. (Instructions for downloading new software are given on the TI web site at www.ti.com/calc.)
8
Two optional identifying numbers can be used when saving a data set or list. These numbers are saved with the data in addition to the supplied label.
9
Operations 24, 25, and 26 are provided to facilitate saving configuration information in the same data structure as a saved experiment, rather than in a separate file.
10
Operation 41 allows you to retrieve programs saved on the CBL 2. You can save programs to the CBL 2 by enabling writing {201,0,0,0,2.46802} and then sending programs from the calculator’s LINK/SEND menu.
11
Operation 42 cancels operation 41 or 43. If the TRANSFER key is not pressed within one minute, operations 41 and 43 cancel automatically.
46
CBL 2 Technical Reference