Analog Output from a PIC


Closed Thread
Results 1 to 5 of 5
  1. #1
    robertmark68's Avatar
    robertmark68 Guest

    Smile Analog Output from a PIC

    Hello

    I am brand squeaky new to the world of PIC's

    I ask that you forgive my ignorance and bear with a stupid question or two.

    First, a little background....

    I recently purchased the X1 bundle and have been happily trying the neat little programs it comes with to get a feel for BASIC with PIC's.

    Now for my question:

    Is it possible for a PIC to output an analog voltage level on one of its pins?

    I know that you can connect a I2C DAC to a PIC to do this BUT...I'm wondering if that would be redundant or not.

    All I really need is for the PIC to output a voltage between 0-2.5V DC for a length of time I specify (multiple of half seconds).

    This sounds fairly easy to me but I don't know if a PIC can do this or not.

    Can someone point me in the right direction with a piece of code, or tell me I am insane and to get lost!

    Hopefully not the latter!

    Thanks so much in advance

    Robert

  2. #2
    Join Date
    Oct 2003
    Location
    holland
    Posts
    251


    Did you find this post helpful? Yes | No

    Default

    You can use an output in the pwm mode and with a low pass fliter you will get a n analog value of this signal. You will get 256 steps of the analog value from 0 till 100% of the used supplyvoltage.

  3. #3
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    In addition to the PWM approach (which works great), PICs like the 16F628A have an on-board Voltage Reference Module (based on a 16- tap resistor ladder) where the output can be directed to RA2. This module provides limited D2A capabilities, but it might be useful for your application. See the data sheet for your PIC (section 11 for the 16F628A) and see if it might work for you.
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  4. #4
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Actually the PICs Hardware PWM is 10-bit. The upper 8-bits you can control directly with the HPWM command, and the bottom couple of bits you can manipulate the appropriate Register (also within PICBasic - no Assembler needed)..

  5. #5
    robertmark68's Avatar
    robertmark68 Guest


    Did you find this post helpful? Yes | No

    Thumbs up Thank You...

    I want to thanks the three of you who responded to my plaintive cry of woe....

    After careful consideration and further purusal(sp?) of my PBP Manual.....

    I happened upon the wonderful 'I2CWRITE' feature! This little gem coupled with an Analog Devices I2C 'digipot' will allow me to use the 2.5volt reference included in my Laser Diode driver to set the Laser Diode Current output to whatever my heart desires!

    Were I to use the PWM method, I'd have to worry about the DC Supply (NiMH battery) changing over time as it surely would due the large amount of current I will be drawing to power my Laser Diode.

    I will look into to the reference option though....that might be worthy of future consideration!

    Thanks Again!
    Robert

Similar Threads

  1. Replies: 24
    Last Post: - 1st December 2009, 08:01
  2. Pic getting part power from Analog Port
    By ShaneMichael in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 22nd April 2009, 10:34
  3. Capacitor on PIC output
    By Michael in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 21st March 2008, 19:10
  4. HSEROUT Newbie question/problem
    By Mark Scotford in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 11th July 2006, 14:44
  5. PIC 2 PIC communication
    By Mario in forum Forum Requests
    Replies: 16
    Last Post: - 28th April 2006, 01:56

Members who have read this thread : 1

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