New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added clocks and powersupply #4
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e088258
Test4 (#2)
JackOA 3fa2ea1
New Clocks added and powersupply
freddiscr 8aa490b
changed variables
JackOA 09bf10d
please review
JackOA 484d218
versions update
JackOA 0cc1ae4
Set sh clock and added Oscilloscope
freddiscr ed0a7d6
Updated sh-clock and oscilloscope with trigger
freddiscr 8448be3
Non-blocking oscilloscope and redefined clocks
freddiscr 91ef6cc
Updated icg_clock and fetch data
freddiscr e4f8b9d
Updated oscillocope
freddiscr d4345a2
Implemented the latest few changed
JackOA 9283bab
Merge branch 'OpnTec:master' into master
freddiscr 27c7e9f
Merge branch 'master' of https://github.com/freddiscr/open-spectromet…
JackOA 5b4e726
Updated variablenames and minor things
freddiscr File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
""" | ||
The Sensor shall be connected to the PSLab as Following: | ||
Pin 1 of the sensorboard: master_clock --> SQ1 on PSLab | ||
Pin 2: sh_clock --> SQ2 | ||
Pin 3: icg_clock --> SQ3 | ||
Pin 4: +5V --> PV1 | ||
Pin 5: GND --> GND | ||
Pin 6: OS --> CH1 | ||
""" | ||
|
||
import numpy as np | ||
import time | ||
import math | ||
from pslab.instrument.waveform_generator import PWMGenerator | ||
from pslab.instrument.oscilloscope import Oscilloscope | ||
from pslab.serial_handler import SerialHandler | ||
from pslab.instrument.logic_analyzer import LogicAnalyzer | ||
from pslab.instrument.power_supply import PowerSupply | ||
|
||
FREQUENCY_MASTER_CLOCK = 2e6 | ||
INTEGRATION_ELEMENTS = 3694 | ||
INTEGRATION_TIME = 10e-6 | ||
OSCILLATOR_FREQUENCY = 128e6 | ||
MICROSECONDS = 1e6 | ||
MIN_VOLTAGE_OUTPUT = 2.0 | ||
MAX_VOLTAGE_OUTPUT = 4.0 | ||
SAMPLES_PER_ELEMENT = 2 | ||
READ_OUT_TIME = INTEGRATION_TIME*INTEGRATION_ELEMENTS | ||
|
||
class TCD1304: | ||
def __init__( | ||
self, ): | ||
self.pwmgen = PWMGenerator() | ||
self.scope = Oscilloscope () | ||
self.ps = PowerSupply() | ||
|
||
def set_power_source(): | ||
self.ps.pv1 = 4 | ||
|
||
def start_icg_clock(self): | ||
self.pwmgen.set_state(sq3=True) | ||
time.sleep(READ_OUT_TIME) | ||
self.pwmgen.set_state(sq3=False) | ||
|
||
def start_master_clock(self): | ||
prescaler = int(math.log(OSCILLATOR_FREQUENCY / FREQUENCY_MASTER_CLOCK) / math.log(2)) | ||
self.pwmgen.map_reference_clock(["SQ1"], prescaler) | ||
|
||
def start_sh_clock(self): | ||
self.pwmgen.generate(["SQ2"], 1/INTEGRATION_TIME, [0.5] ) | ||
|
||
def read_signal(self): | ||
self.scope.select_range('CH1', MAX_VOLTAGE_OUTPUT) | ||
self.scope.configure_trigger(channel = 'CH1', voltage = MIN_VOLTAGE_OUTPUT ) | ||
self.scope.capture(channels=1, samples=INTEGRATION_ELEMENTS*SAMPLES_PER_ELEMENT, timegap=INTEGRATION_TIME/SAMPLES_PER_ELEMENT, block=False) | ||
self.icg_clock() | ||
y, = self.scope.fetch_data() | ||
return y | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs
self
argument in definition.