Skip to content

Commit

Permalink
code updated
Browse files Browse the repository at this point in the history
  • Loading branch information
mi0iou committed Jan 26, 2014
1 parent 6cabcf4 commit 0707fad
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
20 changes: 15 additions & 5 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,21 @@ the number of input channels available from 8 to 4.The software has been
revised accordingly.

An additional user selectable "Bias" feature has been added to the GUI
which allows the user to choose whether or not to compensatefor any bias
which allows the user to choose whether or not to compensate for any bias
on the output signal from the detector stage.

Update V2
UPDATE v2.0

Edits by Tony Abbey for >10 speed-up and continuous looping until STOP button pressed.
ADC now runs at 60 SPS and 14 bits in one-shot mode
Also added initialisation of frequency scan value

UPDATE v2.1

Code was modified to clear the display between each cycle of the frequency sweep,
thus emulating the behaviour of a conventional wobbulator more closely. This
should make the software more useful when it is used to adjust tunable filters.
Other minor changes included deleting of debugging code used to display status
of various variables on the console window during execution. Default frequency
sweep paramaters were also changed.

Edits by Tony Abbey for >10 speed-up and continuous looping until STOP button pressed.
# ADC now runs at 60 SPS and 14 bits in one-shot mode
# Also added initialisation of frequency scan values
31 changes: 18 additions & 13 deletions rpi_wobbulator.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# RPi Wobbulator v2_afa
# RPi Wobbulator v2.1

# Copyright (C) 2013 Tom Herbison MI0IOU
# Copyright (C) 2013-2014 Tom Herbison MI0IOU
# Email tom@asliceofraspberrypi.co.uk
# Web <http://www.asliceofraspberrypi.co.uk>

# Please see "README.txt" for a description of this software
# and for details of the version change log

# If you wish to make changes to this software and would like your
# changes to be incorporated into a future release please visit,
# <https://github.com/mi0iou/RPi_Wobbulator> and 'fork' the repository

# Edits by Tony Abbey for 10 speed up and continuous looping until STOP button
# ADC now runs at 60 SPS and 14 bits in one-shot mode to prevent glitches
# Also added initialisation of frequency scan values
Expand Down Expand Up @@ -177,21 +185,21 @@ def __init__(self, master):
self.fstart = StringVar()
fstartentry = Entry(frame, textvariable=self.fstart, width=10)
fstartentry.grid(row=8, column=1)
fstartentry.insert(0,"14967000")
fstartentry.insert(0,"14000000")
# stop frequency for sweep
fstoplabel = Label(frame, text='Stop Freq (Hz)')
fstoplabel.grid(row=8, column=2)
self.fstop = StringVar()
fstopentry = Entry(frame, textvariable=self.fstop, width=10)
fstopentry.grid(row=8, column=3)
fstopentry.insert(0,"14972000")
fstopentry.insert(0,"14200000")
# increment for sweep
fsteplabel = Label(frame, text='Step (Hz)')
fsteplabel.grid(row=8, column=4)
self.fstep = StringVar()
fstepentry = Entry(frame, textvariable=self.fstep, width=8)
fstepentry.grid(row=8, column=5)
fstepentry.insert(0,"100")
fstepentry.insert(0,"1000")

# display grid
def checkgrid(self):
Expand All @@ -207,7 +215,6 @@ def checkgrid(self):

# start frequency sweep
def sweep(self):
#print("in sweep")
pulseHigh(RESET)
address = int(self.gain.get())
channel = int(self.channel.get())
Expand All @@ -220,13 +227,14 @@ def sweep(self):
step = int(self.fstep.get())
colour = str(self.colour.get())
removebias = self.bias.get()
bias = getadcreading(chip)
bias = getadcreading(chip)
self.clearscreen()
for frequency in range((startfreq - step), (stopfreq + step), step):
pulseHigh(RESET)
pulseHigh(W_CLK)
pulseHigh(FQ_UD)
sendFrequency(frequency)
changechannel(chip, address) #trigger adc
changechannel(chip, address) #trigger adc
reading = getadcreading(chip)
x = int(500 * ((frequency - startfreq) / span))
y = int(495 - ((reading - (bias * removebias)) * 250))
Expand All @@ -240,16 +248,13 @@ def sweep(self):
root.after(20, self.runsweep)
# continuous sweep
def runsweep(self):
#print("in runsweep")
#oldtime=time.time()
if not root.stopflag:
self.sweep()
else:
root.stopflag = 0
#print(time.time()-oldtime,"s")

# set stop flag
def stop(self):
print("set stop flag")
root.stopflag=1

# clear the screen
Expand All @@ -267,7 +272,7 @@ def clearscreen(self):
root = Tk()

# Set main window title
root.wm_title('RPi Wobbulator v1.1_afa')
root.wm_title('RPi Wobbulator v2.1')

# Create instance of class WobbyPi
app = WobbyPi(root)
Expand Down

0 comments on commit 0707fad

Please sign in to comment.