The confi fuses for pic18f4550 in Epic programmer


Closed Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    May 2006
    Posts
    13

    Default The confi fuses for pic18f4550 in Epic programmer

    Hi all:
    I am having a hell of a time programming the pic18f4550 due to its so many clock options. I have been able to get every thing to work if i use a 4MHz ceramic resonator and the XT option from the fuse config menue. The problem occures when i use a 20MHz resonator.
    I use the command Define osc 20 but the timing is still off. I tried to send serial data and the timing is all off.
    any ideas

    thanx


    sam

  2. #2
    Join Date
    Jul 2005
    Posts
    78


    Did you find this post helpful? Yes | No

    Default

    Time for a sanity check. Forget your project for a while, make something simple work.

    Measure the clock frequency. Is it really 20 meg?

    Make a loop timed with a PAUSE to wiggle a pin up and down. Is it the right period?

    Sorry I can't be of more help with the serial commands as I've yet to use them.

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Be sure to set HS in config word. This forces the PIC oscillator drive output
    to a higher level required to drive the high-speed oscillator.

    The default config word osc setting in 18F4550.INC header file is for XT.

    Look in your PBP directory for 18F4550.INC, and change XT to HS, or change
    XT to HS with your programmer software before programming the part.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  4. #4
    Join Date
    May 2006
    Posts
    13


    Did you find this post helpful? Yes | No

    Smile

    Thanx for the reply Bruce. The problem I am having however is not with the compiler but the programmer. In the MElabs programming softwear for the EPIC I can change the configuration fuses. My understanding was that with a 20MHz ceramic resinator if i select Osillator type as HSPLL for Pic18f4550 and use the pll divisions as 5 with the mcu clock division as 2 this should give me a frequency of 48MHz. This is according to the data sheet. however when i do this and try to send data through port B.7 at 9600, the data actually comes in at 115200. I do define the osc at 48 in the program. this is the problem.
    any ideas
    thanx
    sam

  5. #5
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Sorry. Your original post indicates DEFINE OSC 20 with a 20MHz osc. I didn't know you were trying this at 48MHz.

    If you're changing config settings with your EPIC software, and you have the "Reread File Before Programming" and "Update Configuration From File" options checked, then it's going to reload whatever config word settings are embedded in your .hex file before programming the part.

    You should click Save before programming to use whatever config word changes you made. Then program it.

    With a 20MHz crystal, PIC18F4550, and this osc configuration;

    CONFIG PLLDIV=5,CPUDIV=OSC1_PLL2,FOSC=HSPLL_HS

    This works perfectly at 9600;

    SEROUT2 PORTB.7,16468, ["TEST",13,10]

    If you prefer to use 20MHz without HSPLL, just change FOSC=HSPLL_HS to FOSC=HS and DEFINE OSC 48 to DEFINE OSC 20.

    This also works 100%. At least on my board.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  6. #6
    Join Date
    May 2006
    Posts
    13


    Did you find this post helpful? Yes | No

    Default

    Again Thank you very much Bruce but I still cant get the thing to work. I am getting lcoser though. when you say to write the
    CONFIG PLLDIV=5,CPUDIV=OSC1_PLL2,FOSC=HSPLL_HS in the softwear, do i need to add a @ before the word config. I tried this with both the @ and without and the compiler gave me errors both times. what is the exact wording that i need to type into my program
    thanx again
    sam

  7. #7
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Hi Sam,

    No. These are "config fuse" settings. You set them by adding the config directive to your code, editing the 18F4550.INC file in your PBP directory, or select them with your programmers software before programming the part.

    Look at the clock diagram in your 18F4550 data sheet so you can follow this;

    PLLDIV=5 divides the 20MHz crystal input x5 for 4MHz output on the PLL Prescaler.

    Note where it shows (4MHz input only) to the 96MHz PLL block? That's why you use the PLL prescaler. The output can only be 4MHz no matter what the primary oscillator speed is when it's input to the HS PLL.

    CPUDIV=OSC1_PLL2 divides the 96MHz PLL input to the PLL Postscaler x2 to provide 48MHz system clock to the CPU core.

    FOSC = HSPLL_HS simply enables the high-speed PLL clock multiplier.

    These are only available at program time, and can only be configured at the time you initially program the PIC.

    DEFINE OSC 48, 20, etc, does nothing but inform PBP as to the osc clock frequency you're using so it can internally adjust/include PBP library functions to work at the specified clock speed.

    I won't re-hash something Melanie has already covered, so take a peek at this thread; http://www.picbasic.co.uk/forum/showthread.php?t=543

    The new USB parts definitely have a boat-load of oscillator options, but once you get the hang of it, they are really fun to mess with.

    If you're still confused after reading Melanies thread & comparing the above to the data sheet let me know.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  8. #8
    Join Date
    May 2006
    Posts
    13


    Did you find this post helpful? Yes | No

    Lightbulb

    Hi Bruce:
    Thanx for the advice. I have been pulling my hair out of my head non the less. I dont think the problem is in the fuse config any more. I understand how the fuses work but they are not doing what they are suppose to be doing. not sure why. here is what i am doing. I gave up on the 20MHz resonator and i am using the 4MHz resinator. I set the PLLDIV to 1 so to give me 96 Mhz. I also set the oscillator type to XTPLL and the PLL postscaler to 2. so this should give me 48MHz for the CPU clock. this is all done via the epic programmer.
    the Program i am testing is as follows:


    define OSC 48

    loop:
    serout portb.7,2,["test"]
    pause 1000
    goto loop

    now when i run the program the data is not comming in at 9600 but is actually comming in at 115200. I tried replacing XTPLL to HSPLL but no change. I even tried doing OSC 4 and still nothing changed. the program i am using for compiling is microcode studio and the version of my compiler is 2.46. the chip is programmed via an epic programmer with the softwear version of 4.1 beta.
    any other help you can give me will be greatly apriciated.
    thanx
    sam

Similar Threads

  1. epic programmer to lcd
    By rdxbam in forum General
    Replies: 2
    Last Post: - 3rd November 2008, 23:35
  2. epic programmer not found ---HELP!
    By dmacq in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 2nd February 2008, 19:38
  3. Need the programmer EPIC software
    By Pedro Santos in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 22nd April 2007, 11:42
  4. EPIC Programmer - Works for all chips but the 16F876A
    By 4Lewis in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 12th April 2006, 23:59
  5. EPIC PLUS programmer (problem)
    By pakbasic in forum General
    Replies: 3
    Last Post: - 17th May 2005, 19:28

Members who have read this thread : 1

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