Newbie help. PIC18F45k20 pickit debug express


Closed Thread
Results 1 to 20 of 20

Hybrid View

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

    I don't know if you're up for it, but if you are, let's try one more thing:

    Getting the config settings from the manual for your hardware, as you showed in your first example:

    /** C O N F I G U R A T I O N B I T S ******************************/

    #pragma config FOSC = INTIO67, FCMEN = OFF, IESO = OFF // CONFIG1H
    #pragma config PWRT = OFF, BOREN = SBORDIS, BORV = 30 // CONFIG2L
    #pragma config WDTEN = OFF, WDTPS = 32768 // CONFIG2H
    #pragma config MCLRE = OFF, LPT1OSC = OFF, PBADEN = ON, CCP2MX = PORTC // CONFIG3H
    #pragma config STVREN = ON, LVP = OFF, XINST = OFF // CONFIG4L
    #pragma config CP0 = OFF, CP1 = OFF, CP2 = OFF, CP3 = OFF // CONFIG5L
    #pragma config CPB = OFF, CPD = OFF // CONFIG5H
    #pragma config WRT0 = OFF, WRT1 = OFF, WRT2 = OFF, WRT3 = OFF // CONFIG6L
    #pragma config WRTB = OFF, WRTC = OFF, WRTD = OFF // CONFIG6H
    #pragma config EBTR0 = OFF, EBTR1 = OFF, EBTR2 = OFF, EBTR3 = OFF // CONFIG7L
    #pragma config EBTRB = OFF // CONFIG7H

    We can get those into the format needed by removing the #pragma's. Below is some code that hopefully should blink one of the LEDs

    Code:
    #CONFIG
        config FOSC = INTIO67, FCMEN = OFF, IESO = OFF
        config PWRT = OFF, BOREN = SBORDIS, BORV = 30
        config WDTEN = OFF, WDTPS = 32768
        config MCLRE = OFF, LPT1OSC = OFF, PBADEN = ON, CCP2MX = PORTC
        config STVREN = ON, LVP = OFF, XINST = OFF
        config CP0 = OFF, CP1 = OFF, CP2 = OFF, CP3 = OFF
        config CPB = OFF, CPD = OFF
        config WRT0 = OFF, WRT1 = OFF, WRT2 = OFF, WRT3 = OFF
        config WRTB = OFF, WRTC = OFF, WRTD = OFF
        config EBTR0 = OFF, EBTR1 = OFF, EBTR2 = OFF, EBTR3 = OFF
        config EBTRB = OFF
    #ENDCONFIG
    
    OSCCON.6 = 1 'default at reset for OSCCON is 1 mhz, we are changing it here to 16 mhz 
    DEFINE OSC 16
    TRISD = %00000000 'set LED's to outputs
    LED0 var portd.0  'set LED0 as PORTD bit 0 
    
    main:
        pause 500
        toggle LED0
    goto main 
    
    end
    Last edited by ScaleRobotics; - 11th August 2011 at 17:12.

  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,
    That TRIS register setting seems backwards to me, at least if the LED indeed is on PortD.0 and not on PortD.7 - in which case the alias is backwards.

    /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

    Okay, I'll try that when I get a chance. I'll post the results whenever I get to it. Hopefully tonight.
    I am microcontroller stupid!!

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