diff options
Diffstat (limited to 'lab_control/jds6600.py')
-rw-r--r-- | lab_control/jds6600.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lab_control/jds6600.py b/lab_control/jds6600.py index 6137105..c263c10 100644 --- a/lab_control/jds6600.py +++ b/lab_control/jds6600.py @@ -3,6 +3,7 @@ import re from lab_control.function_generator import FunctionGenerator +# TODO figure out error handling class JDS6600(FunctionGenerator): def __init__(self, portName): self._port = serial.Serial(portName) @@ -29,14 +30,22 @@ class JDS6600(FunctionGenerator): state = self._queryOnOff() state[channel - 1] = "1" response = self._sendRequest("w20", f"{state[0]},{state[1]}") - # TODO figure out error handling def setOff(self, channel: int) -> None: state = self._queryOnOff() state[channel - 1] = "0" response = self._sendRequest("w20", f"{state[0]},{state[1]}") - # TODO figure out error handling def setFrequency(self, channel: int, frequency: float) -> None: - opcode = f"w{channel + 23}" + opcode = f"w{23 + channel - 1}" + # TODO implement after testing on actual device + def setAmplitude(self, channel: int, amplitude: float) -> None: + if amplitude is None or amplitude < 0.0 or amplitude > 20.0: + return + + opcode = f"w{25 + channel - 1}" + arg = int(amplitude * 1000.0) + response = self._sendRequest(opcode, str(arg)) + + |