adjust the duty cycle of pwm using PIC16f84A

Discussion in 'Programmer's Corner' started by nuripaizail, Sep 20, 2008.

  1. nuripaizail

    Thread Starter New Member

    Jul 29, 2008
    6
    0
    Hai,
    anybody please help me with the programming.
    I have given the project to adjust the duty cycle of pwm.
    the duty cycle should be adjust to 0%,10%,20%....100%. this, will be implement to the LED so that its brightness can be adjusted from low to high.

    I was asked to work with PIC16F84A. The coding must be in High-level language.

    in addition, Dip switch will be used. when we turn on switch number 1 duty cycle of 10% will come out, turn on switch no. 2 the duty cycle is 20% and so on.


    please help me...
     
  2. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    This must be a first assignment, and you might be feeling overwhelmed.

    Break the functions down into stages. How do you attach the switches so the PIC can read them? Then write a little progran that reads the switches and indicates which switch/es are set.

    Then become familiar with PWM. The Microchip site has tutorials on it and code examples. Your biggest step is deciding what external device to use to control current through the LED.
     
  3. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    Use this C reference manual for PIC uCs. It gives you the instructions you can use in C language. Also, it tells you how to calculate the PWM frequency and the pulse width. The datasheet of your uC helps too.

    http://www.ccsinfo.com/downloads/CReferenceManual.pdf
     
Loading...