PicBasic, PicKit2 and configuration...


Closed Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Feb 2012
    Posts
    57

    Default PicBasic, PicKit2 and configuration...

    At the moment I am pulling my hair out...
    I am using a PIC18F14K50. The program is made in PicBasic 3.
    I am using a 12 MHz crystal, because I need USB support. (PLL Osc. x 4)
    In the past I always could set the configuration bits in my 'good old' Epic (parallel port) programmer.
    Because the PIC18F14K50 needs different programming voltages, I recently bought the PicKit2.
    But as far as I see, there is no way of setting the configuration word...
    Is there a way to include the settings in the source (.pbp) file?
    Or how can I tell the PIC18F14K50 that it has to use an external crystal in the PLL osc. x 4 mode?
    I am completely lost! Any help is appreciated!!!

  2. #2
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default Re: PicBasic, PicKit2 and configuration...

    Configs are a pain. Here is one that should work for you. PBP3 makes it easier, once the configs are right. Just put this into your code.

    Code:
    #config  ; 18F13K50/14K50  Only 12mhz crystal can be used for USB ;    
         __CONFIG    _CONFIG1L, _CPUDIV_NOCLKDIV_1L & _USBDIV_OFF_1L ;    
         __CONFIG    _CONFIG1H, _FOSC_HS_1H & _PLLEN_ON_1H & _PCLKEN_ON_1H & _FCMEN_OFF_1H & _IESO_OFF_1H 
    #endconfig
    http://www.scalerobotics.com

  3. #3
    Join Date
    Feb 2012
    Posts
    57


    Did you find this post helpful? Yes | No

    Default Re: PicBasic, PicKit2 and configuration...

    Thanks a lot! I will try that.
    In the meantime I found a (very unelegant!) solution:

    I compile the source code in the PBP compiler.
    After that I start my 'good old' Epic Parallel programmer and load the hex-file.
    I can change the configuration settings in the Epic software and save the hex-file again.
    After that, I program the (modified) hex-file with the PicKit2 programmer. (Because of the lower programming voltage.)
    This works... But not a very nice solution!

  4. #4
    Join Date
    Feb 2012
    Posts
    57


    Did you find this post helpful? Yes | No

    Default Re: PicBasic, PicKit2 and configuration...

    Here is one that should work for you. PBP3 makes it easier, once the configs are right. Just put this into your code.
    It was a nice try, but it doesn't work. The crystal is not oscillating. (I looked with a scope.)
    Also the PicKit2 was complaining about incorrect configuration values.
    However, most of the problems are solved now, since I can change the configuration with the Epic programmer software.
    One has to improvise sometimes...

  5. #5
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default Re: PicBasic, PicKit2 and configuration...

    Interesting.

    Actually, it wasn't a try. It is a configuration known to work. http://www.picbasic.co.uk/forum/show...0434#post80434
    And, I have used it with (with a Pickit2) with success. The only complaining that the pickit should be doing, it saying that your are not setting each of the config.

    What did you change the configs to, to make it work for you?
    http://www.scalerobotics.com

  6. #6
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default Re: PicBasic, PicKit2 and configuration...

    Well,

    This works for sure in PBP3 and Pickit2 (just used it). Needs Xinst off and LVP off. Sorry.
    Code:
    #config  ; 18F13K50/14K50  Only 12mhz crystal can be used for USB
        __CONFIG    _CONFIG1L, _CPUDIV_NOCLKDIV_1L & _USBDIV_OFF_1L
        __CONFIG    _CONFIG1H, _FOSC_HS_1H & _PLLEN_ON_1H & _PCLKEN_ON_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
        __CONFIG    _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _BBSIZ_OFF_4L & _XINST_OFF_4L
    #endconfig
    Last edited by ScaleRobotics; - 26th February 2012 at 17:05.
    http://www.scalerobotics.com

  7. #7
    Join Date
    Feb 2012
    Posts
    57


    Did you find this post helpful? Yes | No

    Default Re: PicBasic, PicKit2 and configuration...

    Great! I'll try this later this evening.
    Thanks again for your help!!!

  8. #8
    Join Date
    Feb 2012
    Posts
    57


    Did you find this post helpful? Yes | No

    Default Re: PicBasic, PicKit2 and configuration...

    Just couldn't wait.... It works!!!
    Problem solved.

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