Variable voltage output from a Pic?


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    mytekcontrols's Avatar
    mytekcontrols Guest


    Did you find this post helpful? Yes | No

    Default

    Dan,

    Bad news on the hardware PWM. The 16F628 only has one port with this feature. There are other chips that have more, but off the top of my head I do believe the maximum is 4 PWM ports.

    PWM is definately a good way to go, in fact since I now know you'll be controlling LEDs, you don't need to convert this to analog (controlling the duty cycle should be sufficient). The 16F628 has 16 I/O ports available, but like I said only one of them supports the HPWM function. Perhaps you can do it as a software PWM, but not via PBP's PWM command. Instead do it with a bit of embedded ASM code. Check out this link: http://www.dattalo.com/technical/software/pic/pwm8.asm

    It describes a method of producing 8 PWM outputs. If you used this with a PIC chip that has a built-in USART, you should be able to do what you have in mind, and not use too many pic chips (perhaps extend it to 10 PWM outputs).

    Better still, would be if the software PWM was done as an interrupt service routine. This would allow you to write everything else in PBP, but still have stable PWM pulses. If I come across a good way to do this I'll post it here.

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Timer interrupt is also a way to go and do PWM on multipl output... much trickier but not impossible..

    Another Idea is to use Multiples DAC like MAX517/518 on few I2C BUS.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Default

    Hello,

    From the picture you provided and the description of your project it looks like each color has it's own pin plus a common for all 3 colors. Why then would you need PWM? It would seem like you only need an "ON" or "OFF" for each color which then is 1 pin per color which would then mean 5 LEDs per PIC.

    Let me know if I'm off base here but after reading the above posts that's the way I interpret what you want to do.

    BOBK

  4. #4
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by BobK
    ...It would seem like you only need an "ON" or "OFF" for each color which then is 1 pin per color which would then mean 5 LEDs per PIC.

    Let me know if I'm off base here but after reading the above posts that's the way I interpret what you want to do.

    BOBK
    Bob,

    that way you would only be able to produce 7 different colors.
    If you want the full spectrum you have to control the intensity of every base color individually.
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



Similar Threads

  1. Serial VB 2005 pic 16f877a problems
    By Snap in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 8th July 2013, 00:52
  2. Replies: 5
    Last Post: - 30th April 2008, 20:01
  3. Serious Serial Situation Setbacks...
    By Dansdog in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th February 2007, 03:46
  4. Output PIC module
    By freelancebee in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th September 2005, 20:10
  5. can a pic remember a variable?
    By peterdeco1 in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 18th January 2005, 09:50

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts