Skip to content

Commit e9252d4

Browse files
author
neil.hamilton
committed
Create usbdrdaqScopeBlockExample.py
1 parent cd93bdc commit e9252d4

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#
2+
# Copyright (C) 2020 Pico Technology Ltd. See LICENSE file for terms.
3+
#
4+
# USBDRDAQ SCOPE BLOCK MODE EXAMPLE
5+
# This example opens a UsbDrDaq driver device, sets up the scope channel and a trigger then collects a single block of data.
6+
# This data is then plotted as mV against time in ns.
7+
8+
import ctypes
9+
import time
10+
from picosdk.usbDrDaq import usbDrDaq as drDaq
11+
import numpy as np
12+
import matplotlib.pyplot as plt
13+
from picosdk.functions import adc2mV, assert_pico_ok
14+
15+
# Create chandle and status ready for use
16+
status = {}
17+
chandle = ctypes.c_int16()
18+
19+
# Opens the device
20+
status["openunit"] = drDaq.UsbDrDaqOpenUnit(ctypes.byref(chandle))
21+
assert_pico_ok(status["openunit"])
22+
23+
# Disconnect the scope
24+
# handle = chandle
25+
status["close"] = drDaq.UsbDrDaqCloseUnit(chandle)
26+
assert_pico_ok(status["close"])
27+
28+
# Display status returns
29+
print(status)

0 commit comments

Comments
 (0)