|
121 | 121 | time.sleep(36) |
122 | 122 |
|
123 | 123 | # create a custom waveform |
124 | | -awgBuffer = np.sin(np.linspace(0,2*math.pi,1024)) |
| 124 | +minValue = ctypes.c_int16(0) |
| 125 | +maxValue = ctypes.c_int16(0) |
| 126 | +minSize = ctypes.c_int16(0) |
| 127 | +maxSize = ctypes.c_int16(0) |
| 128 | +status["sigGenArbMinMax"] = ps.ps5000aSigGenArbitraryMinMaxValues(chandle, ctypes.byref(minValue), ctypes.byref(maxValue),ctypes.byref(minSize),ctypes.byref(maxSize)) |
| 129 | +assert_pico_ok(status["sigGenArbMinMax"]) |
| 130 | + |
| 131 | +awgBuffer = (np.sin(np.linspace(0,2*math.pi,1024)))*maxValue.value |
125 | 132 | awgbufferPointer = awgBuffer.ctypes.data_as(ctypes.POINTER(ctypes.c_int16)) |
126 | 133 |
|
| 134 | +# convert 10 KHZ frequency to phase |
| 135 | +freq = 10000 |
| 136 | +indexMode = 0 |
| 137 | +bufferLength = len(awgBuffer) |
| 138 | +phase = ctypes.c_int16(0) |
| 139 | +status["freqToPhase"] = ps.ps5000aSigGenFrequencyToPhase(chandle, freq, indexMode, bufferLength, ctypes.byref(phase)) |
| 140 | +assert_pico_ok(status["freqToPhase"]) |
| 141 | + |
127 | 142 | # output custom waveform with peak-to-peak of 2 V and frequency of 10 kHz |
128 | 143 | # handle = chandle |
129 | 144 | # offsetVoltage = 0 |
130 | 145 | # pkToPk = 2000000 |
131 | | -# startDeltaPhase = 0 |
132 | | -# stopDeltaPhase = 0 |
| 146 | +# startDeltaPhase = phase |
| 147 | +# stopDeltaPhase = phase |
133 | 148 | # deltaPhaseIncrement = 0 |
134 | 149 | # dwellCount = 0 |
135 | 150 | # *arbitaryWaveform = awgbufferPointer |
136 | 151 | # arbitaryWaveformSize = 1024 |
137 | | -# sweepType = ctypes.c_int32(1) = PS5000A_UP |
| 152 | +# sweepType = ctypes.c_int32(0) |
138 | 153 | # operation = 0 |
139 | 154 | # shots = 0 |
140 | 155 | # sweeps = 0 |
141 | 156 | # triggerType = ctypes.c_int16(0) = PS5000A_SIGGEN_RISING |
142 | 157 | # triggerSource = ctypes.c_int16(0) = PS5000A_SIGGEN_NONE |
143 | 158 | # extInThreshold = 0 |
144 | 159 |
|
145 | | -status["setSigGenArbitrary"] = ps.ps5000aSetSigGenArbitrary(chandle, 0, 2000000, 0, 0, 0, 0, awgbufferPointer, 1024, 0, 0, 0, 0, 0, 0, 0, 0) |
| 160 | +status["setSigGenArbitrary"] = ps.ps5000aSetSigGenArbitrary(chandle, 0, 2000000, phase.value, phase.value, 0, 0, awgbufferPointer, bufferLength, 0, 0, 0, 0, 0, 0, 0, 0) |
146 | 161 | assert_pico_ok(status["setSigGenArbitrary"]) |
147 | 162 |
|
148 | 163 | # Pauses the script to show signal |
|
0 commit comments