|
3 | 3 | import spidev as SPI |
4 | 4 | import matplotlib.pyplot as plt |
5 | 5 | import numpy as np |
6 | | -from scipy import stats |
7 | | -import sys |
8 | 6 | from tqdm import tqdm |
9 | 7 |
|
10 | | -sys.path.insert(1, '/home/pi/Embedded-System-Lab/code/SMU') |
11 | | -from smu_class import SMU |
12 | | - |
13 | | -# voltage source with current measurement |
14 | | -smu = SMU() |
15 | | -cvm = smu.ch[0] |
16 | | -cvm.enable_autorange() |
17 | | - |
18 | | - |
19 | | - |
20 | 8 | # SPI bus setup |
21 | 9 | spi = SPI.SpiDev() |
22 | 10 | spi.open(0,0) # (bus, device) |
|
32 | 20 | GPIO.setup(SAMPLE, GPIO.OUT) |
33 | 21 | GPIO.output(SAMPLE, GPIO.LOW) # open switch |
34 | 22 |
|
35 | | - |
36 | | - |
37 | 23 | cvm.set_voltage(1500) # mV units |
38 | 24 |
|
39 | 25 | def write_dac(value): |
40 | 26 | spi.xfer([value]) # write DAC register |
41 | 27 |
|
42 | 28 |
|
43 | 29 |
|
44 | | - |
45 | | -# # prepare plots for Exercise 4 |
46 | | -# adc_hist = [10,8,10,12] |
47 | | -# bin_edges = [1,2,3,4,5] |
48 | | -# lower_bound = 2 |
49 | | -# upper_bound = 4 |
50 | | -# figure, plot = plt.subplots(1, 1) |
51 | | -# plot.stairs(adc_hist, bin_edges, fill=True) |
52 | | -# plot.set_xticks(range(0, 260, 32)) |
53 | | -# plot.set_ylabel("Counts") |
54 | | -# plot.axvline(x=lower_bound, color='red', linestyle='--') |
55 | | -# plot.axvline(x=upper_bound, color='red', linestyle='--') |
56 | | - |
57 | | -# plt.show() |
58 | | - |
59 | 30 | GPIO.cleanup() |
60 | 31 |
|
61 | 32 |
|
0 commit comments