Learning to walk again. (18F46J50 configuration)


Closed Thread
Results 1 to 27 of 27

Hybrid View

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

    Default Learning to walk again. (18F46J50 configuration)

    OK, I'm trying to make an LED blink on a 18F46J50.
    I've done it (and more) successfully on several 16Fxxx chips, but this is my first "18F" experience, and boy this sucker sure has a lot of registers that want setting...

    So far I'm stumped with the CONFIG1L, CONFIG1H, and CONFIG2L registers. (oscillator control)

    When I attempt to set these particular 3 registers, I get syntax ERROR messages (I.E., ERROR Line 20: Syntax error.)

    Here, the OSCCON line compiles fine, but the 3 CONFIGxx lines do not.

    Code:
    OSCCON = %01111100      'idle enable off, 8MHz clock, primary clock source
    CONFIG1L = %11101100    'debugger disabled, no PLL divide, WDT off
    CONFIG1H = %11110111   'no memory code protect, no CPU clock divide
    CONFIG2L = %00000001   'osc out on RA6
    If I open the P18F46J50.INC file, I don't see any reference to any of those CONFIGxx registers in the register definition list.

    What am I doing wrong here that those 3 registers pop up with a Syntax Error?
    Could someone please help point me in the right direction..?

    Thanks!


    steve

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

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

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

  5. #5
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    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  

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

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

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


    Did you find this post helpful? Yes | No

    Default

    Sigh...
    I'm afraid I never got around to trying the USB. Most of my PIC projects are on hold for a while.
    Summer is here and I've got WAY too much work to do, plus a bit of machinery I'm trying to develop for the beverage industry (yeah, it's got a PIC), plus acres of weeds to be mowed, a garden to be tended, and a wife to take to doctor(s) appointments for cancer treatment.
    It's been a brutally busy spring for me and I haven't had time for any PIC related projects that don't have a specific (make money) goal in mind.

    I also broke down and got myself a little Taig desktop milling machine to make small parts to develop my "product" so that's currently eating up what little spare time I have during the week, learning to hack out nice little parts without breaking expensive carbide tool bits.

    Spring & summer months are always a low point for electronics projects for me, but when the rainy season gets here again around november my schedule should lighten up and I'll have time to switch back into "learning mode" again with the PIC's.

    I wish I had some good code to offer you, but I didn't get that far before spring got here....

    Steve

  9. #9
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    Did you find this post helpful? Yes | No

    Default

    Ooh, I'm sorry about your wife . I hope she gets better.

    I have been working on a USB project with a PIC18F4550, but I'm approaching the 32K program memory limit very fast. So, sooner or later I will give this 18F46J50 a try. If I make it work with the USB interface I will post some code in here.

    Robert

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