Is there already some enhanced version of propeller2.h with adc, dac and pwm?
Christof Eb.
Posts: 1,195
in Propeller 2
Hi,
has someone already something like an enhanced version of propeller2.h, for use with C which has more most common pin functions?
I think, this subset of possibilities would be nice?
int adc(int pin) with 12bits, gain=1
dac(int pin, int value) with 16 bits
pwm(int pin, int range, int value)
Christof
Comments
ManAtWork might have something, I would guess, based on what he's sharing here in the forum. But that's only my speculation. Others may have too. I don't.
For ADC, nominally, there is a pin setup first with
_pinstart()
, then repeated_rdpin()
to collect samples.However, if you're wanting to do instrumentation then it gets more complicated because the ADC drifts in multiple ways. Then what's needed is a repeating cycle of switching between VIO, GIO, and signal ... and doing a calculation with the three components to derive a useful measurement.
DAC is much easier for instrumentation, use the smartpin's DAC dither mode. Again, setup with
_pinstart()
and output samples with_wypin()
.