Can't get RA0 to read inputs?!?


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Code:
    define OSC 20       'Set PBP Osc clock to 20Mhz   <----- use DEFINE not define
    CMCON0 = 0     'Turn off comparators, force set to 0 (off)
    Download and double-check your 16F684 datasheet (DS41202F, Section 8.2, Figure 8-5, Page 58, block in lower right corner).

    Common problem, trips me up about every other month on one project or another...

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    define OSC 20 'Set PBP Osc clock to 20Mhz <----- use DEFINE not define
    DEFINE is not case sensitive, but the text to it's right edge yes.
    Steve

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

  3. #3
    Join Date
    Aug 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Piece of @#$#@!!!


    Well that was easy enough. Stupid pic.

    I was about 3 cuss words away from going out for cigarettes. I've been spinning my wheels on this problem since early yesterday morning. It seems having a note about this somehwere in the oh...... PORTA section would have been helpful. "Confure them as inputs this way, disable the ananlog ANSEL, yep, and oh by the way.... the comparators are installed to be in your way by default, make sure you set that register also". Blah!!


    Okay, thanks guys - and thanks so much for the quick response. I really was at my witts end here. I was starting to wonder if I had a bad batch of PIC's or something, or if I'd managed to zap them somehow.

    It's all good.


    BTW for anyone else reading this:

    CMCON0 = %00000111 'Turn off comparators (CMCON0.0:2 = 111)

    is the solution

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by kevj View Post
    Piece of @#$#@!!!
    Well that was easy enough. Stupid pic.
    I was about 3 cuss words away from going out for cigarettes.
    If it was me, I'd go out for a smoke break anyways...whether the problem was fixed or not...and keep cussin', regardless...

    CMCON0 = %00000111 'Turn off comparators (CMCON0.0:2 = 111)
    Keep your eyes on that and the ANSEL as you move thru the various chips. They change a bit here and there.

Similar Threads

  1. Cleaning up code
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd December 2009, 07:14
  2. SEROUT WORD variable problem
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th April 2009, 11:20
  3. Q: using MCLR for Input on 12F683
    By picster in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 31st January 2009, 15:25
  4. How to Read 6 Inputs anytime ?
    By iugmoh in forum General
    Replies: 9
    Last Post: - 20th February 2008, 12:37
  5. Changing declared variables names on the fly
    By jessey in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 16th December 2006, 06:34

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