Newbie help. PIC18F45k20 pickit debug express


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Aug 2011
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: Newbie help. PIC18F45k20 pickit debug express

    Thanks mister_e,

    This looks like something I can do. I'll look into this. Do you know if it will work for PICkit3 as well?
    I am microcontroller stupid!!

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Newbie help. PIC18F45k20 pickit debug express

    Hi,
    Im using the free demo version of PBP right for now.
    OK, it doesn't say much to me I'm afraid... Is it a demo version of 2.4, 2.5, 2.6, 3.0 or what? As long as it's not 3.0 editing the .inc file like I showed should work. In 3.0 Melabs have provided us with a better way to handle the CONFIG bits but lets not get into that if you're not using 3.0.

    Im a little vague on understaning what exactly is a INC file. It seems like the books I have read don't go into detail on this very much for the beginner. What I am gathering is that its a file that is attached to the source program when the program is compiled.
    Yes, that is correct. For each device there's .INC file in the PBP folder, the file for the device you select in the drop-down list in Micro Code Studio gets included in your source file before the actual compilation process starts.

    What happens is that MicroCodeStudio passes the name of the device to the compiler thru its -P parameter (see the manual for details on that) and the compiler then "adds" the content of the .INC file to your source file before compiling.

    This tells the compiler which ports to use and how to setup the ports?
    Pretty much, it doesn't say how to set them up (ie. inputs, outputs, analog, digital etc) but it tells the compiler at which physical adress in memory that each register is (PORTA, TRISA, TMR0, T0CON, ANSEL, RCON, whatever). Pretty much like you did with the SYMBOL statements but it does it for you for ALL the regsiters in the chip so you don't have to dig that deep in the datasheet. Small chips might have a dozen or so register, large chips have hundreds of registers.

    Actually, if you look in the 18F45K20.INC file in the PBP folder you'll see there's another include statement in this file, namely INLCUDE P18F45K20.INC which is located in the MPASM directory. It's in this file that the actual names of the registers and their adresses are located.

    In practice it means that you don't have to know the physical adress of the register you want to access, you just need to know its name. The rest is handled for you behind the scenes. So, except for editing the CONFIG bits you rarely need to worry about these files.

    /Henrik.

  3. #3
    Join Date
    Aug 2011
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: Newbie help. PIC18F45k20 pickit debug express

    Ahhh, this clears up some confusion. Now I think I fiqured out why I could never understand MPLAB---adding INC and HEADER files. All the beginner tutorials show you how to get your first "Hello World" up and going but doesn't really explain how it all works and why your doing the things your doing. Like:

    Open this file, click here, click here, look at datasheet, click here, now click compile then program....viola, your first program yaa!!!!!

    It left me scratching my head wondering if I needed to add any INC files to my own program? If so then which one? Theres tons of them.. uhmm.... OWNPRG.INC J/K

    Thanks your help. I'll give these suggestions a go and see how it all turns out.

    Thanks again
    I am microcontroller stupid!!

  4. #4
    Join Date
    Aug 2011
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: Newbie help. PIC18F45k20 pickit debug express

    Quote Originally Posted by HenrikOlsson View Post
    Hi,

    Is it a demo version of 2.4, 2.5, 2.6, 3.0 or what? As long as it's not 3.0 editing the .inc file like I showed should work. In 3.0 Melabs have provided us with a better way to handle the CONFIG bits but lets not get into that if you're not using 3.0.

    /Henrik.
    Im using PBP3.0 the latest release.

    I still ween into the INC file for PIC18f45k20 and made the changes like you stated, however it still didn't work. I tryed some other PBP example codes that came with the installation files and those didn't work either so I feel like theres something else in the INC file that needs to be changed because as I said before, all the hex example codes that are for the pic18f45k20 debug kit work fine. Only the PBP example ones don't. I scanned over the datasheet last night to try and see if there was any other config bits that looked like they might need to be changed but alot of them are over my head right now and I don't really understand them. Got any other suggestions?

    Thanks
    I am microcontroller stupid!!

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


    Did you find this post helpful? Yes | No

    Default Re: Newbie help. PIC18F45k20 pickit debug express

    with PBP3 you no longer need to edit the .INC files. you need to use the new method stated in the migration document.(#CONFIG, #ENDCONFIG)

    http://www.pbp3.com/downloads/Migrat...0to%20PBP3.pdf
    Steve

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

  6. #6
    Join Date
    Aug 2011
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: Newbie help. PIC18F45k20 pickit debug express

    Quote Originally Posted by mister_e View Post
    with PBP3 you no longer need to edit the .INC files. you need to use the new method stated in the migration document.(#CONFIG, #ENDCONFIG)

    What is the configuration block. Is that a insert of the program code?

    For example

    ;***************header

    #CONFIG
    __config _XT_OSC & _WDT_ON & _LVP_OFF & _CP_OFF
    #ENDCONFIG

    Main:

    bla bla bla bla bla

    Goto Main
    End

    ????
    I am microcontroller stupid!!

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


    Did you find this post helpful? Yes | No

    Default Re: Newbie help. PIC18F45k20 pickit debug express

    Yes, that's how you do it, as long as it's indented. Looks like the forum takes out the formatting.... so you probably had it perfect to begin with...
    Code:
    #CONFIG
        __config _XT_OSC & _WDT_ON & _LVP_OFF & _CP_OFF
    #ENDCONFIG
    But the rest is perfect!

    Except the 45K20 will want it in this format:
    Code:
    #CONFIG
            __CONFIG    _CONFIG1H, _FOSC_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
            __CONFIG    _CONFIG2H, _WDTEN_ON_2H & _WDTPS_512_2H
            __CONFIG    _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _HFOFST_ON_3H & _MCLRE_ON_3H
            __CONFIG    _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L
    #ENDCONFIG
    Last edited by ScaleRobotics; - 9th August 2011 at 23:11.

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


    Did you find this post helpful? Yes | No

    Default Re: Newbie help. PIC18F45k20 pickit debug express

    OR anything else list in the p18F45k20.inc file with the new CONFIG directive
    Code:
    #CONFIG
    CONFIG FOSC = INTIO7, FCMEN = OFF, IESO = OFF, PWRT = OFF, BOREN = OFF CONFIG BORV = 18, WDTEN = OFF, WDTPS = 1, MCLRE = ON, HFOFST = ON CONFIG LPT1OSC = OFF, PBADEN = OFF, CCP2MX = PORTC, STVREN = OFF CONFIG LVP = OFF, XINST = OFF, CP0 = OFF, CP1 = OFF, CP2 = OFF CONFIG CP3 = OFF, CPB = OFF, CPD = OFF, WRT0 = OFF, WRT1 = OFF CONFIG WRT2 = OFF, WRT3 = OFF, WRTB = OFF, WRTC = OFF, WRTD = OFF CONFIG EBTR0 = OFF, EBTR1 = OFF, EBTR2 = OFF, EBTR3 = OFF CONFIG EBTRB = OFF
    #ENDCONFIG
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default Re: Newbie help. PIC18F45k20 pickit debug express

    Quote Originally Posted by redmobiusv View Post
    Thanks mister_e,

    This looks like something I can do. I'll look into this. Do you know if it will work for PICkit3 as well?
    It should be really close. I don't have PICKIT 3 myself, maybe It's time for me to grab one of those translucent red box just to sit aside the other dust-gathering device i have on my shelf and bench
    Steve

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

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