diff options
| author | Nathan Conrad <[email protected]> | 2019-09-18 23:53:28 -0400 |
|---|---|---|
| committer | Nathan Conrad <[email protected]> | 2019-09-19 00:00:27 -0400 |
| commit | d4b2dff7c40f005be3ce4d383efcb59182a9a228 (patch) | |
| tree | 7d7e14161da47770c888f7c68ad93aaa311720b9 /examples/device/usbtmc/visaQuery.py | |
| parent | 9a726dc7ed9af8f9b035b18a667105a48d8d6d8a (diff) | |
Fix more TX bugs... and add variable response delay to the example project.
Diffstat (limited to 'examples/device/usbtmc/visaQuery.py')
| -rw-r--r-- | examples/device/usbtmc/visaQuery.py | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/examples/device/usbtmc/visaQuery.py b/examples/device/usbtmc/visaQuery.py index fa3d7f5e8..2034e6ff7 100644 --- a/examples/device/usbtmc/visaQuery.py +++ b/examples/device/usbtmc/visaQuery.py @@ -7,15 +7,20 @@ def test_idn(): idn = inst.query("*idn?"); assert idn == "TinyUSB,ModelNumber,SerialNumber,FirmwareVer123456\r\n" -def test_echo(): - longstr = "0123456789abcdef" * 50 +def test_echo(m,n): + longstr = "0123456789abcdefghijklmnopqrstuvwxyz" * 50 #Next try echo from 1 to 175 characters (200 is max buffer size on DUT) - for i in range(49,175): + for i in range(m,n): + #print(i) x = longstr[0:i] xt = x + inst.write_termination y = inst.query(x) - assert(xt == y), f"echo {i}" + #print(x) + #print (":".join("{:02x}".format(ord(c)) for c in xt)) + #print (":".join("{:02x}".format(ord(c)) for c in y)) + assert(xt == y), f"failed i={i}" + inst.read_stb();# Just to make USB logging easier by sending a control query def test_mav(): assert (inst.read_stb() == 0) @@ -57,12 +62,28 @@ inst = rm.open_resource(reslist[0]); inst.timeout = 3000 inst.clear() -#print(idn); -inst.clear() +#print("+ IDN") +#test_idn() + +print("+ random trigger") +#inst.assert_trigger(); + +print("+ echo delay=0") +inst.write("delay 0") +test_echo(1,175) + +print("+ echo delay=2") +inst.write("delay 2") +test_echo(1,175) + +print("+ echo delay=200") +inst.write("delay 200") +test_echo(50,90) +test_echo(165,170) -test_idn() -test_echo() +print("+ MAV") test_mav() +print("+ SRQ") test_srq() inst.close() |
