Casio EA-100 User Manual

Chapter 3: Commands and Programming
Chapter 3:
Commands and Programming
This chapter describes how to set up the data analyzer and control it using commands sent from a connected CFX-9850G or CFX-9800G graphic sci­entific calculator.
Command Conventions and Formats ................................ 24
Sending Commands from a Calculator
to the Data Analyzer.................................................... 27
Transferring Sampled Data to a Calculator ........................ 30
Command Reference ......................................................... 36
Command 0 - All Clear ............................................... 36
Command 1 - CHANNEL SETUP ............................... 37
Command 2 - DATA TYPE AND DISPLAY SETUP..... 43
Command 3 - SAMPLE AND TRIGGER SETUP ....... 45
Command 4 - CONVERSION EQUATION SETUP .... 50
Command 5 - DAT A RANGE SETUP ......................... 52
Command 6 - MULTIMETER MODE SETUP ............. 54
Command 7 - REQUEST STATUS ............................. 56
Command 8 - SAMPLING START.............................. 56
Command 9 - PROBE CALIBRATE............................ 57
23
Chapter 3: Commands and Programming
Command Conventions and Formats
Commands sent from a connected CFX-9850G or CFX-9800G graphic sci­entific calculator can be used to make various settings and control opera­tions of the data analyzer.
Commands
Commands can be written as CFX-9850G list data or CFX-9800G matrix data in the format shown below.
{m,n,n,n,n,...}
Command number Parameter number
There are a total of 10 commands numbered from 0 through 9. The following describes the function of each command.
• Note that execution of the commands marked with asterisks (0, 1, 3) causes all data sampled up to that point to be deleted.
Number Description
0* All Clear
This command initializes all channels.
1* CHANNEL SETUP
This command sets up a channel for data sampling.
2 DATA TYPE AND DISPLAY SETUP
This command specifies the data type when transferring data from a connected calculator.
3* SAMPLE AND TRIGGER SETUP
This command controls data sampling timing and sets up trig­ger parameters.
4 CONVERSION EQUATION SETUP
This command sets up parameters for converting measured data to another unit.
5 DATA RANGE SETUP
This command specifies the data type (raw sample data, first derivative, second derivative) when transferring data to a con­nected calculator. It also specifies the start point and end point of the data being recalled.
24
Chapter 3: Commands and Programming
Number Description
6 MULTIMETER MODE SETUP
This command sets the Multimeter Mode unit of measurement for a particular channel.
7 REQUEST STATUS
This command creates a data list concerning the data analyzer’s current status (error status, probe connection data, etc.) being requested by the connected calculator.
8 SAMPLING START
This command causes the data analyzer to start sampling im­mediately.
9 PROBE CALIBRATE
This command calibrates probe sampling values and is used to calibrate sampling levels when multiple probes are being used.
Initial Settings
The standard syntax for a command is {1,n,n,n,n,...}, where “n” indicates a parameter. Command parameters are automatically set to their initial de­faults whenever any of the following occurs.
• When a parameter is not specified inside a command.
• Whenever an Auto-ID operation is performed.
• Whenever the data analyzer is put into the READY state by operation of the [RESTART] key .
• Whenever you exit the Setup Mode after changing settings, and the data analyzer enters the READY state.
You can find information about the initial defaults for each command in the
P.36
Command Reference.
25
Chapter 3: Commands and Programming
Programming
Programs can be input on the CFX-9850G graphic scientific calculator and then sent to the data analyzer to make it perform a series of tasks.
• Note that data analyzer control programs can be input on the CFX-9850G graphic scientific calculator only. The CFX-9800G can be used to send commands one-by-one.
Tasks Normally Controlled by Programs
The following outline describes the normal sequence of a data analyzer sys­tem control program.
1. Command 0 (ALL CLEAR) or Command 1 (CHANNEL SETUP, setting the channel parameter to 0)
Either of these commands is used to reset all channels and clear any sampled data currently in data analyzer memory.
2. Command 1 (CHANNEL SETUP) This command is used to perform channel setup and specify the type of
data to be sampled.
3. Command 2 (DATA TYPE/DISPLAY SETUP) This command is used when necessary to specify special data type.
4. Command 4 (CONVERSION EQUATION SETUP) This command is used when necessary to specify a conversion equation.
5. Command 9 (PROBE CALIBRATE) This command is used when necessary to calibrate the probe.
6. Command 3 (SAMPLE AND TRIGGER SETUP) This command specifies such sampling parameters as sampling duration,
number of samples, time recording, etc. The data analyzer interprets re­ceipt of Command 3 as being the end of the setup routine, and expects sampling to begin next.
Whenever using Command 3, be sure to also include a display halt com­mand (^). This causes the calculator to wait until the data analyzer fin­ishes its sampling operation before continuing with program execution.
—————— Sampling operation with data analyzer
7. Command 5 (DATA RANGE SETUP) This command is used when necessary to specify the range of data to be
transferred from the data analyzer to the CFX-9850G.
8. Data transfer from the data analyzer to the CFX-9850G
Though the actual tasks included in a program will differ according to the type of sampling being performed, tasks 1, 2, 6, and 8 in the above outline should be included in all programs.
26
Chapter 3: Commands and Programming
Example Program
The following is an example program written for the CFX-9850G.
Cls
{1,0} List 6 Send(List 6)
{1,1,1} List 6 Send(List 6)
{3,0.5,100,1} List 6 Send(List 6) ^
Receive(List 1)
Receive(List 2)
S-Gph1 DrawOn,Scatter, List1,List2,1,Dot, Blue
S-Gph2 DrawOff S-Gph3 DrawOff
DrawStat
CFX-9850G graph clear operation
Clears all channel settings and data.
Specifies sampling with Auto-ID probe con­nected to CH1.
Specifies sample time of 0.5 seconds, 100 samples, and absolute time recording on. Note the use of the display halt command (^), which causes the calculator to wait until the data analyzer finishes its sampling op­eration before continuing with program ex­ecution. Always use the display halt com­mand (^) with Command 3.
Transfers time data to List 1.
Transfers CH1 data to List 2.
Sets up CFX-9850G statistical graph.
Turns off statistical graphs that are not be­ing used.
Draws statistical graph on CFX-9850G.
Sending Commands from a Calculator to the Data Analyzer
This section explains how to send individual command from a graphic scien­tific calculator to the data analyzer. Note that the procedure you should use depends on whether you are using a CFX-9850G or a CFX-9800G calcula­tor.
Sending List Data with the CFX-9850G “Send(” Command
Use the CFX-9850G calculator’s Send(List) command to send list data to the data analyzer, which executes commands in accordance with the contents of
27
Chapter 3: Commands and Programming
the list. When using the Send(List) command, you should specify the list that contains the commands by replacing “List” with a CFX-9850G List variable (List 1 through List 6).
• Sending a new setup command (Command 1 or Command 3) clears all previously sampled data from data analyzer memory.
To input the “Send(” command on the CFX-9850G
1. In the CFX-9850G PRGM EDIT Mode, press [SHIFT] [PRGM] [F6] (g) [F4] (I/O) [F3] (Send) to input the Send( command at the current cursor position.
2. Press [OPTN] [F1] (LIST) [F1] (List) [1] to input List 1. You can input any value from 1 through 6 in place of [1] to specify List 1 through 6.
Send(List) Examples
The following shows two samples using the Send(List) command.
{1,2,2,1} List 2 Send(List 2)
{3,0.2,100} List 3 Send(List 3)
P .36
For full details about using commands to control the data analyzer, see “Com­mand Reference”.
Sending Matrix Data with the CFX-9800G LINK Mode
Use the CFX-9800G calculator’s LINK Mode to send matrix data to the data analyzer. Note that the matrix you use for this purpose must have only one column.
• Sending a new setup command (Command 1 or Command 3) clears all previously sampled data from data analyzer memory.
To send matrix data from the CFX-9800G
1. Check to make sure that the data analyzer and the CFX-9800G are con-
P .13
28
nected properly.
2. Turn on the data analyzer.
3. On the CFX-9800G, press [B] (LINK) to enter the Data Communication Mode.
4. Press [F1] (TRN) [] [] [] [] [EXE] [F2] (ONE) to display all of the matrix data currently stored in memory.
5. Use [] and [] to scroll through the data and select the matrix that con­tains the command you want to send.
6. Press [EXE] to send the data.
• The data analyzer receives the matrix data and executes setup commands accordingly .
Chapter 3: Commands and Programming
7. Repeat steps 5 and 6 as many times as necessary to send any other matrix data that you want.
Matrix Data Example
The following describes a typical example procedure for sending commands that set up the data analyzer for sampling of distance data with a distance sensor.
1. Input the following matrix data on the CFX-9800G.
1 0
1 Command 1 4 Channel: SONIC 2 Unit: meters
3 Command 3
0.5 Sampling duration: 0.5 second 20 Number of samples: 20
1 Absolute time recording: On
2. Now perform the steps under “To send matrix data from the CFX-9800G” above to send the matrix to the data analyzer. Note that the final matrix data sent to the data analyzer before the start of sampling must be Com­mand 3 (SAMPLE AND TRIGGER SETUP).
3. Press the data analyzer’s [TRIGGER] key to start data sampling.
4. The DONE indicator appears on the display when data sampling is com-
P.35
plete. See “Transferring Data to the CFX-9800G” for details on transfer­ring sampled data from the data analyzer to the CFX-9800G.
Channel clear
29
Chapter 3: Commands and Programming
Transferring Sampled Data to a Calculator
This section explains how to send sampled data between the data analyzer and a connected CFX-9850G or CFX-9800G graphic scientific calculator for graphing and analysis.
Transferring Data to the CFX-9850G
The following explanations all apply to transferring data from the data analyzer to the CFX-9850G only.
To use the “Receive(” command to fetch data
1. Connect the data analyzer to the CFX-9850G.
2. On the CFX-9850G, perform the following key sequence to execute the Receive( command: [SHIFT] [PRGM] [F6] (g) [F4] (I/O) [F4] (Recv).
• Execution of the Receive( command on the calculator starts transfer of data from the data analyzer.
• The sampled data is stored in calculator memory in accordance with the parameter you specify (variable, list or matrix) with the Receive( com­mand.
• Further data transfer stops if CFX-9850G memory becomes full during execution of the Receive( command. See the documentation that comes with the CFX-9850G for details on what to do when memory becomes full.
Each execution of a Receive(List) command recalls one data group only. CH1 original sampled data, CH1 group.
d/dt, and CH1 d2/dt
2
are each one data
Post-processing Off
Only the raw sample data is transferred by the Receive( command when post-processing is turned off with CHANNEL SETUP (Command 1). Data items are recalled in the following sequence.
RecTIMECH1CH2CH3SONICDIG INRecTIME....
Post-processing On
When post-processing is turned on with CHANNEL SETUP (Command 1), the data produced by the post-processing is sent following the raw sample data. Data items are recalled in the following sequence (when a: raw sample
d/dt, c: d2/dt
data, b:
RecTIMECH1 aCH1 bCH1 cCH2 aCH2 bCH2 cCH3 aCH3
bCH3 cSONIC aSONIC bSONIC cDIG INRecTIME....
30
2
).
Chapter 3: Commands and Programming
• Note that the data transferred by a Receive(List) command execution is
P.34
somewhat different when statistical post-processed data is involved. See “Using Receive(List) to Fetch Statistical Post-Processed Data”.
The following are detailed explanations of how the Receive( command works with each type of parameter that can be specified with it.
Receive(Variable)
This format assigns received data to a variable. Variable names A through Z,
r, and
θ
can be used for storage of data. When more than one sample data item is involved, each execution of Receive( returns the last data item sam­pled (or calculated) from the active channel. This format is normally used for data obtained by real-time sampling.
Receive(List n)
This format can be used to specify one of six lists (List 1 through List 6) for storage of up to 255 data points.
P.32
Receive(Mat n)
This format specifies a matrix (Mat A through Mat Z) for storage of up to 14
P.32
rows of data samples.
• Data can be transferred from the data analyzer as many times as you like, until it is deleted by Command 0, Command 1 or Command 3.
Sample Program Using Receive(Variable)
The following program fetches up to 30 sample data items and assigns them to CFX-9850G variables.
{3,1,–1} List 6 Send(List 6)
For 1 I To 30
Receive(A) PlotOn I,A Next
Text 2,10,"TEMP." Text 55,100,"TIME"^ {0} List 6 Send(List 6)
Specifies sample time of one second for real­time sampling.
Sets up a loop that repeats 30 times by sequentially assigning values from 1 to 30 to variable I.
Sequentially recalls sample data and dis­plays it in a graph.
Sends the CLEAR command (Command 0) and exits real-time sampling.
31
Chapter 3: Commands and Programming
Sample Operation Using Receive(List)
The following program fetches sampled data items and assigns them to CFX­9850G list variables.
Receive(List 1)
Receive(List 2)
* The lowest numbered channel available in the following sequence:
RecTIMECH1CH2CH3SONICDIG IN
Fetches up to 255 data items from the lowest num­bered channel*, and stores them in List 1.
Fetches up to 255 data items starting from the next active channel, and stores them in List 2.
Fetching Data Using Receive(Matrix)
Transferring data to a matrix is a bit different from other data transfer opera­tions. The Receive(Mat n) command causes up to 255 sample data items for all active channels (or RecTIME) to be returned to the matrix specified by the command. The number of data items transferred to the calculator depends on the amount of memory available on the calculator. The number of rows in the matrix matches the number of active channels (RecTIME is counted as one channel when it is selected) where the data (including post-processed data) is stored.
Sample Operation Using Receive(Matrix)
The following program fetches CH1 and CH2 sampled data and assigns them to a CFX-9850G matrix.
Receive(Mat A) Fetches up to 255 data items from each active chan-
nel (CH1 and CH2 in this example), and stores them in matrix Mat A, whose dimensions are 2 × 255. CH1 data is stored in Row 1, while CH2 data is stored in Row 2.
Using Receive(List) to Fetch Sampled Data and Post-Processing Data
This example provided in this section performs the following calculations.
• First derivative of data sampled by CH1
• Second derivative of data sampled by SONIC channel
The following data is transferred to the CFX-9850G.
• All CH1 data (raw sample data and first derivative)
• Post-processed SONIC channel data (second derivative only)
In this example, a total of 300 samples are taken with CH1 and the SONIC channel, and all other channels are inactive. Post-processing is turned on,
32
Chapter 3: Commands and Programming
with the first derivative calculated for CH1 sample data, and the second de­rivative calculated for the SONIC channel.
P.52
DATA RANGE SETUP parameters (Command 5) can be used to specify the data groups and data range to be transferred to the CFX-9850G. This com­mand comes in handy when you want to fetch only specific data items, or when there are more than 255 data items in data analyzer memory . Note that executing the Receive(List n) command without using Command 5 to specify a data range when there are more than 255 data items causes an error on the calculator because the number of data items that can be assigned to a list is limited to 255.
• Whenever you are fetching post-processed data, you must use CHAN-
P.37
P.52
NEL SETUP (Command 1) to set the post-processed sample parameter
d/dt), 2 (d/dt or d2/dt
to 1 (
2
) or 3 (STA T). Note also that the DATA RANGE SETUP (Command 5) Data Select parameter must match the specifica­tion you make here.
Sample Operation Using Receive(List) to Fetch Sampled Data and Post-Processed Data
The following program fetches sampled data and post-processed data to a CFX-9850G list.
{5,1,0,1,255}List 6 Send(List 6) Receive(List 1)
Receive(List 2)
{5,4,2,1,255}List 3 Send(List 3)
Receive(List 3)
{5,1,0,256,300} List 4 Send(List 4)
Receive(List 4)
Receive(List 5)
{5,4,2,256,300} List 6 Send(List 6)
Receive(List 6)
Fetches CH1 data samples (1 to 255).
d/dt for CH1 (1 to 255).
Fetches
Sends DATA RANGE SETUP Command (Command 5) to specify SONIC and sec­ond derivative data to data analyzer.
2
Fetches SONIC d
2
/dt
(1 to 255).
Sends DATA RANGE SETUP command to data analyzer: CH1 (256 to 300).
Fetches CH1 data samples (256 to 300).
Fetches
d/dt for CH1 (256 to 300).
Sends DATA RANGE SETUP command to data analyzer: SONIC d
Fetches SONIC d
2
2
2
/dt
(256 to 300).
2
/dt
(256 to 300).
33
Chapter 3: Commands and Programming
Two Receive(List) cycles are required in this example because there are more than 255 samples. Following the first two Receive(List) commands, a single Send(List) is necessary to verify the data fetches from the SONIC channel. The next Send(List) command specifies the data range of Receive(List4) and Receive(List5). The following shows how data is stored in the different lists after execution of this program is complete.
List 1 .... CH1 data samples (1 to 255)
List 4 .... CH1 data samples (256 to 300)
List 2 .... CH1 sample post-processing data
List 5 .... CH1 sample post-processing data
List 3 ....SONIC channel sample post-processing data
(1 to 255)
List 6 ....SONIC channel sample post-processing data d
(256 to 300)
Using Receive(List) to Fetch Statistical Post­Processed Data
When statistical post-processing is specified as the post-processing type, only one channel can be active for output of statistic post-processed data only from the data analyzer (raw sample data is deleted).
Four executions of the Receive(List) command are required to fetch statisti­cal data, one each for the mean, standard deviation, minimum value, and maximum value, all of which are produced based on the raw sample data.
If CH1 is reserved for statistical data, for example, the following commands would be required to fetch statistical data and store it in a CFX-9850G list.
d/dt (1 to 255) d/dt (256 to 300)
d2/dt
2
/dt
2
2
Receive (List 1)
Receive (List 2)
Receive (List 3)
Receive (List 4)
34
CH1 mean data
CH1 standard deviation data
CH1 minimum value data
CH1 maximum value data
Loading...
+ 26 hidden pages