Skip to content

Commit 55da0b6

Browse files
committed
rigol yea, dj pauly d yea
1 parent a577583 commit 55da0b6

File tree

2 files changed

+33
-12
lines changed

2 files changed

+33
-12
lines changed

tests/gmbitbang/rigol.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env python
2+
import numpy as np
3+
import visa
4+
import matplotlib.pyplot as plt
5+
6+
resources = visa.ResourceManager()
7+
print resources.list_resources()
8+
9+
scope = resources.open_resource('USB0::0x1AB1::0x04CE::DS1ZA184652242::INSTR', timeout=2000, chunk_size=1024000)
10+
print(scope.query('*IDN?').strip())
11+
12+
#voltscale = scope.ask_for_values(':CHAN1:SCAL?')[0]
13+
#voltoffset = scope.ask_for_values(":CHAN1:OFFS?")[0]
14+
15+
#scope.write(":STOP")
16+
scope.write(":WAV:POIN:MODE RAW")
17+
scope.write(":WAV:DATA? CHAN1")[10:]
18+
rawdata = scope.read_raw()
19+
data = np.frombuffer(rawdata, 'B')
20+
print data.shape
21+
plt.plot(data)
22+
plt.show()
23+
#data = (data - 130.0 - voltoffset/voltscale*25) / 25 * voltscale
24+
25+
print data
26+

tests/gmbitbang/test.py

+7-12
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,11 @@
1717
p2.set_gmlan(bus=2)
1818

1919
# send w bitbang then without
20-
p1.set_gmlan(bus=None)
21-
p1.can_send(20, "\x01", bus=3)
22-
p1.set_gmlan(bus=2)
23-
p1.can_send(20, "\x01", bus=3)
24-
#time.sleep(0.1)
25-
#p1.set_gmlan(bus=None)
26-
#p1.can_send(20, "\x01", bus=3)
27-
28-
# test echo
29-
# (to send on GMLAN, set bus=3)
30-
time.sleep(0.1)
31-
print p2.can_recv()
20+
while 1:
21+
p1.set_gmlan(bus=None)
22+
p1.can_send(20, "\x01", bus=3)
23+
p1.set_gmlan(bus=2)
24+
p1.can_send(20, "\x01", bus=3)
25+
time.sleep(0.01)
26+
print p2.can_recv()
3227

0 commit comments

Comments
 (0)