how to use the internal comparator in pic16f877a??


Closed Thread
Results 1 to 12 of 12
  1. #1
    Join Date
    Aug 2008
    Posts
    45

    Default how to use the internal comparator in pic16f877a??

    hi,how can i use the internal comparator in pic16f877a.can someone help me with the coding please.my Vin is 3.40 and my Vref is 4.00.please help me...

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by texas5 View Post
    hi,how can i use the internal comparator in pic16f877a.can someone help me with the coding please.my Vin is 3.40 and my Vref is 4.00.please help me...
    Write some code, I'm sure somebody here will help you figure out what's wrong with it...

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


    Did you find this post helpful? Yes | No

    Default

    See Melanie's excellent post here

    http://list.picbasic.com/forum/messages/3064/3607.html?

    it is for a different processor but converting to the 877a should be straight forward. Reply if you need more
    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

    OMG... I wrote that SIX YEARS ago!!!

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Wink

    Hi, Mel

    I'm Aaaaabsolutely suuuuuure it's not you but your Elder sista ...

    regards

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  6. #6
    Join Date
    Aug 2008
    Posts
    45


    Did you find this post helpful? Yes | No

    Default

    thanx.i will work it out.if something goes wrong...i'll tell u guys...

  7. #7
    Join Date
    Aug 2008
    Posts
    45


    Did you find this post helpful? Yes | No

    Default

    ' Device Programming Options
    ' --------------------------
    @ DEVICE pic16F628, INTRC_OSC_NOCLKOUT
    ' System Clock Options
    @ DEVICE pic16F628, WDT_ON
    ' Watchdog Timer
    @ DEVICE pic16F628, PWRT_ON
    ' Power-On Timer
    @ DEVICE pic16F628, MCLR_OFF
    ' Master Clear Options (Internal)
    @ DEVICE pic16F628, BOD_ON
    ' Brown-Out Detect
    @ DEVICE pic16F628, LVP_OFF
    ' Low-Voltage Programming
    @ DEVICE pic16F628, CPD_OFF
    ' Data Memory Code Protect
    @ DEVICE pic16F628, PROTECT_OFF
    ' Program Code Protection

    i can't compile if those code are exist.i use pic16f877a.

  8. #8
    Join Date
    Aug 2008
    Posts
    45


    Did you find this post helpful? Yes | No

    Default

    @ DEVICE pic16F877a, INTRC_OSC_NOCLKOUT
    ' System Clock Options
    @ DEVICE pic16F877a, WDT_ON
    ' Watchdog Timer
    @ DEVICE pic16F877a, PWRT_ON
    ' Power-On Timer
    @ DEVICE pic16F877a, MCLR_OFF
    ' Master Clear Options (Internal)
    @ DEVICE pic16F877a, BOD_ON
    ' Brown-Out Detect
    @ DEVICE pic16F877a, LVP_OFF
    ' Low-Voltage Programming
    @ DEVICE pic16F877a, CPD_OFF
    ' Data Memory Code Protect
    @ DEVICE pic16F877a, PROTECT_OFF
    ' Program Code Protection

    BatVal var CMCON.7

    BatLoLED var PORTB.7

    CMCON=%00100101


    VRCON=%11101100

    Pauseus 10

    TRISA=%11111111
    TRISB=%00000000

    BatLoLoop:
    BatLoLED=BatVal

    Goto BatLoLoop

    End

    my vref=4v, vin=3.6 and my vout=9v.can someone help me which part of the coding need to be edit.please...

  9. #9
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    my vref=4v, vin=3.6 and my vout=9v.can someone help me which part of the coding need to be edit.please...
    Vref = 4v - what is Vref connected to?
    Vin = 3.6v - what is Vin connected to?
    Vout = 9v - what is Vout connected to?

    Read the datasheet for the 16F877A!
    Can MCLR be turned off?
    How many oscillator modes does the 16F877A have? What are they?
    Last edited by skimask; - 17th September 2008 at 18:58.

  10. #10
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    OMG... I wrote that SIX YEARS ago!!!
    I Love the way you think Melanie . . .
    In a battery operated piece of equipment we need to detect when the
    batteries are getting low, so in turn we can switch on a 'Battery Low' LED
    to help flatten whats left of the battery even quicker... seems sensible to
    me....
    I wish more engineers thought as you do.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  11. #11
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    I Love the way you think Melanie . . .
    I wish more engineers thought as you do.
    Ranks right up there with....
    I'm almost out of gas so I'll drive to the nearest gas station even faster so I can run out of gas quicker so I can start walking even sooner!

  12. #12
    Join Date
    Aug 2008
    Posts
    45


    Did you find this post helpful? Yes | No

    Default

    thanx everyone.it's work.but i have another problem that i can't solve.feel free to check my new thread...

Similar Threads

  1. Internal vs. external osc for comms
    By mtripoli in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th January 2010, 14:58
  2. 12F683 internal pull up
    By hvacrtech in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 27th July 2008, 02:35
  3. communicating pic18f452 with pic16f877a
    By tamersoss in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 13th July 2007, 19:54
  4. Use internal program memory like DATA memory
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th December 2006, 18:38
  5. PIC12F675, accuracy of baud rate with Internal Oscillator
    By Chris Mayhew in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 31st August 2005, 22:41

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