Skip to content

Instantly share code, notes, and snippets.

@DavidLutton
Created May 26, 2019 12:07
Show Gist options
  • Save DavidLutton/7a2f8dd7d22b28f7961bc800ec443245 to your computer and use it in GitHub Desktop.
Save DavidLutton/7a2f8dd7d22b28f7961bc800ec443245 to your computer and use it in GitHub Desktop.
Set the source of a BG7TBL USB Signal Generator
# https://sigrok.org/wiki/BG7TBL
import serial
ser = serial.Serial('/dev/ttyUSB0', 57600, timeout=1) # Linux first tty
# ser.write(b'\x8fv')
# print("Version is " + ser.read())
cmd = f'{int(1e9+26000/10):09d}' # ~ 1GHz
cmd = f'{int(0.140e9/10):09d}'
print(cmd.encode())
ser.write(b"\x8f" + b"f" + cmd.encode())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment