| integer
= read_inputs () |
|
| Returns the voltage level at the Digital Input Sockets as a 4 bit integer. Returns a value from 0 to 15 depends on the voltage levels present. | data = p.read_inputs() |
| None = write_outputs (integer dat) | |
| Writes a value of 'dat' from 0 to 15 to the eight digital output pins of Phoenix. | #
Sets all four pins to HIGH p.write_outputs(15) |
| None = set_dac (integer val) | |
| Sets the 8 bit DAC output from 0 to +5V depends on the argument given. val : from 0 to 255 | #Set
the DAC to nearly 2.5
volts p.set_dac(128) |
| None = set_voltage (float mv) | |
| Sets DAC output from 0 to 5V depends on the argument 'mv'. The arguments ranges from 0 to +5000 millivolts | #
Sets the DAC to one volt p.set_voltage(1000.0) |
| None = set_adc_size(integer size) | |
| The
resolution of theADC is 10 bits, which is returned as two bytes. It is
possible to ignore the two LSBs and return the output in a single byte.
User can set this option. |
p.set_adc_size(2)
#
set adc resolution to 10 bits |
| None = select_adc (integer chan) | |
| Selects
the ADC
channel to be digitized There are four channels (0 to 3) |
p.
select_adc(0) #
Selects channel 0 val = p.read_adc() # digitizes it |
| [float, integer] = read_adc () | |
| Reads
analog input.
Returns a two element List containing the value read from ADC (will be
from 0 to 255 or 1023 depending on the adc_size selected earlier) and
the PC Timestamp. The
timestamp is used only for measuring the time difference between two
calls. |
res
= p. read_adc() timestamp = res[0] val = res[1] |
| [float, float] = get_voltage() | |
| Returns
voltage in
millivolts (0
to
5000mV) from the ADC along with the time stamp. First item in the list
is timestamp and second is voltage. This function calls read_adc()
internally. |
res
= p.get_voltage() print 'voltage = ', res[1] |
| [float, float] = zero_to_5000 () | |
| same
as get_voltage() |
|
| [float, float] = get_voltage_bip() | |
| Returns
the voltage
in between
-5000 mV to +5000 mV corresponding to the value read from ADC. Use this
when you giving signal through the -(x+5)/2 amplifier to get the value
fed to the input of the amplifier. |
#Value
of volatge at
the Input of Level Shifter feeding the ADC print p.get_voltage_bip()[1] |
| [float, float] = minus5000_to_5000 () | |
| Same
as get_voltage_bip() |
#Value of volatge at the In |
| float = adc_input_period (integer ch) | |
| Measures
the time period of the signal connected the specified ADC channel.
Works for with 0 to 5V range squarewave signals. |
# print
the frequency
of square wave on CH0 period = p.adc_input_period(0) print 1.0/ period |
| float = set_frequency(float) | |
| Sets
the frequency of the square wave on the PWG socket. It is not possible
to set all the frequencies upto 4 MHz. The function returns the closest
possible values set. |
print
p.set_frequency() |
| float = measure_frequency(float) | |
| Measure
the frequency of the 0 to 5V square fed to the CNTR Socket. |
print
p.measure_frequency() |
| float = pulse_d0d1(float) | |
| Sets
the frequency of the square wave on the D0 and D1 outputs. It is
possible to set this from 0.23 Hz to 15 KHz. Returns the actual
(possible) value set. |
# Connect
DC motor
pendulum to D0 and give print p.pulse_d0d1(1.3) p.pulse_d0d1(0) # stop pulsing |
| integer = load_wave_table(List) | |
| Loads
the given wavetable to the ATmega16 internal EEPROM. Maximum size is
determined by the constant TABLESIZE =100. Returns the number of bytes
loaded. |
v = [] for k in range(100) # creates a ramp signal v.append(k) p.load_wavetable(v) |
| float
= start_wave(float, boolean) |
|
| Generates
a waveform by feeding the wavetable data to the DAC Socket. First
argument is the frequency. When second argument is True, the output is
send to the plug-in DAC module. Generate upto 150 Hz, returns the
actual value set. |
#generate
20 Hz on DAC
socket print p.start_wave(20,0) |
| None = stop_wave() | |
| Stops
the waveform generation. |
p.stop_wave() |
| None
hr_select_adc(int ch) |
|
| Selects the high resolution ADC channel to be digitized.in. |
p.hr_select_adc(integer ch) |
| None
hr_set_voltage(float) |
|
| Sets
the output of the high resolution plug-in DAC. |
p.hr_set_voltage(2000.4) |
| float
hr_get_voltage(float) |
|
| Reads the selected high resolution ADC channel input |
print
p.hr_get_voltage() |