Пример #1
0
def SetScope(Ch1VDivIndex=0, Ch2VDivIndex=0, TimeDivIndex=11):
    VScale2 = VScale1 = TScale = 1

    #{0: ('20 mV/Div', 0.02), 1: ('50 mV/Div', 0.05), 2: ('100 mV/Div', 0.1),
    #3: ('200 mV/Div', 0.2), 4: ('500 mV/Div', 0.5), 5: ('1 V/Div', 1.0),
    #6: ('2 V/Div', 2.0), 7: ('5 V/Div', 5.0)}
    if (Ch1VDivIndex == 0): VScale1 = 0.02 / 32
    elif (Ch1VDivIndex == 1): VScale1 = 0.05 / 32
    elif (Ch1VDivIndex == 2): VScale1 = 0.1 / 32
    elif (Ch1VDivIndex == 3): VScale1 = 0.2 / 32
    elif (Ch1VDivIndex == 4): VScale1 = 0.5 / 32
    elif (Ch1VDivIndex == 5): VScale1 = 1.0 / 32
    elif (Ch1VDivIndex == 6): VScale1 = 2.0 / 32
    else: VScale1 = 5.0 / 32

    if (Ch1VDivIndex == 0): VScale2 = 0.02 / 32
    elif (Ch1VDivIndex == 1): VScale2 = 0.05 / 32
    elif (Ch1VDivIndex == 2): VScale2 = 0.1 / 32
    elif (Ch1VDivIndex == 3): VScale2 = 0.2 / 32
    elif (Ch1VDivIndex == 4): VScale2 = 0.5 / 32
    elif (Ch1VDivIndex == 5): VScale2 = 1.0 / 32
    elif (Ch1VDivIndex == 6): VScale2 = 2.0 / 32
    else: VScale2 = 5.0 / 32
    # Need to return VScale2 and TScale also eventually
    # TimeDivIndex
    #{0: ('48 MSa/s', 48000000.0), 1: ('48 MSa/s', 48000000.0), 2: ('48 MSa/s', 48000000.0), 3: ('48 MSa/s', 48000000.0),
    #4: ('48 MSa/s', 48000000.0), 5: ('48 MSa/s', 48000000.0), 6: ('48 MSa/s', 48000000.0), 7: ('48 MSa/s', 48000000.0),
    #8: ('48 MSa/s', 48000000.0), 9: ('48 MSa/s', 48000000.0), 10: ('48 MSa/s', 48000000.0),
    #11: ('16 MSa/s', 16000000.0), 12: ('8 MSa/s', 8000000.0), 13: ('4 MSa/s', 4000000.0),
    #14: ('1 MSa/s', 1000000.0), 15: ('1 MSa/s', 1000000.0), 16: ('1 MSa/s', 1000000.0),
    #17: ('1 MSa/s', 1000000.0), 18: ('1 MSa/s', 1000000.0), 19: ('1 MSa/s', 1000000.0), 20: ('1 MSa/s', 1000000.0),
    #21: ('1 MSa/s', 1000000.0), 22: ('1 MSa/s', 1000000.0), 23: ('1 MSa/s', 1000000.0), 24: ('1 MSa/s', 1000000.0),
    #25: ('500 KSa/s', 500000.0), 26: ('200 KSa/s', 200000.0), 27: ('100 KSa/s', 100000.0)}
    if (Ch1VDivIndex == 0): TScale = 2e4
    elif (Ch1VDivIndex == 1): TScale = 2e4 * 3.
    else: TScale = 2e4 * 3.

    scope0 = Oscilloscope(scopeid=0)
    scope0.set_voltage_division(1, Ch1VDivIndex)
    scope0.set_voltage_division(2, Ch2VDivIndex)
    scope0.set_sampling_rate(TimeDivIndex)
    import sys

    nullwrite = NullWriter()
    oldstdout = sys.stdout
    sys.stdout = nullwrite  # disable output
    scope0.setup_dso_cal_level()
    sys.stdout = oldstdout  # enable output
    return scope0, TScale, VScale1, VScale2
Пример #2
0
import time

import pylab

from PyHT6022.HTSDKScope import Oscilloscope

if __name__ == "__main__":
    scope0 = Oscilloscope(scopeid=0)
    if not scope0.is_attached():
        print("WARNING: Scope not found!")
        exit()
    scope0.set_voltage_division(1, 5)
    print(scope0.set_sampling_rate(26))
    scope0.setup_dso_cal_level()
    pylab.ion()
    length = 1000
    for i in range(1):
        data = scope0.read_data_from_scope(data_points=300)
        tIndex = data[3].value
        pylab.plot(data[2][:length],
                   data[0][tIndex:tIndex + length])  # , 'r-')
        pylab.draw()
        time.sleep(100)
Пример #3
0
__author__ = 'Robert Cope', 'Jochen Hoenicke'
# This code was used to help execute a side-channel attack on the Trezor Bitcoin wallet.
# See more: http://johoe.mooo.com/trezor-power-analysis/
# Original Author: Jochen Hoenicke

from struct import pack
import StringIO
import sys

from PyHT6022.HTSDKScope import Oscilloscope

scope = Oscilloscope()
scope_channel = 1
if not scope.is_attached():
    print "No scope detected! Check connection!"
    sys.exit(1)
print "Setting up scope!"
# TODO: Are all these extra calls for setup needed?
scope.set_voltage_division(100, 200)
scope.set_voltage_division(1, 6)
scope.set_sampling_rate(500)
samplerate = 1000 * 1000
scope.set_sampling_rate(24)
scope.setup_dso_cal_level()
cal_level = scope.get_calibration_data()
scope.set_dso_calibration(cal_level)

data = []
total = 0

print "Reading data from scope!"
Пример #4
0
import time

import pylab

from PyHT6022.HTSDKScope import Oscilloscope


if __name__ == "__main__":
    scope0 = Oscilloscope(scopeid=0)
    if not scope0.is_attached():
        print("WARNING: Scope not found!")
        exit()
    scope0.set_voltage_division(1, 5)
    print(scope0.set_sampling_rate(26))
    scope0.setup_dso_cal_level()
    pylab.ion()
    length = 1000
    for i in range(10):
        data = scope0.read_data_from_scope(data_points=3000)
        tIndex = data[3].value
        pylab.plot(data[2][:length], data[0][tIndex:tIndex + length])  # , 'r-')
        pylab.draw()
        time.sleep(1)
Пример #5
0
__author__ = 'Robert Cope', 'Jochen Hoenicke'
# This code was used to help execute a side-channel attack on the Trezor Bitcoin wallet.
# See more: http://johoe.mooo.com/trezor-power-analysis/
# Original Author: Jochen Hoenicke

from struct import pack
import StringIO
import sys

from PyHT6022.HTSDKScope import Oscilloscope


scope = Oscilloscope()
scope_channel = 1
if not scope.is_attached():
    print "No scope detected! Check connection!"
    sys.exit(1)
print "Setting up scope!"
# TODO: Are all these extra calls for setup needed?
scope.set_voltage_division(100, 200)
scope.set_voltage_division(1, 6)
scope.set_sampling_rate(500)
samplerate = 1000 * 1000
scope.set_sampling_rate(24)
scope.setup_dso_cal_level()
cal_level = scope.get_calibration_data()
scope.set_dso_calibration(cal_level)

data = []
total = 0
Пример #6
0
    nullwrite = NullWriter()
    oldstdout = sys.stdout
    sys.stdout = nullwrite  # disable output
    scope0.setup_dso_cal_level()
    sys.stdout = oldstdout  # enable output
    return scope0, TScale, VScale1, VScale2


# In[3]:

import os
import time
import numpy as np
import matplotlib.pyplot as plt
scope0 = Oscilloscope(scopeid=0)

scope0, TScale, VScale1, VScale2 = SetScope(2, 2, 27)
#TenXProbe=True
#if(TenXProbe):
#    VScale1=VScale1*10
#    VScale2=VScale2*10

numSampRead = 2000
numSampSave = 100 / 2
Ch1Trig = 0.01
Triggered = False

print "Waiting for Trigger"
while (Triggered == False):
    rawData = scope0.read_data_from_scope(data_points=numSampRead)