Shop Learn P1 Docs P2 Docs
Is there already some enhanced version of propeller2.h with adc, dac and pwm? — Parallax Forums

Is there already some enhanced version of propeller2.h with adc, dac and pwm?

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.

  • evanhevanh Posts: 13,852
    edited 2022-11-23 15:04

    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().

Sign In or Register to comment.