Announcement

Collapse
No announcement yet.

PWM pin starting High

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • PWM pin starting High

    I wanted to know about a specific pin on the PICadillo,

    "OC2/RD1 - this can be used to generate PWM audio which then feeds into the on board Audio Amplifier. Requires the J1 Jumper to be set correctly."

    I am using this pin as PWM however when the unit starts up the pin is high and then after initialization the pin goes low.

    I need this pin to stay low same as the rest of the pwm pins.

  • #2
    When the Picadillo first powers up every single pin is set to INPUT mode. That means, with nothing connected to them, they are floating. The logic level of them all are undefined. It's not until your program actually tells a pin to do something else that something else (like driving it low) happens.

    When a pin is floating its logic level is easily influenced by everything that is going on around it. That includes any voltages on nearby pins. It may be that the OC2 pin is being influenced by the audio circuitry and making it float higher than the others.

    You can combat this by forcing a pin into a known state using hardware. The simplest way is to tie the pin to the required logic level through a pull-up or pull-down resistor. In your case connecting a 10KΩ resistor between the pin and ground should do the trick. You should also do this with your other PWM pins to ensure that they are held low while the bootloader runs and the board boots up.

    Comment


    • #3
      I found the problem, I was looking at the wrong pin.

      OC3/RD2 - this can be used to control the backlight with PWM to set various level of backlight brightness. Requires the J3 Jumper to be set correctly.

      tft.setBacklight(255); // this was making the output go high.

      Comment

      Working...
      X