Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeEnglishEspañolContact

The text of a manual · part 7 of 9

CBL 2 Technical Reference: Programming the CBL 2, pages 47 to 54

Pages 47 to 54 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 47

12

The CBL 2 can store additional built-in programs in the same storage area as DataMate (for example, programs such as DataDir and Photogate). Because of memory space considerations, these supplemental programs are normally not transferred to the calculator with DataMate when the TRANSFER key is pressed. Operation 43 allows you to retrieve these supplemental programs by overriding the normal operation of the TRANSFER key. *Operations with an asterisk return values as explained below: (Use the GET command after sending the command with this operation.)

♦

♦

♦

♦

♦

Operation 1: −

If the data type in the GET command is a list, will return: {# Saved data sets, # Lists, # Saved programs/applications, Reserved for DataMate, Reserved for DataMate, Reserved for DataMate, Bytes free in archive}

−

If the data type in the GET command is a real number, will return Bytes free in archive.

Operation 2: −

If the data type in the GET command is a list, will return: {Ident 1, Ident2}. (See footnote 8 for explanation of these values.)

−

If the data type in the GET command is a real number, will return Ident 1.

Operation 3: −

If the data type in the GET command is a string, will return: 20-character name of item.

−

If the data type in the GET command is a categorical list (TI-73 only), will return 4 elements of 5 characters each. Concatenate to form name of item.

−

If the data type in the GET command is a list, will return 20-element list, each element representing a character code in the name of the item.

Operation 25 or 34: −

If the data type in the GET command is a list, will return: {# of elements}.

−

If the data type in the GET command is a real number, will return # of elements.

Operation 26 or 35: −

If the data type in the GET command is a list, will return a list of the elements specified in the request.

General Notes: ♦

All data types are stored in the CBL 2 directory in the same order in which they are received. The CBL 2 does not attempt to sort these entries in any other order.

♦

If you transfer to the CBL 2 a program with the same name as a program already in storage, the old program will be deleted and the new program will be added to the end of the directory. (A program with the same name but a different calculator model will not be affected.)

CBL 2 Technical Reference

47

Page 48

♦

The labels and numeric information for data sets and lists can be the same as other data sets and lists. The CBL 2 does not check for duplicate descriptions. The uniqueness of the individual directory entries is preserved by their unique directory entry numbers.

†Notes on Garbage Collection: Operations 21, 31, and 1001 may cause the CBL 2 to automatically perform garbage collection on the FLASH memory. For full or heavily used archives (many deleted items), garbage collection can take over one minute to complete. Therefore, when executing these operations, you must poll the CBL 2 to determine when the operation is complete and it is safe to move to the next command. The CBL 2 will return a real number or a single-element list (depending on the data type used by the calculator) with the following values: ♦

2 = Performing garbage collection (operation may take extra time to complete)

♦

1 = Performing requested operation (wait for operation complete flag)

♦

0 = Requested operation is complete. Proceed with next command.

Continue to send GET commands until the CBL 2 returns the 0. Notes on Battery Status: Operations 11, 12, 13, 21, and 31 will generate an error if the battery status is low. The other operations do not check the battery status because it is expected that the program checks the results of these preliminary operations. This allows a full sequence of operations (such as Allocate/Save/Label/Close list) to complete even if the battery status should go low after the sequence has started. Therefore, it is important that programs using these commands check and honor the error conditions reported by these initial commands. (Use Command 7 to check the battery status.)

48

CBL 2 Technical Reference

Page 49

Programming Examples Programs are created on a TI calculator to set up specific CBL 2 operations, depending on the experiment that you want to perform. Samples of various types of programs follow. Each program includes both program commands and comments explaining what the commands do.

Example 1: Temperature Non-Realtime Data Collection :ClrAllLists :ClrHome :Send({0}) :Send({6,4}) :Send({1,1,1}) :Send({3,.1,100,0}) :Get(L2) :Get(L1) :Plot1(Scatter,L1,L2,.) :ZoomStat

Reset CBL 2. (This clears CBL 2 RAM.) Turn CBL 2 sound on. Set up Channel 1 for data collection. Take temperature sample every .1 second. Retrieve temperature data to L2. Retrieve time data to L1. Plot temperature versus time.

Example 2: Temperature Realtime Data Collection :ClrAllLists :PlotsOff:Func :FnOff:AxesOn :1üXmin:30üXmax:1üXscl :M20üYmin:60üYmax:.1üYscl :ClrHome :Send({0}) :Send({6,4}) :Send({1,3,1}) :30üdim(L2) :Send({3,1,M1,0}) :ClrDraw :For(I,1,30,1) :Get(L2(I)) :Pt-On(I,L2(I)) :End

Initalize graphing functions. Set up the min/max range and scale factors as needed. Reset CBL 2. (This clears CBL 2 RAM.) Turn CBL 2 sound on. Set up Channel 3 for data collection. Dimension List Take a sample once every second; re-arm immediately and get next sample. Get a sample and plot it on the graph for 30 points.

Example 3: Distance and Velocity Non-Realtime Data Collection :PlotsOff :ClrAllLists :ClrHome :ClrDraw :Send({0}) :Send({6,4}) :Send({1,11,1,1}) :Send({3,.1,100,0}) :Get(L2) :Get(L3) :Get(L1) :Plot1(Scatter,L1,L2,.) :Plot2(Scatter,L1,L3,+) :ZoomStat

CBL 2 Technical Reference

Reset CBL 2. (This clears CBL 2 RAM.) Turn CBL 2 sound on. Set up Channel 11 (Sonic) for data collection (distance and velocity). Take a sample every .1 second. Retrieve distance data to L2. Retrieve velocity data to L3. Retrieve time data to L1. Plot distance versus time. Plot velocity versus time.

49

Page 50

Example 4: Multiple Channels Non-Realtime Data Collection :PlotsOff :ClrAllLists :ClrHome :Send({0}) :Send({6,4}) :Send({1,1,10}) :Send({1,2,11}) :Send({1,3,12}) :Send({3,.1,100,0}) :Get(L2) :Get(L3) :Get(L4) :Get(L1) :Plot1(Scatter,L1,L2,.) :ZoomStat :Pause :ClrHome :PlotsOff :Plot2(Scatter,L1,L3,.) :ZoomStat :Pause :ClrHome :PlotsOff :Plot3(Scatter,L1,L4,.) :ZoomStat

Reset CBL 2. (This clears CBL 2 RAM.) Turn CBL 2 sound on. Set up Channel 1 for temperature data collection in Centigrade. Set up Channel 2 for temperature data collection in Fahrenheit. Set up Channel 3 for light intensity data collection. Take a sample every .1 second. Retrieve temperature in Centigrade data to L2. Retrieve temperature in Fahrenheit data to L3. Retrieve light intensity data to L4. Retrieve time data to L1. Plot temperature in Centigrade versus time.

Plot temperature in Fahrenheit versus time.

Plot light intensity versus time.

Example 5: Conversion Equation Setup (Command 4) :ClrAllLists :ClrHome :Send({0}) :Send({6,4}) :Send({1,1,1,0,0,1}) :Send({3,.1,100,0}) :Send({4,1,M1}) :Get(L2) :Get(L1) :Send({4,1,7,50,5}) :Get(L3) :Plot1(Scatter,L1,L2,.) :ZoomStat :Pause :ClrHome :PlotsOff :Plot2(Scatter,L1,L3,.) :ZoomStat

50

Reset CBL 2. (This clears CBL 2 RAM.) Turn CBL 2 sound on. Set up Channel 1 for data collection with conversion equation enabled. Take a sample every .1 second. Apply unary equation to return the raw data. Retrieve raw data to L2. Retrieve time data to L1. Apply exponential equation type to the raw data. Retrieve the converted data to L3. Plot raw data versus time.

Plot the converted data versus time.

CBL 2 Technical Reference

Page 51

Example 6: Data Control Setup (Command 5) :ClrAllLists :ClrHome :Send({0}) :Send({6,4}) :Send({1,2,11}) :Send({3,.1,100,0}) :Get(L2) :Get(L1) :Send({5,2,0,35,45}) :Get(L3)

Reset CBL 2. (This clears CBL 2 RAM.) Turn CBL 2 sound on. Set up Channel 2 for temperature data collection in Fahrenheit. Take a sample every .1 second. Retrieve temperature in Fahrenheit data to L2. Retrieve time data to L1. Process temperature data 35 through 45 for retrieval. Retrieve temperature data 35 through 45 to L3.

Example 7: Digital In Data Collection :ClrAllLists :ClrHome :Send({0}) :Send({6,4}) :Send({1,21,1}) :Send({3,.1,100,0}) :Get(L2) :Get(L1) :Disp L2 :Disp L1

Reset CBL 2. (This clears CBL 2 RAM.) Turn CBL 2 sound on. Set up Channel 21 (Digital In) for digital data collection. Take a sample every .1 second. Retrieve collected digital data to L2. Retrieve time data to L1. Display collected digital data. Display time.

Example 8: Digital Out :ClrAllLists :ClrHome :Send({0}) :Send({6,4}) :Send({102,M1}) :Send({1,31,16,0,1,2,3, 4,5,6,7,8,9,10,11,12,13 ,14,15}) :Send({3,.5,10,0}) :Disp "WHEN SAMPLING" :Disp "COMPLETED" :Disp "PRESS ENTER" :Disp "TO TURN" :Disp "POWER OFF" :Pause :Send({0})

CBL 2 Technical Reference

Reset CBL 2. (This clears CBL 2 RAM.) Turn CBL 2 sound on. Turn power on if external LED is to display the Digital Out. Set up Channel 31 (Digital Out) to output listed values to digital in source. Every .5 second send the digital out value to the digital in source.

Reset CBL 2 to turn power off.

51

Page 52

Example 9: CBL 2 LED Display This program is just for fun. It makes the CBL 2’s lights blink on and off. : For(M,1,10,1) : For(N,1,3,1) : Send({1998,N,1}) : End : For(N,1,3,1) : Send({1998,N,0}) : End : End

Repeat 10 times to make the lights flicker on and off. Turn all three lights on. Turn all three lights off.

Example 10: Playing Music on the CBL 2 This program plays “We Wish You a Merry Christmas.” :1500üK :{2*K,2*K,K,K,K,K,2*K, 2*K,2*K,2*K,K,K,K,K, 2*K,2*K,2*K,2*K,K,K,K,K, 2*K,2*K,K,K,2*K,2*K,2*K,2*K}üL1 :{182,136,136,121,136,144,162, 162,162,121,121,108,121,136, 144,182,182,108,108,102,108,121, 136,162,182,182,162,121,144,136}üL2 :For(N,1,30,1) :Send({1999,L1(N),L2(N)}) :End

K = 0.15 second Play the short notes for 0.15 seconds and the long ones for 0.3 seconds. Enter each note value in the list.

Send each time and note to the CBL2 so that it can play every note in the order of the lists.

Example 11: Command 8 Program This is a program to receive data points while sampling. :Send({0}) :Send({1,1,1}) :Send({3,.2,100,0})

Clear sampling settings. Set up Channel 1 with auto-ID. Take 100 samples in 20 seconds.

:For(N,1,80,1) :Send({8,1,0}) :Get(L2) :Disp L2 :End :Get(L1)

Use a loop to get samples as they are taken. Ask for Channel 1’s last sampled data point. Get the sensor type, most recent data point, and position in resulting list. Display the three-element list to the screen.

52

Get the resulting list of data.

CBL 2 Technical Reference

Page 53

Example 12: Command 9 Program This is a program used to read a single data point. :Send({0}) :Send({1,1,1}) :Send({9,1,0}) :Get(A) :Disp A

Clear sampling settings. Auto-ID a TI temperature sensor. Send Command 9 to get a single data point from Channel 1. Get the single data point. Display the one data point.

Example 13: Command 10 Program This program uses Command 10 with the TI temperature sensor. This test is used to find a sinusoidal-like pattern in temperature as it rises and falls constantly in an experiment that lasts 10 minutes. :Send({0}) :Send({1,1,1}) :Send({3,6,100,0}) :Get(L1)

Clear sampling settings. Auto-ID the TI temperature sensor. Collect 1 sample every 6 seconds for 10 minutes. Get the data for later use or display.

:Send({10,1,1,20,80,5})

Send the advanced data reduction command with the heartbeat algorithm. Set the lower threshold to 20% above the minimum point. Set the upper threshold to 80% above the minimum point. Set the standard temperature variance to 5¡C. If the maximum temperature minus the minimum temperature is less than 5¡C, then the test proves there are no oscillations in temperature outside of 5¡C in the 10-minute experiment. If the variance is more than 5¡C, then this will count how many times it goes over the 80% threshold level plus how many times it goes below the 20% threshold level.

:Get(A)

Get the number of times the samples went above the upper threshold and went below the lower threshold (the edge count). If the data range was less than 5¡C, the result is zero.

:A/6üB

Divide the edges per sample by the sample time. This returns true frequency (edges per second).

:Disp B

Display the frequency.

CBL 2 Technical Reference

53

Page 54

Example 14: Archive Program (Command 201) This program stores and retrieves a data set. :Send({201,0,0,0,2.46802}) :Send({201,21,5,0,1.1,2.0} ) :2üX :While Xø0 :Get(X) :End :Send({201,1,0,0,83.1}) :Get(L1) :{1,2,3,4,5}üL2 :{201,24,L1(1),1}üL3 :augment(L3,L2)üL4 :Send(L4) :"SEC 1.1, EXP 2"üStr1 :Send({201,4,0,L1(1)}) :Send(Str1) :Send({201,22,L1(1),0})

Enable “writes” to the CBL 2 FLASH memory. Save the data. Make room for 5 list elements. Give some optional identification (e.g., data from Section 1.1, Experiment 2). Wait for operation to complete.

Locate newest data set in FLASH memory. Its entry number will be in L 1[1]. Save associated data from L2 into the record.

Label the data set. Close the data set. Saving is complete. Reset the CBL 2 and calculator.

:ClrAllLists :Send({0}) :Send({201,1,0,0,83.1}) :Get(L1) :Send({201,2,0,L1(1)}) :Get(L2) :Send({201,3,0,L1(1),83.1}) :Get(Str1) :Disp Str1,L2 :Send({201,26,L1(1),1}) :Get(L3) :Disp L3 :Send({201,23,L1(1),0}) :Get(L2) :Disp L2

54

Locate the most recently saved data set. Get and display the identifying label and numbers.

Get and display the saved list data. Restore and display the sample data. Data can be retrieved using Command 5, which is described elsewhere in this document.

CBL 2 Technical Reference