Section 3: Functions and features
Model DMM7510 7½ Digit Graphical Sampling Multimeter Reference Manual
3-58
DMM7510-901-01 Rev. B / May 2015
Using TSP commands to configure all six lines as digital outputs:
-- Send for loop as a single chunk or include in a script.
for i = 1, 6 do
digio.line[i].mode = digio.MODE_DIGITAL_OUT
end
Using TSP commands to set the state of each line individually:
digio.line[1].state = digio.STATE_HIGH
digio.line[2].state = digio.STATE_LOW
digio.line[3].state = digio.STATE_HIGH
-- You can use 0 instead of digio.STATE_LOW.
digio.line[4].state = 0
-- You can use 1 instead of digio.STATE_HIGH.
digio.line[5].state = 1
digio.line[6].state = 1
Using TSP commands to set all six lines at once by writing the decimal equivalent of the bit pattern to
the port:
-- You can write binary, decimal or hexadecimal values, as shown below.
-- Use binary value.
digio.writeport(0b110101)
-- Use decimal value.
digio.writeport(53)
-- Use hexadecimal value.
digio.writeport(0x35)
Reading a bit pattern
The programming examples below illustrate how to read part or all of a bit pattern that has been
applied to the digital I/O port by an external instrument. The binary pattern is 111111 (63 decimal).
Line 1 (bit 1) is the least significant bit.
Using SCPI commands:
Configure all 6 lines as digital inputs:
DIGital:LINE1:MODE DIGital, IN
DIGital:LINE2:MODE DIGital, IN
DIGital:LINE3:MODE DIGital, IN
DIGital:LINE4:MODE DIGital, IN
DIGital:LINE5:MODE DIGital, IN
DIGital:LINE6:MODE DIGital, IN
Read the state of Line 2:
DIGital:LINE2:STATe?
Value returned is 1.
Read the state of Line
3
:
DIGital:LINE3:STATe?
Value returned is
1
.
Read the value applied to the entire port:
DIGital:READ?
Value returned is 63, which is the decimal equivalent of the binary bit pattern.