12F683 - how to set it to use external 4 MHz clock?


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Sep 2009
    Location
    South Wales (UK)
    Posts
    62


    Did you find this post helpful? Yes | No

    Default

    oooh further to my last I think I misunderstood what you said Dave... so I switched to the:

    @ __config _XT_OSC & _WDT_ON & _MCLRE_ON & _CP_OFF

    and now the error I get in the compiler is Error[118] e:\....\sertest.asm 93 : Overwriting previous address contents (2007)

    ?!

    Is this perhaps related to my program and not this config aspect?

  2. #2
    Join Date
    Jul 2008
    Location
    TURKIYE-KONYA
    Posts
    51


    Did you find this post helpful? Yes | No

    Default

    OPEN YOUR PBP FOLDER AND FIND 12F683.INC

    YOU WILL SEE

    Code:
    NOLIST
        ifdef PM_USED
            LIST
            include 'M12F683.INC'	; PM header
            device  pic12F683, intrc_osc_noclkout, wdt_on, mclr_on, protect_off
            XALL
            NOLIST
        else
            LIST
            LIST p = 12F683, r = dec, w = -302
            INCLUDE "P12F683.INC"	; MPASM  Header
            __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON &_CP_OFF
            NOLIST
        endif
            LIST
    CHANGE THE RED PART AFTER ELSE TO THIS ;

    Code:
    NOLIST
        ifdef PM_USED
            LIST
            include 'M12F683.INC'	; PM header
            device  pic12F683, intrc_osc_noclkout, wdt_on, mclr_on, protect_off
            XALL
            NOLIST
        else
            LIST
            LIST p = 12F683, r = dec, w = -302
            INCLUDE "P12F683.INC"	; MPASM  Header
            __config _XT_OSC & _WDT_ON & _MCLRE_ON & _CP_OFF
            NOLIST
        endif
            LIST
    AND YOU DONT NEED TO WRITE "@ DEVICE" STATEMENT AT THE BEGINNING OF YOUR CODE ANYMORE.

  3. #3
    Join Date
    Sep 2009
    Location
    South Wales (UK)
    Posts
    62


    Did you find this post helpful? Yes | No

    Default

    Excellent!!! I was just reading another persons similar problem and was trying to track it down. Many thanks for that. It does indeed now compile and MPLAB IDE lets me upload the code to the PIC.

    Out of interest, is there any way that I can check if the thing has actually switched to the external oscillator [short of removing the oscillator!] by looking at the assembler file?

    Many thanks all for help with this - has been bugging me for hours!

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


    Did you find this post helpful? Yes | No

    Default

    COOL!!!
    You are using MPLAB!!!!
    Tool bar - configure - configuration bits.
    That shows the current sttings.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Sep 2009
    Location
    South Wales (UK)
    Posts
    62


    Did you find this post helpful? Yes | No

    Default

    Haha, you make it sound soooooooooo easy :P

    'XT' Cheers

    I was hoping that this would help with my serial comm's issue but it hasn't lol. Maybe try another PIC, one with a serial interface built in perhaps?!

    I'll persist with this PIC for now and try to do some error-checking handshaking.

    I can say that I've definitely learned something today

    Best regards to all

    J.

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


    Did you find this post helpful? Yes | No

    Default

    Now that the configs seem to be worked out, post your code and tell what is happening or not happening and we will see what can be done about it.
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Sep 2009
    Location
    South Wales (UK)
    Posts
    62


    Did you find this post helpful? Yes | No

    Default

    Hi there,

    I think I was having a Friday moment. It all seems to be working very well now that it's using the external osc'. I've even bumped up the baud rate to 9600 and getting a good response. Just putting together a simple algorithm to take input over the serial but and set the pulse frequency/duty cycle for HPWM via Hyperterminal.

    Many thanks all for all your help. When I get the code done I'll post it on here as a working version. Won't be long.

    Cheers

    J.

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


    Did you find this post helpful? Yes | No

    Default

    In my opinion forget about using PM, always use MPASM. Later PM will nor work when you get into different things.

    Now I forgot to tell you when you set the fuses in code space you will have to comment out some lines in the chips *.inc file that is in the PBP directory.
    http://www.picbasic.co.uk/forum/showthread.php?t=543

    Or you can modify the *.inc file.

    My inc for this chip looks like this.
    Code:
    ;****************************************************************
    ;*  12F683.INC                                                  *
    ;*                                                              *
    ;*  By        : Leonard Zerman, Jeff Schmoyer                   *
    ;*  Notice    : Copyright (c) 2005 microEngineering Labs, Inc.  *
    ;*              All Rights Reserved                             *
    ;*  Date      : 08/31/05                                        *
    ;*  Version   : 2.46a                                           *
    ;*  Notes     :                                                 *
    ;****************************************************************
            NOLIST
        ifdef PM_USED
            LIST
            include 'M12F683.INC'	; PM header
         ;   device  pic12F683, intrc_osc_noclkout, wdt_on, mclr_on, protect_off
            XALL
            NOLIST
        else
            LIST
            LIST p = 12F683, r = dec, w = -302
            INCLUDE "P12F683.INC"	; MPASM  Header
         ;   __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF
            NOLIST
        endif
            LIST
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Interruptus Frustratus
    By Byte_Butcher in forum General
    Replies: 16
    Last Post: - 17th April 2009, 20:36
  2. Using SPI with External Interrupts
    By shaiqbashir in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 29th June 2008, 04:08
  3. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  4. error on compiling
    By parker in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 16th June 2005, 14:31
  5. How to set external clock source in PBP
    By TurboLS in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 19th February 2005, 15:56

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