Learning to walk again. (18F46J50 configuration)


Closed Thread
Results 1 to 27 of 27

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    We should call that a 543 error.

    http://www.picbasic.co.uk/forum/showthread.php?t=543
    <br>
    DT

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    OK, scratch that.
    That chip is one of the casualties of the __CONFIG has been depricated change.

    The old __CONFIG's won't work.
    Which means you can't put the configs in your program.
    It has to be done from the 18F46J50.INC file in your PBP folder.

    hth,
    DT

  3. #3
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Thanks Darrel,

    That explains why my forehead is so sore.
    I've been pretty successful at setting up CONFIGs for 16F chips, using the good advice and techniques in Melanies excellent thread that you referenced.
    But no matter how many @'s and underscores and (or lack of) that I tried, I always get errors with this danged 18F46J50!

    THANK YOU for pointing out that it can't be done from within my program with this chip!!!! (well, that's damned inconvenient, ain't it?)
    I'll whittle away at it some more and post my results later.

    SO... does that mean that I've now got to maintain individual INCLUDE files for every project that uses this chip but doesn't use the same settings? THAT would totally suck...


    Thanks much!


    steve

  4. #4
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    704


    Did you find this post helpful? Yes | No

    Default

    Byte_Butcher,

    Ok, I am just curious here. What type of programmer are you using? I never need to include the "__CONFIG" or the "@ DEVICE pic16F628, INTRC_OSC_NOCLKOUT" lines in my programs. I use the U2 Melabs programmer and it comes with software that takes care of all of this for you. You just change the settings in a pulldown menu and that's it. It's a lot easier and that way I don't make mistakes like forgetting to enter a setting or spelling issues, etc. I attached a picture of my programmer with settings for a PIC18F4550 for a USB project that I'm currently working on.

    http://store.melabs.com/prod/u2/U2.html

    Darrel,

    Will this software work for a 18F46J50? Or, do I need to use the inc file like you suggested to Byte_Butcher? Thank you.


    Robert
    Attached Images Attached Images  

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


    Did you find this post helpful? Yes | No

    Default

    What about something like this in the code?
    Code:
    ASM
        CONFIG XINST = OFF
        CONFIG FOSC = HS
        CONFIG WDTPS = 512
        CONFIG CP0 = OFF
    ENDASM
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by rsocor01 View Post
    Byte_Butcher,
    Ok, I am just curious here. What type of programmer are you using?
    Robert, I''m using the PICkit 2.
    But the melabs programmer is starting to look pretty handy...

    Anyone else have any comments about using the melabs vs PICkit programmers?

    I've got what I think seem like intelligent configuration settings put into my 18F46J50 include file, but I STILL can't get an LED to blink. I don't think the chip is running at all.
    I'll post my code and configs later, after I've fed cats and taken care of some sunday morning chores.

    steve

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Byte_Butcher View Post
    Anyone else have any comments about using the melabs vs PICkit programmers?
    I have not used the melabs programmers, but over the years here it seems like one of the problems has been with the configs being set via the software. Problem solved by turning that feature of and learning how to set the configs in the *inc or in code space.

    You have a PicKit2, just stick with it.
    Dave
    Always wear safety glasses while programming.

  8. #8
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default Too many registers, not enough brain cells...

    OK, all I'm trying to do is flash 2 LEDs on ports B.4 and D.0 of the 18F46J50.
    It's not working. Not only do the LEDs not light, but the chip doesn't even seem to be running. All of the output pins seem to kind of "float" like they were high impedance inputs, and there's NO clock out on RA.6.
    I kind of get the feeling it's not running at all. I DO have 3.26 volts on both Vdd pins, and 2.44 volts on the Vcap pin (internal regulator), so the power is on.
    I'm guessing that there's SOMETHING that I haven't set correctly, but I haven't found it yet.

    Here's my CONFIG goodies. I'm trying to use the internal OSC with an output on RA6 so I can see if the clock is running.

    Code:
    ;****************************************************************
            NOLIST
        ifdef PM_USED
            LIST
            "Error: PM does not support this device.  Use MPASM."
            NOLIST
        else
            LIST
    ;;;        LIST p = 18F46J50, r = dec, w = -311, f = inhx32
            LIST p = 18F46J50, r = dec, w = -311
            INCLUDE "P18F46J50.INC"	; MPASM  Header
    
    	CONFIG XINST = ON
    	CONFIG STVREN = OFF
    	CONFIG PLLDIV = 2
    	CONFIG WDTEN = OFF
    
    	CONFIG CP0 = OFF
    	CONFIG CPUDIV = OSC1
    
    	CONFIG IESO = OFF
    	CONFIG FCMEN = OFF
    	CONFIG LPT1OSC = OFF
    	CONFIG T1DIG = OFF	
    	CONFIG OSC = INTOSCO  ;Internal OSC, with output on RA6
    	CONFIG DSBOREN = OFF
    	CONFIG DSWDTEN = OFF
    
    
    
            NOLIST
        endif
            LIST
    BLOCK_SIZE	EQU	64


    And here's my program.
    I was hoping that this would set the set the internal OSC to 8MHz, disable all the peripheral stuff, and flash some LEDS on ports B.4 and D.0
    No luck so far.

    Code:
    '****************************************************************
    'Test program to flash LEDS on PORTB.4 and PORTD.0 of the 18F46J50
    '****************************************************************
    
    Define OSC 8
    
    OSCCON = %01111111      'idle enable off, 8MHz clock, primary clock source
    
    '---PERIPHERAL CONFIGURATION REGISTERS---------------------------
    
    PPSCON = 0              'PERIPHERAL PIN SELECT INPUT REGISTER 0  --  0 = unlocked, 1 = locked
    
    '-------INPUT PIN SELECT-----------------------------------------
    RPINR1 = 27              'PERIPHERAL PIN SELECT INPUT REGISTER 1   ' SET ALL PERIPHERALS TO A NON-EXISTENT PIN (no peripherals selected on any pin)
    RPINR2 = 27              'PERIPHERAL PIN SELECT INPUT REGISTER 2
    RPINR3 = 27              'PERIPHERAL PIN SELECT INPUT REGISTER 3
    RPINR4 = 27              'PERIPHERAL PIN SELECT INPUT REGISTER 4
    RPINR6 = 27              'PERIPHERAL PIN SELECT INPUT REGISTER 6
    RPINR7 = 27              'PERIPHERAL PIN SELECT INPUT REGISTER 7
    RPINR8 = 27              'PERIPHERAL PIN SELECT INPUT REGISTER 8
    RPINR12 = 27             'PERIPHERAL PIN SELECT INPUT REGISTER 12
    RPINR13 = 27             'PERIPHERAL PIN SELECT INPUT REGISTER 13
    RPINR16 = 27             'PERIPHERAL PIN SELECT INPUT REGISTER 16
    RPINR17 = 27             'PERIPHERAL PIN SELECT INPUT REGISTER 17
    RPINR21 = 27             'PERIPHERAL PIN SELECT INPUT REGISTER 21
    RPINR22 = 27             'PERIPHERAL PIN SELECT INPUT REGISTER 22
    RPINR23 = 27             'PERIPHERAL PIN SELECT INPUT REGISTER 23
    RPINR24 = 27             'PERIPHERAL PIN SELECT INPUT REGISTER 24
    
    '-------OUTPUT PIN SELECT-----------------------------------------
    
    RPOR0 = 0               'PERIPHERAL PIN SELECT OUTPUT REGISTER 0  'SET ALL OUTPUTS TO THE "NULL" SETTING (no peripherals selected on any pin)
    RPOR1 = 0               'PERIPHERAL PIN SELECT OUTPUT REGISTER 1
    RPOR2 = 0               'PERIPHERAL PIN SELECT OUTPUT REGISTER 2
    RPOR3 = 0               'PERIPHERAL PIN SELECT OUTPUT REGISTER 3
    RPOR4 = 0               'PERIPHERAL PIN SELECT OUTPUT REGISTER 4
    RPOR5 = 0               'PERIPHERAL PIN SELECT OUTPUT REGISTER 5
    RPOR6 = 0               'PERIPHERAL PIN SELECT OUTPUT REGISTER 6
    RPOR7 = 0               'PERIPHERAL PIN SELECT OUTPUT REGISTER 7
    RPOR8 = 0               'PERIPHERAL PIN SELECT OUTPUT REGISTER 8
    RPOR9 = 0               'PERIPHERAL PIN SELECT OUTPUT REGISTER 9
    RPOR10 = 0               'PERIPHERAL PIN SELECT OUTPUT REGISTER 10
    RPOR11 = 0               'PERIPHERAL PIN SELECT OUTPUT REGISTER 11
    RPOR12 = 0               'PERIPHERAL PIN SELECT OUTPUT REGISTER 12
    RPOR13 = 0               'PERIPHERAL PIN SELECT OUTPUT REGISTER 13
    RPOR17 = 0               'PERIPHERAL PIN SELECT OUTPUT REGISTER 17
    RPOR18 = 0               'PERIPHERAL PIN SELECT OUTPUT REGISTER 18
    RPOR19 = 0               'PERIPHERAL PIN SELECT OUTPUT REGISTER 19
    RPOR20 = 0               'PERIPHERAL PIN SELECT OUTPUT REGISTER 20
    RPOR21 = 0               'PERIPHERAL PIN SELECT OUTPUT REGISTER 21
    RPOR22 = 0               'PERIPHERAL PIN SELECT OUTPUT REGISTER 22
    RPOR23 = 0               'PERIPHERAL PIN SELECT OUTPUT REGISTER 23
    RPOR24 = 0               'PERIPHERAL PIN SELECT OUTPUT REGISTER 24
    
    '-----------------------------------------------------------------------------------------------------------------
    
    TRISA = %00000000   'Set PORTA to outputs
    TRISB = %00000000   'Set PORTB to outputs
    TRISC = %00000000   'Set PORTC to outputs
    TRISD = %00000000   'Set PORTD to outputs
    TRISE = %00000000   'Set PORTE to outputs
    
    
    '---MAIN ROUTINE-------------------------------
    
    
    Main:
    
    PORTB.4 = 1
    PORTD.0 = 0
    pause 500
    PORTB.4 = 0
    PORTD.0 = 1
    pause 500
    
    
    goto main
    
    end
    Does anyone have any clues they could toss my way? In the meantime, I'll go RTFM some MORE in hopes I can make sense of all of those registers eventually...

    Thanks,

    steve

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