PIC16F685 RA4/RA5 pins


Closed Thread
Results 1 to 17 of 17

Hybrid View

  1. #1
    Join Date
    May 2007
    Location
    Suffolk, UK
    Posts
    59

    Default PIC16F685 RA4/RA5 pins

    I thought(!) I understood that PortA 4 & 5 on a PIC16F684 could be used as general purpose I/O pins with an internal oscillator. So far I have been unable to achieve this. I have this at the top of my programme:-

    @_CONFIG INTOSCIO & _WDT_ON & MCRE_OFF & _CP_OFF
    ANSEL = $00
    OSCON = %01100001
    CMCON0 = 7
    TRISA = $00
    TRISC = $00

    All other pins work fine but A4 continues to display a pretty 1Mhz clock output and A5 just looks at me!
    I've RTFM endlessly and tried several things including subtle changes to the oscillator configuration fuse to no avail. So, to stop premature baldness can someone tell me what the problem is!

    Many thanks

    Adrian
    Last edited by Adrian; - 8th November 2008 at 16:35. Reason: Wrong PIC number in heading

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Not sure I remember, but I think the comparators on that chip are under the
    CM1CON0 and CM2CON0 registers. And A4 is open collector.
    http://www.picbasic.co.uk/forum/showthread.php?t=562

    You may want to look at the inc file in MPASM to be sure.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    May 2007
    Location
    Suffolk, UK
    Posts
    59


    Did you find this post helpful? Yes | No

    Default

    Thanks mackrackit but still no joy. I've tried the open collector thing and I believe the COMCON0 to be right. This is puzzling me. I would have thought there should not be clock on A4 when INTOSCIO is chosen as a fuse. I'll keep trying (or change the PIC type.....!!!!)

    Adrian

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    Did you find this post helpful? Yes | No

    Talking

    Hi,

    May be the underscore befre INTOSCIO ... ???


    _EXTRC_OSC_NOCLKOUT EQU H'3FFE'
    _EXTRC_OSC_CLKOUT EQU H'3FFF'
    _INTOSCIO EQU H'3FFC'
    _INTOSC EQU H'3FFD'
    _EXTRCIO EQU H'3FFE'
    _EXTRC EQU H'3FFF'
    Beer for everyone !!!

    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 " !!!
    *****************************************

  5. #5
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Code:
    @_CONFIG INTOSCIO & _WDT_ON & MCRE_OFF & _CP_OFF ; 5 errors here
    ANSEL = $00
    OSCON = %01100001 ; 1 error here
    CMCON0 = 7 ; 1 (maybe 2) errors here
    TRISA = $00
    TRISC = $00
    First person to find them all gets the beer...;o}
    Last edited by Bruce; - 8th November 2008 at 16:29.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  6. #6
    Join Date
    May 2007
    Location
    Suffolk, UK
    Posts
    59


    Did you find this post helpful? Yes | No

    Default

    Hi Alain

    Sadly not, so no beer - not even a good Cotes du Rhone from E.Guigal........! Unfortunately this was a typo error on my post. It was correct in the programme. Rest of programme is fine but RA4/RA5 stubbornly refuse to do anything useful. If someone out there has a 16F684 I'd like them to try it!

    adrian

  7. #7
    Join Date
    May 2007
    Location
    Suffolk, UK
    Posts
    59


    Did you find this post helpful? Yes | No

    Default Sorry this should be pic16f684

    Sorry for wrong information. This should be Pic16F684 not 685. Must be getting tired. HOWEVER it still doesn't work!!

  8. #8
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    It would be a bit different if it's not a 685. Try something like this, and make sure your
    device programmer keeps your config settings. You'll also need to comment out the default
    config setting in the 16F684.INC file for MPASM.

    Code:
    @ __CONFIG _INTOSCIO & _WDT_ON & _MCLRE_OFF & _CP_OFF
    
    ANSEL = $00
    OSCCON = %01100000
    CMCON0 = 7
    TRISA = $00
    TRISC = $00
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. Change On Interrupt, PIC16F884
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 14th November 2008, 17:25
  2. PIC - 8 Pins - 6 Output Pins ?
    By DanPBP in forum Off Topic
    Replies: 0
    Last Post: - 22nd October 2007, 00:23
  3. Why does this program switch pins?
    By Archangel in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th August 2006, 04:24
  4. I2C Effects on other PortA pins
    By kenmac in forum General
    Replies: 2
    Last Post: - 11th July 2005, 05:36
  5. PIC PORT 'special' pins
    By barkerben in forum General
    Replies: 1
    Last Post: - 18th January 2005, 21:40

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