def set_idle(self, time: float = 1.0e-9) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:NEDGe:IDLE <NR3> :TRIGger:NEDGe:IDLE? **Description** Set the idle time of Nth edge trigger. Query the current idle time of Nth edge trigger. **Parameter** ====== ===== =========== ======= Name Type Range Default ====== ===== =========== ======= <NR3> Real 16ns to 4s 1μs ====== ===== =========== ======= **Return Format** The query returns the idle time value in scientific notation. **Example** :TRIGger:NEDGe:IDLE 0.002 The query returns 2.000000e-03. """ check_input(time, "time", float, 16.0e-9, 4.0, "s") self.subdevice.device.ask(f":TRIGger:NEDGe:IDLE {time}")
def set_edge(self, number: int = 2) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:NEDGe:EDGE <NR1> :TRIGger:NEDGe:EDGE? **Description** Set the edge number of Nth edge trigger. Query the current edge number of Nth edge trigger. **Parameter** ====== ======== =========== ======= Name Type Range Default ====== ======== =========== ======= <NR1> Integer 1 to 65535 2 ====== ======== =========== ======= **Return Format** The query returns an integer between 1 and 65535. **Example** :TRIGger:NEDGe:EDGE """ check_input(number, "number", int, 1, 65535, "") self.subdevice.device.ask(f":TRIGger:NEDGe:EDGE {number}")
def set_scl_source(self, channel: int = 1) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:SPI:SCL <source> :TRIGger:SPI:SCL? **Description** Select the SCL channel source in SPI trigger. Query the current SCL channel source in SPI trigger. **Parameter** ========= ========= ==================== ======== Name Type Range Default ========= ========= ==================== ======== <source> Discrete {CHANnel1|CHANnel2} CHANnel1 ========= ========= ==================== ======== **Return Format** The query returns CHAN1 or CHAN2. **Example** :TRIGger:SPI:SCL CHANnel2 The query returns CHAN2. """ check_input(channel, "channel", int, 1, 2) self.subdevice.device.ask(f":TRIGger:SPI:SCL CHANnel{channel}")
def set_data_minus_source(self, channel: int = 2) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:USB:DMINus <source> :TRIGger:USB:DMINus? **Description** Select the D- data channel source in USB trigger. Query the current D- data channel source in USB trigger. **Parameter** ========= ========= ==================== ======== Name Type Range Default ========= ========= ==================== ======== <source> Discrete {CHANnel1|CHANnel2} CHANnel2 ========= ========= ==================== ======== **Return Format** The query returns CHAN1 or CHAN2. **Example** :TRIGger:USB:DMINus CHANnel2 The query returns CHAN2. """ check_input(channel, "channel", int, 1, 2) self.subdevice.device.ask(f":TRIGger:USB:DMINus CHANnel{channel}")
def set_timeout(self, time: float = 1.0e-6) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:SPI:TIMeout <time_value> :TRIGger:SPI:TIMeout? **Description** Set the timeout time in SPI trigger when the trigger condition is Timeout and the unit is s. Query the current timeout time in SPI trigger when the trigger condition is Timeout. **Parameter** ============= ===== ============ ======= Name Type Range Default ============= ===== ============ ======= <time_value> Real 100ns to 1s 1µs ============= ===== ============ ======= **Return Format** The query returns the timeout time in scientific notation. **Example** :TRIGger:SPI:TIMeout 0.000002 The query returns 2.000000e-06. """ check_input(time, "time", float, 100.0e-9, 1.0, "s") self.subdevice.device.ask(f":TRIGger:SPI:TIMeout {time}")
def set_width(self, width: int = 8) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:SPI:WIDTh <width> :TRIGger:SPI:WIDTh? **Description** Set the bits of SDA in SPI trigger. Query the current bits of SDA in SPI trigger. **Parameter** ======== ======== ======== ======= Name Type Range Default ======== ======== ======== ======= <width> Integer 4 to 32 8 ======== ======== ======== ======= **Return Format** The query returns an integer. **Example** :TRIGger:SPI:WIDTh 10 The query returns 10. """ check_input(width, "width", int, 4, 32) self.subdevice.device.ask(f":TRIGger:SPI:WIDTh {width}")
def set_source(self, channel: int = 1) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:WINDows:SOURce <source> :TRIGger:WINDows:SOURce? **Description** Select the trigger source of windows trigger. Query the current trigger source of windows trigger. **Parameter** ========= ========= ==================== ======== Name Type Range Default ========= ========= ==================== ======== <source> Discrete {CHANnel1|CHANnel2} CHANnel1 ========= ========= ==================== ======== **Return Format** The query returns CHAN1 or CHAN2. **Example** :TRIGger:WINDows:SOURce CHANnel2 The query returns CHAN2. """ check_input(channel, "channel", 1, 2) self.subdevice.device.ask(f":TRIGger:WINDows:SOURce CHANnel{channel}")
def set_time(self, time: float = 1.0e-6) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:TIMeout:TIMe <NR3> :TRIGger:TIMeout:TIMe? **Description** Set the timeout time of timeout trigger. Query the current timeout time of timeout trigger. **Parameter** ====== ===== =========== ======= Name Type Range Default ====== ===== =========== ======= <NR3> Real 16ns to 4s 1μs ====== ===== =========== ======= **Return Format** The query returns the timeout time in scientific notation. **Example** :TRIGger:TIMeout:TIMe 0.002 The query returns 2.000000e+06. """ check_input(time, "time", float, 16.0e-9, 4.0, "s") self.subdevice.device.ask(f":TRIGger:TIMeout:TIMe {time}")
def set_upper_limit(self, time: float = 2.0e-9) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:DELay:TUPPer <NR3> :TRIGger:DELay:TUPPer? **Description** Set the upper limit of the delay time in delay trigger. Query the current upper limit of the delay time in delay trigger. **Parameter** ====== ===== ========== ======= Name Type Range Default ====== ===== ========== ======= <NR3> Real 2ns to 4s 2μs ====== ===== ========== ======= Note: when the delay type is GLESs or GOUT, the range is from 12ns to 4s. **Explanation** This command is available when the delay type (refer to the :TRIGger:DELay:TYPe command) is LESS, GOUT or GLESs. **Return Format** The query returns the upper limit of the delay time in scientific notation. **Example** :TRIGger:DELay:TUPPer 0.002 The query returns 2.000000e-03. """ delay_type: DelayTypeEnum = self.type.status() if delay_type not in ( DelayTypeEnum.LESS, DelayTypeEnum.GOUT, DelayTypeEnum.GLES, ): raise TypeError( "To set the upper limit your delay type has to be: " f"{DelayTypeEnum.LESS.value}, " f"{DelayTypeEnum.GOUT.value}, " "or " f"{DelayTypeEnum.GLES.value} ") if delay_type in (DelayTypeEnum.GLES, DelayTypeEnum.GOUT): check_input(time, "time", float, 12.0e-9, 4.0, "s") else: check_input(time, "time", float, 2.0e-9, 4.0, "s") self.subdevice.device.ask(f":TRIGger:DELay:TUPPer {time}")
def set_level(self, level: int = 0) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:NEDGe:LEVel <level> :TRIGger:NEDGe:LEVel? **Description** Set the trigger level in Nth edge trigger and the unit is the same with the current amplitude unit. Query the current trigger level in Nth edge trigger. **Parameter** ======== ===== =========================== ======= Name Type Range Default ======== ===== =========================== ======= <level> Real ± 5 × VerticalScale from 0 the screen center - OFFSet ======== ===== =========================== ======= Note: For VerticalScale, refer to the :CHANnel<n>:SCALe command. For the OFFSet, refer to the :CHANNel<n>:OFFSet command. **Return Format** The query returns the trigger level in scientific notation. **Example** :TRIGger:NEDGe:LEVel 0.16 The query returns 1.600000e-01. """ scale: float = -1.0 offset: float = -1.0 source = self.source.status() if source == "channel 1": scale = self.subdevice.device.channel1.get_scale() offset = self.subdevice.device.channel1.get_offset() elif source == "channel 2": scale = self.subdevice.device.channel2.scale() offset = self.subdevice.device.channel2.get_offset() else: DS2000StateError("The level coul'd only be set, if the source is" "Channel 1 or Channel 2.") # ToDo: Right?? min_rng = -5 * scale - offset max_rng = 5 * scale - offset check_input(level, "level", int, min_rng, max_rng, "") self.subdevice.device.ask(f":TRIGger:NEDGe:LEVel {level}")
def set_line(self, line: int = 1) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:VIDeo:LINE <line> :TRIGger:VIDeo:LINE? **Description** Set the line number in video trigger when the sync type is Line Number (refer to the :TRIGger:VIDeo:MODE command). Query the current line number of the specified line. **Parameter** ======= ======== ===================== ======= Name Type Range Default ======= ======== ===================== ======= <line> Integer NTSC:1 to 525 1 PAL:1 to 625 480P:1 to 525 576P:1 to 625 720P60HZ:1 to 750 720P50HZ:1 to 750 720P30HZ:1 to 750 720P25HZ:1 to 750 720P24HZ:1 to 750 1080P60HZ:1 to 1125 1080P50HZ:1 to 1125 1080P30HZ:1 to 1125 1080P25HZ:1 to 1125 1080P24HZ:1 to 1125 1080I30HZ:1 to 1125 1080I25HZ:1 to 1125 1080I24HZ:1 to 1125 ======= ======== ===================== ======= **Return Format** The query returns an integer. **Example** :TRIGger:VIDeo:LINE 100 The query returns 100. """ check_input( line, "line", int, 1, self.__class__.MAX_LINES_OF_VIDEO_STANDATD[self.standard.status()], ) self.subdevice.device.ask(f":TRIGger:VIDeo:LINE {line}")
def set_address(self, address: int = 0x01) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:IIC:ADDRess <adr> :TRIGger:IIC:ADDRess? **Description** Set the address value in IIC trigger when the trigger condition is Address or A&D. Query the current address value in IIC trigger when the trigger condition is Address or A&D. **Parameter** ====== ======== ============================== ======= Name Type Range Default ====== ======== ============================== ======= <adr> Integer 0 to $ 2^{n} – 1 $: 0 to 127, 1 0 to 255 or 0 to 1023 ====== ======== ============================== ======= Note: in the expression 2n - 1, n is the current address bits (refer to the :TRIGger:IIC:AWIDth command). **Explanation** To set the IIC trigger condition, refer to the :TRIGger:IIC:WHEN command. **Return Format** The query returns an integer. **Example** :TRIGger:IIC:ADDRess 100 The query returns 100. """ check_input( address, "address", int, 0, 2**self.get_address_bits_width() - 1, "", ) self.subdevice.device.ask(f":TRIGger:IIC:ADDRess {address}")
def set_data(self, data_bits: int = 70) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:RS232:DATA <data> :TRIGger:RS232:DATA? **Description** Set the data value in RS232 trigger when the trigger condition is Data. Query the current data value in RS232 trigger when the trigger condition is Data. **Parameter** ======= ======== ================= ======= Name Type Range Default ======= ======== ================= ======= <data> Integer 0 to $ 2^{n}-1 $ 70 ======= ======== ================= ======= Note: in the expression $ 2^{n} - 1 $, n is the current data bits (refer to the :TRIGger:RS232:WIDTh command). **Explanation** To set the trigger condition, refer to the :TRIGger:RS232:WHEN command. **Return Format** The query returns an integer. **Example** :TRIGger:RS232:DATA 10 The query returns 10. """ check_input( data_bits, "data_bits", int, 0, 2 * self.get_data_bit_width() - 1, "data bits", ) self.subdevice.device.ask(f":TRIGger:RS232:WIDTh {data_bits}")
def set_lower_limit(self, time: float = 1.0e-6) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:DURATion:TLOWer <NR3> :TRIGger:DURATion:TLOWer? **Description** Set the lower limit of the duration in duration trigger and the unit is s. Query the current lower limit of the duration in duration trigger. **Parameter** ====== ===== ========== ======= Name Type Range Default ====== ===== ========== ======= <NR3> Real 2ns to 4s 1μs ====== ===== ========== ======= Note: when the trigger condition is GLESs, the range is from 2ns to 3.99s. **Explanation** This command is available when the trigger condition (refer to the :TRIGger:DURATion:WHEN command) is set to GREater or GLESs. **Return Format** The query returns the lower limit of the duration in scientific notation. **Example** :TRIGger:DURATion:TLOWer 0.000003 The query returns 3.000000e-06. """ check_input(time, "time", float, 2.0e-9, 4.0, "s") self.subdevice.device.ask(f":TRIGger:DURATion:TLOWer {time}")
def set_lower_pulse_width(self, time: float = 1.0e-6) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:PULSe:LWIDth <width> :TRIGger:PULSe:LWIDth? **Description** Set the lower limit of the pulse width in pulse trigger and the unit is s. Query the current lower limit of the pulse width in pulse trigger **Parameter** ======== ===== ========== ======= Name Type Range Default ======== ===== ========== ======= <width> Real 2ns to 4s 1μs ======== ===== ========== ======= Note: when the trigger condition is PGLess or NGLess, the range is from 2ns to 3.99s. **Explanation** This command is available when the trigger condition (refer to the :TRIGger:PULSe:WHEN command) is PGReater, NGReater, PGLess or NGLess. **Return Format** The query returns the lower limit of the pulse width in scientific notation. **Example** :TRIGger:PULSe:LWIDth 0.000003 The query returns 3.000000e-06. """ check_input(time, "time", float, 2.0e-9, 4.0, "s") self.subdevice.device.ask(f":TRIGger:PULSe:LWIDth {time}")
def set_upper_limit(self, time: float = 2.0e-6) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:RUNT:WUPPer <NR3> :TRIGger:RUNT:WUPPer? **Description** Set the upper limit of the pulse width in runt trigger. Query the current upper limit of the pulse width in runt trigger. **Parameter** ====== ========= ========== ======= Name Type Range Default ====== ========= ========== ======= <NR3> Discrete 2ns to 4s 2μs ====== ========= ========== ======= Note: when the qualifier is GLESs, the range of the upper limit of the pulse width is from 10ns to 4s. **Explanation** This command is available when the qualifier (refer to the :TRIGger:RUNT:WHEN command) is set to LESS or GLESs. **Return Format** The query returns the upper limit of the pulse width in scientific notation. **Example** :TRIGger:RUNT:WUPPer 0.02 The query returns 2.000000e-02. """ check_input(time, "time", float, 2.0e-9, 4.0, "s") self.subdevice.device.ask(f":TRIGger:RUNT:WUPPer {time}")
def set_data(self, data_value: int = 0x00) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:IIC:DATA <dat> :TRIGger:IIC:DATA? **Description** Set the data value in IIC trigger when the trigger condition is Data or A&D. Query the current data value in IIC trigger when the trigger condition is Data or A&D. **Parameter** ====== ======== ============= ======= Name Type Range Default ====== ======== ============= ======= <dat> Integer 0 to 240 - 1 0 ====== ======== ============= ======= **Explanation** To set the IIC trigger condition, refer to the :TRIGger:IIC:WHEN command. **Return Format** The query returns an integer. **Example** :TRIGger:IIC:DATA 64 The query returns 64. """ # TODO ... -1 check prog manual check_input(data_value, "data_value", int, 0, 239, "") self.subdevice.device.ask(f":TRIGger:IIC:DATA {data_value}")
def set_lower_limit(self, time: float = 1.0e-6) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:SLOPe:TLOWer <time> :TRIGger:SLOPe:TLOWer? **Description** Set the lower limit of time in slope trigger and the unit is s. Query the current lower limit of time in slope trigger. **Parameter** ======= ===== =========== ======= Name Type Range Default ======= ===== =========== ======= <time> Real 10ns to 1s 1μs ======= ===== =========== ======= Note: when the trigger condition is PGLess or NGLess, the range is from 10ns to 999ms. **Explanation** This command is only available when the trigger condition (refer to the :TRIGger:SLOPe:WHEN command) is PGReater, NGReater, PGLess or NGLess. **Return Format** The query returns the lower limit of time in scientific notation. **Example** :TRIGger:SLOPe:TLOWer 0.000003 The query returns 3.000000e-06. """ check_input(time, "time", float, 10.0e-9, 1.0, "s") self.subdevice.device.ask(f":TRIGger:SLOPe:TLOWer {time}")
def set_data_bit_width(self, data_bit_width: int = 70) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:RS232:WIDTh <width> :TRIGger:RS232:WIDTh? **Description** Set the data bits in RS232 trigger when the trigger condition is Data. Query the current data bits in RS232 trigger when the trigger condition is Data. **Parameter** ======== ========= ========== ======= Name Type Range Default ======== ========= ========== ======= <width> Discrete {5|6|7|8} 8 ======== ========= ========== ======= **Explanation** To set the trigger condition, refer to the :TRIGger:RS232:WHEN command. **Return Format** The query returns 5, 6, 7 or 8. **Example** :TRIGger:RS232:WIDTh 6 The query returns 6. """ check_input(data_bit_width, "data_bit_width", int, 5, 8, "data bit width") self.subdevice.device.ask(f":TRIGger:RS232:WIDTh {data_bit_width}")
def set_time(self, time: float = 1.0e-6) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:WINDows:TIMe <NR3> :TRIGger:RUNT:TIMe? **Description** Select the windows time of windows trigger. Query the current windows time of windows trigger. **Parameter** ====== ===== =========== ======= Name Type Range Default ====== ===== =========== ======= <NR3> Real 16ns to 4s 1μs ====== ===== =========== ======= **Explanation** This command is only available when the trigger position of windows trigger (refer to the :TRIGger:Windows:POSition command) is set to TIMe. **Return Format** The query returns the windows time in scientific notation. **Example** :TRIGger:WINDows:TIMe 0.002 The query returns 2.000000e-03. """ check_input(time, "time", float, 16.0e-9, 4.0, "s") self.subdevice.device.ask(f":TRIGger:WINDows:TIMe {time}")
def set_stop_bits(self, stop_bits: int = 1) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:RS232:STOP <bit> :TRIGger:RS232:STOP? **Description** Set the stop bit in RS232 trigger when the trigger condition is Error. Query the current stop bit in RS232 trigger when the trigger condition is Error. **Parameter** ====== ========= ====== ======= Name Type Range Default ====== ========= ====== ======= <bit> Discrete {1|2} 1 ====== ========= ====== ======= **Explanation** To set the trigger condition, refer to the :TRIGger:RS232:WHEN command. **Return Format** The query returns 1 or 2. **Example** :TRIGger:RS232:STOP 2 The query returns 2. """ check_input(stop_bits, "stop_bits", int, 1, 2, "stop bits") self.subdevice.device.ask(f":TRIGger:RS232:STOP {stop_bits}")
def set_data(self, data: int = 0) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:SPI:DATA <data> :TRIGger:SPI:DATA? **Description** Set the data value in SPI trigger. Query the current data value in SPI trigger. **Parameter** ======= ======== =================== ======= Name Type Range Default ======= ======== =================== ======= <data> Integer 0 to $ 2^{n} – 1 $ 0 ======= ======== =================== ======= Note: in the expression 2n-1, n is the current data bits (refer to the :TRIGger:SPI:WIDTh command). **Return Format** The query returns an integer. **Example** :TRIGger:SPI:DATA 5 The query returns 5. """ check_input(data, "data", int, 0, 2 ** self.get_width() - 1) self.subdevice.device.ask(f":TRIGger:SPI:DATA {data}")
def set_hold_time(self, time: float = 50.0e-9) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:SHOLd:HTIMe <NR3> :TRIGger:SHOLd:HTIMe? **Description** Set the hold time of setup/hold trigger. Query the current hold time of setup/hold trigger. **Parameter** ====== ===== ========== ======= Name Type Range Default ====== ===== ========== ======= <NR3> Real 2ns to 1s 50ns ====== ===== ========== ======= **Explanation** This command is available when the hold type (refer to the :TRIGger:SHOLd:TYPe command) is set to HOLd or SETHOLd. Reuturn Format The query returns the hold time in scientific notation. **Example** :TRIGger:SHOLd:HTIMe 0.002 The query returns 2.000000e-03. """ check_input(time, "time", float, 2.0e-9, 1.0, "s") self.subdevice.device.ask(f":TRIGger:SHOLd:HTIMe {time}")
def set_baud(self, baud: int = 9600) -> None: # BAUD and BUSer """ **Rigol Programming Guide** **Syntax** :TRIGger:RS232:BAUD <baud_rate> :TRIGger:RS232:BAUD? **Description** Set the baud rate in RS232 trigger and the unit is bps. Query the current baud rate in RS232 trigger. **Parameter** ============ ========= ============================= ======= Name Type Range Default ============ ========= ============================= ======= <baud_rate> Discrete {2400|4800|9600|19200|38400| 9600 57600|115200|USER} ============ ========= ============================= ======= Note: for USER, refer to the :TRIGger:RS232:BUSer command. **Return Format** The query returns the baud rate currently set. **Example** :TRIGger:RS232:BAUD 4800 The query returns 4800. **AND** :TRIGger:RS232:BUSer <user baud> :TRIGger:RS232:BUSer? **Description** Set the user-defined baud rate in RS232 trigger and the unit is bps. Query the current user-defined baud rate in RS232 trigger. **Parameter** ============ ======== ============ ======= Name Type Range Default ============ ======== ============ ======= <user baud> Integer 1 to 900000 9600 ============ ======== ============ ======= **Return Format** The query returns the current baud rate. **Example** :TRIGger:RS232:BUSer 50000 The query returns 50000. """ if baud in (2400, 4800, 9600, 19200, 38400, 9600, 57600, 115200): self.subdevice.device.ask(f":TRIGger:RS232:BAUD {baud}") return check_input(baud, "baud", int, 1, 900000, "Baud") self.subdevice.device.ask(f":TRIGger:RS232:BUSer {baud}")