Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC ADC 100M 14b 4cha - Testing
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
FMC ADC 100M 14b 4cha - Testing
Commits
353cfc0d
Commit
353cfc0d
authored
Apr 24, 2014
by
Matthieu Cattin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test39: Fix hex2signed function, prints more info.
parent
f2439563
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
test39.py
test/fmcadc100m14b4cha/python/test39.py
+9
-5
No files found.
test/fmcadc100m14b4cha/python/test39.py
View file @
353cfc0d
...
...
@@ -76,9 +76,9 @@ def fmc_adc_init(spec, fmc):
# Converts two's complement hex to signed
def
hex2signed
(
value
):
if
(
value
&
0x8000
):
return
-
((
~
value
&
0xFFF
C
)
+
1
)
return
-
((
~
value
&
0xFFF
F
)
+
1
)
else
:
return
(
value
&
0xFFF
C
)
return
(
value
&
0xFFF
F
)
# Converts digital value to volts
def
digital2volt
(
value
,
full_scale
,
nb_bit
):
...
...
@@ -370,12 +370,13 @@ def main (default_directory='.'):
# Apply a DC offset
##################################################
dc_offset
=
0xA000
print
(
"
\n
Set dc offset to: 0x
%08
X"
%
(
dc_offset
))
fmc
.
set_dc_offset_corrected
(
1
,
IN_RANGE
,
dc_offset
,
print_value
=
True
)
##################################################
# Acquire channel 1
##################################################
print
"
\n
Acquiring channel 1"
print
"Acquiring channel 1"
# Configure analogue input
fmc
.
set_input_range
(
1
,
IN_RANGE
)
fmc
.
set_input_term
(
1
,
IN_TERM
)
...
...
@@ -406,6 +407,8 @@ def main (default_directory='.'):
##################################################
g
=
adc_corr_data
[
IN_RANGE
][
'gain'
][
0
]
o
=
adc_corr_data
[
IN_RANGE
][
'offset'
][
0
]
#g = 0x8000
#o = 0
print
"
\n
Apply ADC offset correction: gain=0x
%04
X, offset=0x
%04
X"
%
(
g
,
o
)
fmc
.
set_adc_gain_offset_corr
(
1
,
g
,
o
)
...
...
@@ -414,7 +417,7 @@ def main (default_directory='.'):
##################################################
# Acquire channel 1
##################################################
print
"
\n
Acquiring channel 1"
print
"Acquiring channel 1"
# Perform an acquisition
acq_data
,
trig_timetag
=
acq_channels
(
fmc
,
carrier
,
ADC_FS
[
IN_RANGE
],
ACQ_PAUSE
)
channel_data
=
acq_data
[
0
::
4
]
...
...
@@ -434,6 +437,7 @@ def main (default_directory='.'):
# Set saturation
##################################################
sat_thres
=
10000
print
(
"
\n
Set saturation to: 0x
%08
X"
%
(
sat_thres
))
fmc
.
fmc_adc_csr
.
set_field
(
'CH1_SAT'
,
'VAL'
,
sat_thres
)
fmc
.
fmc_adc_csr
.
set_field
(
'CH2_SAT'
,
'VAL'
,
sat_thres
)
fmc
.
fmc_adc_csr
.
set_field
(
'CH3_SAT'
,
'VAL'
,
sat_thres
)
...
...
@@ -442,7 +446,7 @@ def main (default_directory='.'):
##################################################
# Acquire channel 1
##################################################
print
"
\n
Acquiring channel 1"
print
"Acquiring channel 1"
# Perform an acquisition
acq_data
,
trig_timetag
=
acq_channels
(
fmc
,
carrier
,
ADC_FS
[
IN_RANGE
],
ACQ_PAUSE
)
channel_data
=
acq_data
[
0
::
4
]
...
...
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