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


    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

  2. #2
    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!!

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


    Did you find this post helpful? Yes | No

    Default

    Hi Bruce

    Working through the errors!

    OSCCON is typo in my post - OK in programme
    MCLRE ditto
    underscore in INTOSCIO ditto
    Can't see anything wrong with CMCON0Apologise for wrong PIC reference in post and typos
    Still stuck

    Adrian

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


    Did you find this post helpful? Yes | No

    Default

    Hi Bruce

    My programme is exactly the same as yours (I removed the 1 from OSCCON bit 0). It is just the same as before. I have a 1 Mhz square wave on pin 4 and a sawtooth waveform on pin 5. I have removed everything else in the programme now apart from a LED flashing on RA1. If I try to do that on RA4/RA5 - zilch. The relevant config line was commented out in the PBP pic inc file but I had also tried programming both ways with no luck.

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


    Did you find this post helpful? Yes | No

    Default

    Copy/paste your whole code and inc file so we can see everything.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    Hi mackrackit

    Here it is.

    To be clear I have removed the PIC from it's PCB and stuck it on a breadboard and just programmed it with these 10 lines of code. I have programmed it both with MPASM and PM with line in inc file restored.
    None of the pins are connected apart from LED on PORTA.0 which flashes. Do that on RA4 or RA% and nothing. I get a nice square wave at 1Mhz on RA4 and a sawtooth on RA5. Logic tells me I am not programming an I/O on RA4/RA5 but can't see why. Maybe there is something obvious that I keep overlooking - just too tired or too stupid. Hope you find it!!

    Code cut & pasted

    Code:
    @__CONFIG _INTOSCIO & _WDT_ON & _MCLRE_OFF & _CP_OFF
    ANSEL = $00
    CMCON0 = 7
    OSCCON = $60
    TRISA  = $00
    TRISC  = $00
    
    Start:
    TOGGLE PORTA.0
    PAUSE 250
    goto start
    INC File

    Code:
           
    NOLIST
        ifdef PM_USED
            LIST
            include 'M16F684.INC'	; PM header
            device  pic16F684, intrc_osc_noclkout, wdt_on, mclr_on, protect_off
            XALL
            NOLIST
        else
            LIST
            LIST p = 16F684, r = dec, w = -302
            INCLUDE "P16F684.INC"	; MPASM  Header
            ;__config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF
            NOLIST
        endif
            LIST
    regards

    Adrian

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


    Did you find this post helpful? Yes | No

    Default

    Wow that is strange. I don't have a 16F684, but this works as expected on a 16F688.
    Code:
    @ __CONFIG _INTOSCIO & _WDT_ON & _MCLRE_OFF & _CP_OFF
    
    ANSEL = $00
    OSCCON = %01100000
    CMCON0 = 7
    TRISA = 0
    TRISC = 0
    
    Main:
        PORTA = %00010000
        PAUSE 500
        PORTA = %00100000
        PAUSE 500
        GOTO Main
        
        END
    Try the attached .hex file. It's the same code - but compiled for your 684.

    If it doesn't work, try reading it back from the chip and verifying the config settings.
    Sounds to me like your programmer isn't using the config settings embedded in the .hex.

    Note: If your device programmer isn't programming the config regs, then that would explain
    what you're seeing. The default clock would be external RC with clock out on OSC2.

    The funky signal you're seeing on OSC1 is the internal clock drive assuming an RC oscillator
    circuit is on OSC1.

    The 1MHz signal on OSC2 is the internal oscillator output. It defaults to internal osc since
    your external RC oscillator circuit isn't there. Controller thinks it has failed, defaults to
    internal 4MHz, and still outputs clock/4 on OSC2.
    Attached Files Attached Files
    Last edited by Bruce; - 8th November 2008 at 18:20.
    Regards,

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

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


    Did you find this post helpful? Yes | No

    Default

    Thanks Bruce
    I'll try that tomorrow morning. Just jumping into a bath for a night on the town..!! Well not quite on the town.... at my age its more sedate but I'll have a go tomorrow and let you know. Thanks to you all

    Adrian

  9. #9
    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