Shop Learn P1 Docs P2 Docs Events
Setting pin voltage for bit banging — Parallax Forums

Setting pin voltage for bit banging

Is there a way to set the output voltage for what pinh/pinhigh uses?
Or do I need to turn my pin into a smartpin using one of the DAC modes?


  • JonnyMacJonnyMac Posts: 8,745
    edited 2022-04-23 20:52

    Deleted. See Evan's post below.

  • evanhevanh Posts: 14,643
    edited 2022-04-22 23:55

    It sounds like you are wanting the bitDAC pin mode. It provides a coarse bi-level 4-bit DAC, simply using OUT. Smartpin not used.

    BitDAC has bee tested and works well for improved impedance matching with HDMI link drive even up at 350 MHz. Typical pin config would be:

        wrpin( pinnum, P_DAC_124R_3V | P_BITDAC | bithigh<<12 | bitlow<<8 )

    bithigh and bitlow are 4-bit values, 0..15, that set the OUT's high and low levels respectively.

  • That's pretty neat -- thanks for that, Evan.

  • Oh wow, that sounds perfect. Thanks evanh!

  • Quick followup question: when using the non-smartpin/non-bitDAC output for bit-banged IO, that is the stiffest rail-to-rail drive available, right?

  • evanhevanh Posts: 14,643
    edited 2022-05-05 23:01

    Yes, "FAST" logic drive strength is the strongest, around 20 ohms.
    Strongest 3v3 DAC output is 124 ohms.
    75 ohm 2 Volt DAC is option too.
    The DACs are like a class-A amp though I think, so lots of them enabled will create steady heat in the prop2 and steady draw on the supply.

Sign In or Register to comment.