ad9102 prestored saw done

This commit is contained in:
Ayzen
2026-02-03 18:57:30 +03:00
parent 809f19bea4
commit fd1095c50a
9 changed files with 230 additions and 23 deletions

View File

@ -110,6 +110,33 @@ def send_task_command(prt, sending_param):
else:
print("")
def start_ramp_max(prt, freq_hz=None, duty=None, saw_step=None, pat_period=None, pat_period_base=None, dac_clk_hz=None, triangle=True):
# Start AD9102 sawtooth with configurable frequency/duty (via SAW_STEP and PAT_PERIOD)
if pat_period_base is None:
pat_period_base = cmd.AD9102_PAT_PERIOD_BASE_DEFAULT
if saw_step is None and freq_hz is not None:
if dac_clk_hz is None:
dac_clk_hz = cmd.AD9102_DAC_CLK_HZ
saw_step = cmd.calc_saw_step_for_freq(freq_hz, dac_clk_hz, triangle)
if saw_step is None:
saw_step = cmd.AD9102_SAW_STEP_DEFAULT
if pat_period is None and duty is not None:
pat_period = cmd.calc_pat_period_for_duty(saw_step, duty, pat_period_base, triangle)
if pat_period is None:
pat_period = cmd.AD9102_PAT_PERIOD_DEFAULT
hexstring = cmd.create_AD9833_ramp_command(saw_step, pat_period, pat_period_base, enable=True, triangle=triangle)
cmd.send_AD9833(prt, hexstring)
time.sleep(WAIT_AFTER_SEND)
status = cmd.get_STATE(prt).hex()
if status is not None:
print("Received: STATE. State status:", cmd.decode_STATE(status), "("+cmd.flipfour(status)+")")
print("")
else:
print("")
def request_data(prt):
# Request data
cmd.send_TRANS_ENABLE(prt)