120 Chapter 4 Making Measurements
Percent The PERC math operation determines the difference, in percent, between
each reading and the value in the PERC register. The equation is:
Result = ((Reading - PERC)/PERC)
· 100
Where:
Reading is any reading.
PERC is the value stored in the PERC register (power-on value = 1).
You can use the PERC math operation to determine the difference (in
percent) between an ideal value and the measured value. For example, the
following program determines the percent error of a 10 VDC voltage
measurement. Line 60 enters the ideal value (10) into the PERC register. Line
70 triggers the 20 readings. If a reading is exactly 10 VDC, the value returned
is 0. If a reading is, for example, 10.1 VDC, the value returned is:
Result = ((10.1 - 10)/10)
·100 = 0.01 · 100 = 1
10 OPTION BASE 1 !COMPUTER ARRAY NUMBERING STARTS AT 1
20 DIM Perc(20) !DIMENSION ARRAY FOR 20 PRECENTAGES
30 OUTPUT 722;"PRESET NORM" !PRESET, NRDGS 1,AUTO, DCV 10, TRIG SYN
40 OUTPUT 722;"NRDGS 20" !20 READINGS PER TRIGGER
50 OUTPUT 722;"MATH PERC" !ENABLE REAL-TIME PERC OPERATION
60 OUTPUT 722;"SMATH PERC 10" !WRITE 10 TO PERC REGISTER
70 ENTER 722;Perc(*) !SYN EVENT, ENTER PERCENT DIFFERENCE
80 PRINT Perc(*) !PRINT PERCENT DIFFERENCE
90 END
The following program is similar to the preceding program except that it uses
the post-process PERC operation.
10 OPTION BASE 1 !COMPUTER ARRAY NUMBERING STARTS AT 1
20 DIM Perc(20) !DIMENSION ARRAY FOR 20 PERCENTAGES
30 OUTPUT 722;"PRESET NORM" !PRESET,NRDGS 1,AUTO, DCV 10, TRIG SYN
40 OUTPUT 722;"MEM FIFO" !ENABLE READING MEMORY, FIFO MODE
50 OUTPUT 722;"NRDGS 20" !20 READINGS PER TRIGGER
60 OUTPUT 722;"MMATH PERC" !ENABLE POST-PROCESS PERC OPERATION
70 OUTPUT 722;"SMATH PERC 10" !WRITE 10 TO PERC REGISTER
80 OUTPUT 722;"TRIG SGL" !TRIGGER READINGS
90 ENTER 722;Perc(*) !RECALL READINGS USING IMPLIED READ,
95 !PERFORM PERC OPERATION
100 PRINT Perc(*) !PRINT PERCENT DIFFERENCE
110 END
DB The DB math operation calculates a ratio in decibels. The equation is:
Result = 20
·log
10
,(Reading/REF)
Where:
Reading is any reading.
REF is the value in the REF register (default = 1).
You can change the value in the REF register using the SMATH command.