18F Config fuses


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Well, I learn every day. Thanks Mr_E

    You know, I'm a kind of mid-level programmer, I suppose. By that I mean that I know 16F stuff and PBP pretty well but have had a kind of a rocky ride moving up to 18F.

    There are a few things that illustrate:

    I had no idea that 18F only compiled with MPASM. Where do PBP tell us this? They don't

    *****************************************
    From Mr_E
    tut tut...7607 WORDS with a 16F, 12477 BYTES for a 18F... still much compact in an 18F... no?
    *****************************************

    I also had no idea that an 18F compiled file was expressed as bytes (18F) instead of words (16F). (And Melanie, I'll kill you if you tell me to look for this stuff in page xx sub xx sub xx of the documentation, because I cant find it

    I'm not wingeing. What I want to say is that there are a lot of people out there who need answers that are not in the manual, and thank goodness, the experts in this forum provide them. But boy, have I battled to find out what cooks with my 16F to 18F migration.

    So you guys who are so patient with seemingly stupid requests, bear with us please.
    We appreciate it more than you think

    I would not be able to conduct my small consultancy without your technical help

    Angus

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    And Melanie, I'll kill you if you tell me to look for this stuff in page xx sub xx sub xx of the documentation, because I cant find it
    *smiles*

    1. If you had attempted a compile with an 18F part using the standard (default) PM Assember, one of the first lines to hit your screen would have been...

    "Error: PM does not support this device. Use MPASM."

    This is (in case you missed it) a clue to get you on the right track...

    2. If you had ever compiled using MPASM, at the end of the listing (file.LST) it says BYTES for 18F series and WORDS for the 12F, 16F etc... The PICs DATASHEET (here we go I feel a fatwa coming on - btw, does anybody ever get a thin one?), anyway check the 18F452 Datasheet MEMORY ORGANISATION chapter and you discover...

    "The PIC18F252 and PIC18F452 each have 32 Kbytes of FLASH memory, while the PIC18F242 and PIC18F442 have 16 Kbytes of FLASH. This means that PIC18FX52 devices can store up to 16K of single word instructions, and PIC18FX42 devices can store up to 8K of single word instructions."

    Are we still friends Angus or is it Kevlar vest time?

    Anyway, digressing... it's time you thought about using the 4520 version rather than the plain 452. Heaps more versatile and CHEAPER too...

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Hi Guys-

    Melanie, I'm afraid that I will always be a fatwa not a thinwa...., and kevlar not needed..
    I have been able to get PBP to compile with MPASM, thanks to your advice.
    I was caught, though, by the __CONFIG vs the CONFIG problem with MPASM.

    I still have a strange one.

    If I add config (not __config!) statements to my 18F source file, I get a list of very abstruse ASM compile errors with MPASM

    However, if I REM the source statements in my source file and cut and paste the same statements to the PBP 18F452.inc file, and comment out the __config statements, it assembles fine. I use PBP ver2.46.

    The bottom line is - why can't I use the same statements in my source file as in the .inc file?

    Any help welcomed


    Angus

  4. #4
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    Angus Anderson, Have you commented them out in the include file? MPASM will bitch if it is being told to redifine of rewrite configuration locations.....

    Dave Purola,
    N8NTA

  5. #5


    Did you find this post helpful? Yes | No

    Default

    One other thing I noticed with 18F series is the stack won't POP out if you try to overflow it. It will just hang, lol. Found a gosub routine call that was not properly returned and kept crashing the application. The 16F just pushed the bug in the program out whenever it needed too, the 18F was a little more sticky about it though, lmao.

  6. #6


    Did you find this post helpful? Yes | No

    Default

    Hi Dave-

    Yes, I did comment it out in the include file when I specified the config fuses in the source file. It's just that I can get it to work with no config statements in the source file, and config statements specified in the include file, but NOT the other way around. Statement syntax is identical. This is a funny one.

    CCkid, there is an 18F config statement that allows resetting of a stack overflow. I enabled it

    regards

    Angus

  7. #7
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    Angus Anderson, Could you please send the statements for the configurations you are trying to set? I'm sure it will shed some light on the problem.

    Dave Purola,
    N8NTA

  8. #8


    Did you find this post helpful? Yes | No

    Default

    Hi Dave- As you requested, here are the 2 files:



    This is the source file config statements (at present commented out)
    '--------------------------- Set Processor options. THIS IS MPASM -----------------------
    'ASM
    ' CONFIG OSCS=OFF, OSC=HS
    ' ; Oscillator switchover disabled, HS Osc enabled
    ' CONFIG BOR=ON, PWRT=ON, BORV=27
    ' ; BOR on, BOR acts at 2.7v
    ' CONFIG WDT=ON, WDTPS=128
    ' ; WDT off
    ' CONFIG STVR=ON, LVP=OFF, DEBUG=OFF
    ' ; Stack over/underflow reset enabled
    ' ; LVP disabled
    ' ; Background debugger disabled
    'endasm

    This is the 18f452.inc file which, as mentioned, works

    ;************************************************* ***************
    ;* 18F452.INC *
    ;* *
    ;* By : Leonard Zerman, Jeff Schmoyer *
    ;* Notice : Copyright (c) 2004 microEngineering Labs, Inc. *
    ;* All Rights Reserved *
    ;* Date : 01/27/04 *
    ;* Version : 2.45 *
    ;* Notes : *
    ;************************************************* ***************
    NOLIST
    ifdef PM_USED
    LIST
    "Error: PM does not support this device. Use MPASM."
    NOLIST
    else
    LIST
    LIST p = 18F452, r = dec, w = -311, f = inhx32
    INCLUDE "P18F452.INC" ; MPASM Header
    ;__CONFIG _CONFIG1H, _OSCS_OFF_1H & _XT_OSC_1H
    ;__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
    ;__CONFIG _CONFIG4L, _LVP_OFF_4L
    CONFIG OSCS=OFF, OSC=HS
    CONFIG BOR=ON, PWRT=ON, BORV=27
    CONFIG WDT=ON, WDTPS=128
    CONFIG STVR=ON, LVP=OFF, DEBUG=OFF
    NOLIST
    endif
    LIST
    EEPROM_START EQU 0F00000h
    BLOCK_SIZE EQU 8


    Any insight into the problem would be a help.
    BTW, PBPv2.46

    regards

    Angus

Similar Threads

  1. A/D conversion with PIC18F67J50
    By ScaleRobotics in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 8th May 2009, 01:48
  2. 18F4550 Bootloader enter via eeprom setting
    By bradb in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 22nd November 2008, 23:51
  3. Error 0X0000008E when connecting a 18F2550 USB HID
    By FranciscoMartin in forum USB
    Replies: 8
    Last Post: - 16th October 2008, 17:20
  4. PortE problems (PIC18F4455)
    By RubenR in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 12th July 2006, 15:26
  5. Installation sequence
    By Demon in forum General
    Replies: 23
    Last Post: - 11th July 2006, 03:56

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