Using PIC and PWM to control LED brightness

Discussion in 'Programmer's Corner' started by seng, Sep 16, 2004.

  1. seng

    Thread Starter New Member

    Aug 19, 2004

    Anyone know how to using PIC and PWM to control LED brightness?

    How to interface to PC and writing a software program to control LED brightness?

    Is using assembly language or PicBasic?

  2. Ah Pek

    New Member

    Sep 20, 2004

    Hi Seng,

    Maybe you could try a PICAXE and some simple free software that is provided. Jump to this link ...

    Ah Pek
  3. manuka

    New Member

    Jan 20, 2005
    The Picaxe family ( there are now 8 of them !) are all based upon normal Pic micro microcontrollers, BUT have a bootstrap high level interpreter added by the clever UK marketers ( Revolution Education ). Such user friendliness amazingly comes at almost NO extra cost either ! Programming is ultra simple (2 resistors via a serial port ) & the Windows editor is FREE. Chip prices start at ~ US$3 for the current hottest Picaxe - an 8 pin " 08M ". Recommended !
    There's a VERY helpful searchable forum => <=

    Picaxes have been an electronics sensation especially in Australia/NZ ( thanks largely to a series of "Silicon Chip" magazine articles ) & users often manage more in a few hours that they'd have been able to in weeks otherwise. Code, in Basic Stamp style PBASIC, makes LED flashing etc almost trivial. Hence -

    ledflash: ' simple LED flash routine for any Picaxe
    High 1 ' turns output pin 1 on & lights attached LED
    Wait 1 ' keeps in on 1 second
    Low 1 ' turns output pin 1 off ( LED thus goes out)
    Wait 1 ' keeps it off 1 second
    Goto ledflash ' repeats procedure

    Many powerful commands are inbuilt - EEPROM storage, DS18B20 reading, SONY style infra red decoding/encoding, PWM, interrupts , servos, sounds etc a breeze.

    There are agents in Aus/NZ/Singapore etc, but global sales via Rev.Ed in UK are extremely fast ( although air freight can double cost if only a small order ) - I've had deliveries here to NZ in just 4 days . Go for them ! Stan. in NZ
  4. Brandon

    Senior Member

    Dec 14, 2004
    Just giving a nod to the PicAxe. Cheap, tiny and effective. Love em.
  5. vineethbs

    AAC Fanatic!

    Nov 14, 2004
    i hav dabbled arnd with pic16f84 for sometime , do u want some assembly code for doing pwm with 16f84 ? plz reply if u do
    what i plan is this
    u can input ur pattern (ie ur duty cycle etc on portb)
    then that appears on one pin which can be used for driving the led
    the pattern can be changed by an interrupt and then loading the new duty cycle etc ,interested ? ;)
  6. cwarren

    New Member

    Dec 14, 2004

    hi ....

    i would b intrsted in looking at ur assembly code.
    am wrking in a related project using LEds.
  7. medpixman

    New Member

    May 30, 2009

    AAC Fanatic!

    May 26, 2009
    Maxim IC, Linear Tech, and many other companies have LED drivers with PWM built in. I'm not sure how you would adjust the brightness with the PWM but I'm sure it mentions it in each of the parts specs.