Commit ad5e30b7 authored by Kuldeep Singh Dhaka's avatar Kuldeep Singh Dhaka

Tutorial on using multiple channel of AOUT simultaneously

parent f613a899
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Using Multiple channels of AOUT simultaneously\n",
"\n",
"In the example, we are going to output a square waveform on CH0 and complement of it on CH1. (2 Channels) \n",
"The frequency of the square waveform will be 783 $Hz$."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import box0\n",
"import numpy as np\n",
"import time\n",
"\n",
"# Get all the resources\n",
"dev = box0.usb.open_supported()\n",
"aout = dev.aout()\n",
"\n",
"# Prepare for static mode\n",
"aout.static_prepare()\n",
"aout.speed.current = 783 * 2 # 783KS/s per channel\n",
"aout.chan_seq.current = [0, 1]\n",
"\n",
"# we are going to use both channel at once.\n",
"# in that case, the sampling frequency become half since the resource are shared\n",
"# replace \"1\" with the voltage you want.\n",
"y = np.array([0,1, 1,0], dtype=np.float) # (square wave) when CH0 and CH1 are complement\n",
"aout.static_start(y)\n",
"\n",
"# wait for the user to ask for exit\n",
"try:\n",
" while True:\n",
" time.sleep(0.1)\n",
"except KeyboardInterrupt:\n",
" pass\n",
"\n",
"# Return all the resources\n",
"aout.static_stop()\n",
"aout.close()\n",
"dev.close()"
]
}
],
"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.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment