Newbie help: 16F690


Closed Thread
Results 1 to 12 of 12
  1. #1
    Join Date
    Jul 2006
    Posts
    76

    Default Newbie help: 16F690

    Please excuse me for this simple question. I am using a PICkit 2 with a 16F690 on the Low Pin Count Demo Board. I am trying to turn on an LED when I press a button. My code is below... the PIC dosn't seem to be responding to the button presses....Any help appreciated ( I am a major newbie, if you couldn't tell).

    CODE:

    main:

    if PORTA.3 = 0 then pressed
    goto main

    pressed:
    high PORTC.3
    pause 250
    low PORTC.3
    pause 250

    goto main

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Please excuse me for this simple answer.

    PortA Doesn't Work
    http://www.picbasic.co.uk/forum/showthread.php?t=561
    DT

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


    Did you find this post helpful? Yes | No

    Talking Short and Sweet

    Quote Originally Posted by Darrel Taylor
    Please excuse me for this simple answer.
    Eloquently put, Old Chap !

  4. #4
    Join Date
    Jul 2006
    Posts
    76


    Did you find this post helpful? Yes | No

    Default

    TOUCHE!! Thanks for the help!

  5. #5
    Join Date
    Jul 2006
    Posts
    76


    Did you find this post helpful? Yes | No

    Default

    OK, I followed your link. I followed the instructions but there is a compile error stating that "undefined symbol: CMCON". Here is my new code:
    ----------------------------
    CMCON = 7

    main:

    if PORTA.3 = 1 then pressed
    goto main

    pressed:
    high PORTC.3
    pause 250
    low PORTC.3
    Pause 250

    goto main
    -----------------------------

    Any help is appreciated!

    -Mike

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


    Did you find this post helpful? Yes | No

    Default

    Sure it will never work as there's no CMCON register for that PIC. BTW internal comparator are disabled at POR. Your problem is more with the ADCs.

    ANSEL=0 ' disable ADCs
    Steve

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

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Ok, well I guess that wasn't the best advice for the chip you are using.

    On a 16F690, PORTA.3 is the MCLR/VPP pin, and it defaults to the "Master Clear" (MCLR). In order to use it as a digital input, MCLR must be disabled.

    If using PM as the assembler then use this...
    Code:
    @ DEVICE MCLR_OFF
    or if using MPASM..
    Code:
    @  __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _CP_OFF
    But you'll need to modify the 16F690.INC file in the PBP folder for it to work.

    Also, PORTC.3 is multiplexed with the A/D converter, the Comparators, and the ECCP module. To use this pin as a digital output ...
    Code:
    ANSEL = 0
    ANSELH = 0  ; for ANS8-11
    The 16F690 is a very complex chip as far as PIC's go. And the datasheet is very confusing, to say the least. Wouldn't really recommend it for a first time user.

    HTH,

    P.S. Steve, I found the ANSELH from one of your previous posts.
    DT

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor
    P.S. Steve, I found the ANSELH from one of your previous posts.
    Hehe, was it the Ron Marcus Thread

    It's an interesting PIC so far. I have few of them here but never found time to play with. mmm, this is why the Comparator latches reminded me something when surfing fast in the datasheet.

    The 16F690 is a very complex chip as far as PIC's go. And the datasheet is very confusing, to say the least.
    At least i'm not the only one to say that
    Last edited by mister_e; - 18th September 2006 at 04:33.
    Steve

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

  9. #9
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    >> Hehe, was it the Ron Marcus Thread

    PBP & 16F690 bug?
    http://www.picbasic.co.uk/forum/show...ghlight=16F690

    That's the one!

    Saved me from another hour or two of searching through that awful datasheet.

    Thanks!
    <br>
    DT

  10. #10
    Join Date
    Jul 2006
    Posts
    76


    Did you find this post helpful? Yes | No

    Default Too complex?

    Should I just use a different pin for the button? Would that make it easier than disabling the MCLR? I could just use "ANSEL = 0" and use another PORTA port. Thanks for responses!

    -Mike

  11. #11
    Join Date
    Jul 2006
    Posts
    76


    Did you find this post helpful? Yes | No

    Default

    I also have a PIC16F628A...should I use that instead of the PIC16F690 because of the complexity issues (I already have a programmer adapter for it)? I would still use the "ANSEL = 0" line; will it work?

    -Mike

  12. #12
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    I think think the 628A will be easier for you, as long as you won't be needing the A/D module in the future. It doesn't have one. Would have been easier for me too, since I changed my previous post about 10 times.

    But you'll need CMCON = 7 for it's analog pins.

    However, like you suggested, you could use another pin and ANSEL = 0 and it should work fine with the 690. For now.
    <br>
    DT

Similar Threads

  1. HSERIN / SERIN Problem with 16f690
    By rborsuk in forum Serial
    Replies: 24
    Last Post: - 5th February 2010, 04:51
  2. 16f690 crashes
    By Lincoln S. in forum Serial
    Replies: 8
    Last Post: - 26th November 2008, 08:32
  3. Newbie: Temperature measurements
    By Budda in forum General
    Replies: 10
    Last Post: - 30th March 2007, 09:56
  4. PIC Newbie
    By azmax100 in forum Schematics
    Replies: 7
    Last Post: - 23rd February 2007, 04:52
  5. request for a newbie forum
    By nimonia in forum Forum Requests
    Replies: 1
    Last Post: - 20th May 2006, 09:01

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