1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Using PWM on a 18F13K22

Discussion in 'Microcontrollers' started by MrDEB, Nov 27, 2013.

  1. MrDEB

    MrDEB Active Member

    Apr 16, 2007
    I would be interested in seeing the code 3v0 came up with.
    As for seeing the led "blinking", yes one can see a definite flashing or in this case a flicker.
    I should do a video with the camera farther away then I shouldn't get any bright flash of light as the videos show.
    WHY I can see a definite flash or blinking ?? but it adds "flavor" to the effect.
  2. JonSea

    JonSea Well-Known Member

    Oct 1, 2012
    Seattle, WA
    Excuse me while I pound my head against the wall and knock myself senseless.

    Let me assure you you can't see any difference at the 5 kHz PWM frequency. That's 200 times faster than your eye can perceive. In phase, out of phase...makes no difference other than the ratio of on time of yellow LED and red LED.

    What you ARE SEEING is the difference in duty cycle as your code progresses. Remember that?

    Duty = x

    Inc (duty)

    Etc, etc, etc.

    This is why the LEDs vary in brightness.

    Geez oh grief. #headsmack #headsmack #headsmack

Share This Page