{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# QCoDeS Example with Keysight 33500B" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import qcodes as qc\n", "from qcodes.instrument_drivers.Keysight.KeysightAgilent_33XXX import WaveformGenerator_33XXX " ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Connected to: Agilent Technologies 33522B (serial:MY57800256, firmware:5.00-1.19-2.00-58-00) in 1.85s\n" ] } ], "source": [ "ks = WaveformGenerator_33XXX('ks', 'TCPIP0::K-33522B-00256::inst0::INSTR')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Basic usage" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [], "source": [ "# SET up a sawtooth\n", "ks.ch1.function_type('RAMP')\n", "ks.ch1.ramp_symmetry(100)\n", "ks.ch1.amplitude_unit('VPP')\n", "ks.ch1.amplitude(1)\n", "ks.ch1.offset(0)\n", "ks.ch1.frequency(2e3)\n", "ks.sync.source(1)" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [], "source": [ "# Start it\n", "ks.sync.output('ON')\n", "ks.ch1.output('ON')\n" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [], "source": [ "ks.ch1.frequency(1e3)" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [], "source": [ "# stop it\n", "ks.sync.output('OFF')\n", "ks.ch1.output('OFF')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Using burst mode" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "In burst mode, the instrument starts running a task (e.g. a waveform generation) upon receiving a trigger\n" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [], "source": [ "# TRIGGERING\n", "\n", "# Can be 'EXT' (external), 'IMM' (immediate, internal),\n", "# 'BUS' (software trigger), 'TIM' (timed)\n", "ks.ch1.trigger_source('EXT') \n", "\n", "ks.ch1.trigger_count(1)\n", "ks.ch1.trigger_delay(0) # seconds\n", "\n", "# for external triggering, a slope should be specified\n", "ks.ch1.trigger_slope('POS')\n", "\n", "# For timed triggering, the time between each trigger should be set\n", "ks.ch1.trigger_timer(50e-3)\n", "\n", "# BURSTING\n", "\n", "ks.ch1.burst_state('ON')\n", "ks.ch1.burst_mode('N Cycle') # Can be 'N Cycle' or 'Gated'\n", "\n", "# when in 'N Cycle' mode, the following options are available\n", "ks.ch1.burst_ncycles(1) # Can be 1, 2, 3,... , 'MIN', 'MAX', or 'INF'\n", "ks.ch1.burst_phase(180) # the starting phase (degrees)\n", "\n", "# If in 'Gated' mode, the following should be specified\n", "ks.ch1.burst_polarity('NORM') # Can be 'NORM' or 'INV'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Error handling" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(0, 'No error')" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# The instrument has an error queue of length up to 20 messages.\n", "# The queue message retrieval is first-in-first-out\n", "\n", "# The first (i.e. oldest) error message in the queue can be gotten (and thereby removed from the queue)\n", "ks.error()" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "-113 Undefined header\n", "-113 Undefined header\n", "-113 Undefined header\n", "0 No error\n" ] } ], "source": [ "# The entire queue can be flushed out\n", "\n", "# generate a few errors\n", "for ii in range(3):\n", " ks.write('gimme an error!')\n", "\n", "ks.flush_error_queue()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.8" }, "nbsphinx": { "execute": "never" } }, "nbformat": 4, "nbformat_minor": 2 }