Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
pts
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
misc
pts
Commits
621bdd42
Commit
621bdd42
authored
Jun 04, 2012
by
Matthieu Cattin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test18: Uses common modules, added exception handling.
parent
4c8a9e06
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
36 deletions
+52
-36
test18.py
test/fmcadc100m14b4cha/python/test18.py
+52
-36
No files found.
test/fmcadc100m14b4cha/python/test18.py
View file @
621bdd42
...
...
@@ -5,17 +5,26 @@
# Author: Matthieu Cattin <matthieu.cattin@cern.ch>
# Licence: GPL v2 or later.
# Website: http://www.ohwr.org
# Last modifications: 4/6/2012
# Import system modules
import
sys
import
rr
import
time
import
os
from
numpy
import
*
from
pylab
import
*
# Add common modules and libraries location to path
sys
.
path
.
append
(
'../../../'
)
sys
.
path
.
append
(
'../../../gnurabbit/python/'
)
sys
.
path
.
append
(
'../../../common/'
)
# Import common modules
from
ptsexcept
import
*
import
rr
import
calibr_box
# Import specific modules
from
numpy
import
*
from
pylab
import
*
from
calibr_box
import
*
import
find_usb_tty
from
PAGE.Agilent33250A
import
*
from
PAGE.SineWaveform
import
*
...
...
@@ -24,21 +33,10 @@ from PAGE.SineWaveform import *
"""
test18: Test calibration box
Note: Requires test00.py to run first to load the firmware!
"""
# Calibration box vendor and device IDs
BOX_USB_VENDOR_ID
=
0x10c4
# Cygnal Integrated Products, Inc.
BOX_USB_DEVICE_ID
=
0xea60
# CP210x Composite Device
# Agilent AWG serial access vendor and device IDs
AWG_USB_VENDOR_ID
=
0x0403
# Future Technology Devices International, Ltd
AWG_USB_DEVICE_ID
=
0x6001
# FT232 USB-Serial (UART) IC
RS232_BAUD
=
57600
NB_CHANNELS
=
4
AWG_SET_SLEEP
=
0.3
...
...
@@ -51,34 +49,51 @@ def set_awg_freq(gen, sine, freq):
def
main
(
default_directory
=
'.'
):
# Objects declaration
usb_tty
=
find_usb_tty
.
CttyUSB
()
awg_tty
=
usb_tty
.
find_usb_tty
(
AWG_USB_VENDOR_ID
,
AWG_USB_DEVICE_ID
)
box_tty
=
usb_tty
.
find_usb_tty
(
BOX_USB_VENDOR_ID
,
BOX_USB_DEVICE_ID
)
gen
=
Agilent33250A
(
device
=
awg_tty
[
0
],
bauds
=
RS232_BAUD
)
sine
=
SineWaveform
()
box
=
calibr_box
.
CCalibr_box
(
box_tty
[
0
])
# Constants declaration
TEST_NB
=
18
# Calibration box vendor and device IDs
BOX_USB_VENDOR_ID
=
0x10c4
# Cygnal Integrated Products, Inc.
BOX_USB_DEVICE_ID
=
0xea60
# CP210x Composite Device
# Agilent AWG serial access vendor and device IDs
AWG_USB_VENDOR_ID
=
0x0403
# Future Technology Devices International, Ltd
AWG_USB_DEVICE_ID
=
0x6001
# FT232 USB-Serial (UART) IC
RS232_BAUD
=
57600
try
:
# Objects declaration
usb_tty
=
find_usb_tty
.
CttyUSB
()
awg_tty
=
usb_tty
.
find_usb_tty
(
AWG_USB_VENDOR_ID
,
AWG_USB_DEVICE_ID
)
box_tty
=
usb_tty
.
find_usb_tty
(
BOX_USB_VENDOR_ID
,
BOX_USB_DEVICE_ID
)
gen
=
Agilent33250A
(
device
=
awg_tty
[
0
],
bauds
=
RS232_BAUD
)
sine
=
SineWaveform
()
box
=
CCalibr_box
(
box_tty
[
0
])
# Calibration box version 2
for
i
in
range
(
NB_CHANNELS
):
box
.
select_output_ch
(
i
+
1
,
'10V'
)
print
"Channel
%
d = AWG, others = 10V Vref"
%
(
i
+
1
)
raw_input
(
'Press ENTER to continue...'
)
for
i
in
range
(
NB_CHANNELS
):
box
.
select_output_ch
(
i
+
1
,
'1V'
)
print
"Channel
%
d = AWG, others = 1V Vref"
%
(
i
+
1
)
raw_input
(
'Press ENTER to continue...'
)
# Calibration box version 2
for
i
in
range
(
NB_CHANNELS
):
box
.
select_output_ch
(
i
+
1
,
'10V'
)
print
"Channel
%
d = AWG, others = 10V Vref"
%
(
i
+
1
)
raw_input
(
'Press ENTER to continue...'
)
for
i
in
range
(
NB_CHANNELS
):
box
.
select_output_ch
(
i
+
1
,
'100mV'
)
print
"Channel
%
d = AWG, others = 100mV Vref"
%
(
i
+
1
)
raw_input
(
'Press ENTER to continue...'
)
for
i
in
range
(
NB_CHANNELS
):
box
.
select_output_ch
(
i
+
1
,
'1V'
)
print
"Channel
%
d = AWG, others = 1V Vref"
%
(
i
+
1
)
raw_input
(
'Press ENTER to continue...'
)
for
i
in
range
(
NB_CHANNELS
):
box
.
select_output_ch
(
i
+
1
,
'100mV'
)
print
"Channel
%
d = AWG, others = 100mV Vref"
%
(
i
+
1
)
raw_input
(
'Press ENTER to continue...'
)
except
(
CalibrBoxOperationError
)
as
e
:
raise
PtsError
(
"Test failed:
%
s"
%
e
)
sys
.
exit
()
# Calibration box version 1
"""
print('
\n
=== 10V range ===')
box.select_output('10V')
print('Box gpio:
%
X')
%
box.get_config()
...
...
@@ -94,6 +109,7 @@ def main (default_directory = '.'):
print('
\n
=== AWG ===')
box.select_output('AWG')
print('Box gpio:
%
X')
%
box.get_config()
"""
if
__name__
==
'__main__'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment