Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DEL 1ns 2cha
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
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 DEL 1ns 2cha
Commits
96dc00c3
Commit
96dc00c3
authored
Sep 01, 2016
by
Jan Pospisil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added option for negative pulses
parent
9c53d4f4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
9 deletions
+17
-9
FFPG_driver.py
sw/FFPG_driver.py
+17
-9
No files found.
sw/FFPG_driver.py
View file @
96dc00c3
...
...
@@ -34,6 +34,7 @@
## 2016-08-24 1.0 Jan Pospisil
## 2016-09-01 1.1 Jan Pospisil added version numbers (major.minor.rev)
## added clock_stable status bit
## added option for negative pulses
##-----------------------------------------------------------------------------
# TODO: proper BUSY bits checking
...
...
@@ -238,16 +239,17 @@ def ClearMemory(channel, memory, memoryPart = -1):
WbWriteMulti
(
address
,
(
0
,)
*
partToClear
,
to
=
to
)
# channel: 1, 2, 0 (for both)
# pulse: 0
, 1
# pulse: 0
- delete, 1 - create
# which: 0 - both, 1 - set, 2 - reset
def
ConfigurePulse
(
channel
,
start
,
stop
,
pulse
,
which
=
0
):
# polarity: 0 - negative pulse, 1 - positive pulse
def
ConfigurePulse
(
channel
,
start
,
stop
,
pulse
,
which
=
0
,
polarity
=
1
):
if
channel
==
1
:
address
=
'ch1_'
elif
channel
==
2
:
address
=
'ch2_'
elif
channel
==
0
:
ConfigurePulse
(
1
,
start
,
stop
,
pulse
)
ConfigurePulse
(
2
,
start
,
stop
,
pulse
)
ConfigurePulse
(
1
,
start
,
stop
,
pulse
,
which
,
polarity
)
ConfigurePulse
(
2
,
start
,
stop
,
pulse
,
which
,
polarity
)
return
else
:
raise
Exception
(
"Bad channel!"
)
...
...
@@ -261,6 +263,11 @@ def ConfigurePulse(channel, start, stop, pulse, which = 0):
pulse
&=
1
if
polarity
==
0
:
tmp
=
start
start
=
stop
stop
=
tmp
if
which
<
2
:
position
=
start
/
32
shift
=
start
%
32
...
...
@@ -271,8 +278,8 @@ def ConfigurePulse(channel, start, stop, pulse, which = 0):
shift
=
stop
%
32
WbSetBitsMulti
(
address
+
'res_mem'
,
((
1
<<
shift
),),
((
pulse
<<
shift
),),
start
=
position
,
to
=
position
+
1
)
def
CreatePulse
(
channel
,
start
,
stop
,
which
=
0
):
ConfigurePulse
(
channel
,
start
,
stop
,
1
,
which
)
def
CreatePulse
(
channel
,
start
,
stop
,
which
=
0
,
polarity
=
1
):
ConfigurePulse
(
channel
,
start
,
stop
,
1
,
which
,
polarity
)
def
DeletePulse
(
channel
,
start
,
stop
):
ConfigurePulse
(
channel
,
start
,
stop
,
0
)
...
...
@@ -484,7 +491,7 @@ def SetPulseShape(channel, delay, width):
# return bit shifts
return
(
setBit
,
resBit
)
def
TestPulse
(
channel
=
1
,
overflow
=
17820
):
def
TestPulse
(
channel
=
1
,
overflow
=
17820
,
polarity
=
1
):
# configure channel
WbWrite
(
'overflow'
,
overflow
)
WbWrite
(
'trig_latency'
,
12
)
...
...
@@ -497,7 +504,7 @@ def TestPulse(channel = 1, overflow = 17820):
(
setBit
,
resBit
)
=
SetPulseShape
(
channel
,
pulseDelay
,
pulseWidth
)
for
bunch
in
bunches
:
CreatePulse
(
channel
,
(
bunch
*
RF_2_BUNCH_RATIO
)
+
setBit
,
(
bunch
*
RF_2_BUNCH_RATIO
)
+
resBit
)
CreatePulse
(
channel
,
(
bunch
*
RF_2_BUNCH_RATIO
)
+
setBit
,
(
bunch
*
RF_2_BUNCH_RATIO
)
+
resBit
,
polarity
=
polarity
)
Enable
(
channel
)
Start
(
channel
)
...
...
@@ -505,10 +512,11 @@ def TestPulse(channel = 1, overflow = 17820):
Init
()
Control
()
Status
()
TestPulse
(
1
)
TestPulse
(
1
,
polarity
=
0
)
# TestPulse(2)
Control
()
Status
()
Version
()
Debug
()
...
...
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