Invalid option

Discuss PIC and electronic related things

Moderators: David Barker, Jerry Messina

Post Reply
CharlieM
Registered User
Registered User
Posts: 211
Joined: Wed Oct 10, 2007 12:05 am

Invalid option

Post by CharlieM » Tue Jul 04, 2023 7:30 pm

Hello Everyone,
These are my fuse settings I got from the fuse config plugin and I get a error message "Invalid Option" for the PBADEN fuse setting.
Any Idea Why? Thanks.

Code: Select all

config
    OSC = INTIO2,       // Internal oscillator block, port function on RA6 and RA7
    FCMEN = OFF,        // Fail-Safe Clock Monitor disabled
    IESO = OFF,         // Oscillator Switchover mode disabled
    PWRT = OFF,         // PWRT disabled
    BOR = ON,           // Brown-out Reset enabled in hardware only (SBOREN is disabled)
    BORV = 3,           // Minimum Setting
    WDT = OFF,          // WDT disabled (control is placed on the SWDTEN bit)
    WDTPS = 32768,      // 1:32768
    CCP2MX = RC1,       // CCP2 input/output is multiplexed with RC1
    PBADEN = DIG,       // PORTB<4:0> pins are configured as analog input channels on Reset  <<<  This ling is what the compiler is pointing to with the 
                                                                                                                                                      message "Invalid Option"
    LPT1OSC = OFF,      // Timer1 configured for higher power operation
    MCLRE = ON,         // MCLR pin enabled; RE3 input pin disabled
    STVREN = ON,        // Stack full/underflow will not cause Reset
    LVP = OFF,          // Single-Supply ICSP disabled
    BBSIZ = BB256,      //  256 Word
    XINST = OFF,        // Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
    DEBUG = OFF,        // Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins
    CP0 = OFF,          // Block 0 not code-protected
    CP1 = OFF,          // Block 1 not code-protected
    CPB = OFF,          // Boot block not code-protected
    CPD = OFF,          // Data EEPROM not code-protected
    WRT0 = OFF,         // Block 0 not write-protected
    WRT1 = OFF,         // Block 1 not write-protected
    WRTC = OFF,         // Configuration registers (300000-3000FFh) not write-protected
    WRTB = OFF,         // Boot block not write-protected
    WRTD = OFF,         // Data EEPROM not write-protected
    EBTR0 = OFF,        // Block 0 not protected from table reads executed in other blocks
    EBTR1 = OFF,        // Block 1 not protected from table reads executed in other blocks
    EBTRB = OFF         // Boot block not protected from table reads executed in other blocks
/code]
Running version 2.2.4.0 ICC 1.2.1.0
Regards CharlieM

Jerry Messina
Swordfish Developer
Posts: 1473
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: Invalid option

Post by Jerry Messina » Tue Jul 04, 2023 10:50 pm

Valid settings for PBADEN are ON and OFF.

You say the ConfigGenerator allows DIG? Is the ConfigGen "Microchip MPASM/MPASMX Folder" setting pointing to the Swordfish BIN folder?

Jerry Messina
Swordfish Developer
Posts: 1473
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: Invalid option

Post by Jerry Messina » Tue Jul 04, 2023 11:12 pm

Are you still using the 18F2620, and that's the device selected in the ConfigGen?

Different chips have different valid settings, and there are some devices for which DIG is a valid setting, but not for the 18F2620. Thank Microchip for that one.

CharlieM
Registered User
Registered User
Posts: 211
Joined: Wed Oct 10, 2007 12:05 am

Re: Invalid option

Post by CharlieM » Tue Jul 04, 2023 11:52 pm

HI Jerry,
I switched to the 18F2321. I decided to develop for the pic that is on the SGLCD backpack. I commented the code

Code: Select all

'Include "intosc.bas"
 '#option DIGITALIO_INIT = true		// automatically call SetAllDigital at startup
 'Include "setdigitalio.bas"
and checked syntax and all is ok. Is the above code not compatible with the 2321 device?
the fuse settings came from the config plugin for the 18F2321

Thanks for the help.
Running version 2.2.4.0 ICC 1.2.1.0
Regards CharlieM

Jerry Messina
Swordfish Developer
Posts: 1473
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: Invalid option

Post by Jerry Messina » Wed Jul 05, 2023 12:26 pm

I think I see what's going on. The file setdigitalio.bas defines a const 'DIG', and that's conflicting with the config settings
(I assume you have the 'config' statement after the 'include's)

Change the order of things... put the config statement in your main program before anything else, right after the 'device' and 'clock' statements, like so:

Code: Select all

device = 18F2321
clock = 8

config
    OSC = INTIO2,       // Internal oscillator block, port function on RA6 and RA7
    FCMEN = OFF,        // Fail-Safe Clock Monitor disabled
    IESO = OFF,         // Oscillator Switchover mode disabled
    PWRT = OFF,         // PWRT disabled
    BOR = ON,           // Brown-out Reset enabled in hardware only (SBOREN is disabled)
    BORV = 3,           // Minimum Setting
    WDT = OFF,          // WDT disabled (control is placed on the SWDTEN bit)
    WDTPS = 32768,      // 1:32768
    CCP2MX = RC1,       // CCP2 input/output is multiplexed with RC1
    PBADEN = DIG,       // PORTB<4:0> pins are configured as digital input channels on Reset
    LPT1OSC = OFF,      // Timer1 configured for higher power operation
    MCLRE = ON,         // MCLR pin enabled; RE3 input pin disabled
    STVREN = ON,        // Stack full/underflow will not cause Reset
    LVP = OFF,          // Single-Supply ICSP disabled
    BBSIZ = BB256,      //  256 Word
    XINST = OFF,        // Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
    DEBUG = OFF,        // Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins
    CP0 = OFF,          // Block 0 not code-protected
    CP1 = OFF,          // Block 1 not code-protected
    CPB = OFF,          // Boot block not code-protected
    CPD = OFF,          // Data EEPROM not code-protected
    WRT0 = OFF,         // Block 0 not write-protected
    WRT1 = OFF,         // Block 1 not write-protected
    WRTC = OFF,         // Configuration registers (300000-3000FFh) not write-protected
    WRTB = OFF,         // Boot block not write-protected
    WRTD = OFF,         // Data EEPROM not write-protected
    EBTR0 = OFF,        // Block 0 not protected from table reads executed in other blocks
    EBTR1 = OFF,        // Block 1 not protected from table reads executed in other blocks
    EBTRB = OFF         // Boot block not protected from table reads executed in other blocks

include "intosc.bas"
#option DIGITALIO_INIT = true		// automatically call SetAllDigital at startup
include "setdigitalio.bas"
That also allows the settings to be over-ridden by any of the files that you include since the last 'config' seen is the one that's used.

Another way to do this is to put the config settings in its own file with nothing else, and include that file in your main program-

Code: Select all

//config.bas
module config_18F2321

config
    OSC = INTIO2,       // Internal oscillator block, port function on RA6 and RA7
    FCMEN = OFF,        // Fail-Safe Clock Monitor disabled
    IESO = OFF,         // Oscillator Switchover mode disabled
    PWRT = OFF,         // PWRT disabled
    BOR = ON,           // Brown-out Reset enabled in hardware only (SBOREN is disabled)
    BORV = 3,           // Minimum Setting
    WDT = OFF,          // WDT disabled (control is placed on the SWDTEN bit)
    WDTPS = 32768,      // 1:32768
    CCP2MX = RC1,       // CCP2 input/output is multiplexed with RC1
    PBADEN = DIG,       // PORTB<4:0> pins are configured as digital input channels on Reset
    LPT1OSC = OFF,      // Timer1 configured for higher power operation
    MCLRE = ON,         // MCLR pin enabled; RE3 input pin disabled
    STVREN = ON,        // Stack full/underflow will not cause Reset
    LVP = OFF,          // Single-Supply ICSP disabled
    BBSIZ = BB256,      //  256 Word
    XINST = OFF,        // Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
    DEBUG = OFF,        // Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins
    CP0 = OFF,          // Block 0 not code-protected
    CP1 = OFF,          // Block 1 not code-protected
    CPB = OFF,          // Boot block not code-protected
    CPD = OFF,          // Data EEPROM not code-protected
    WRT0 = OFF,         // Block 0 not write-protected
    WRT1 = OFF,         // Block 1 not write-protected
    WRTC = OFF,         // Configuration registers (300000-3000FFh) not write-protected
    WRTB = OFF,         // Boot block not write-protected
    WRTD = OFF,         // Data EEPROM not write-protected
    EBTR0 = OFF,        // Block 0 not protected from table reads executed in other blocks
    EBTR1 = OFF,        // Block 1 not protected from table reads executed in other blocks
    EBTRB = OFF         // Boot block not protected from table reads executed in other blocks

end module
That will isolate the config settings so they can't conflict with anything (the order of 'include's is still important though... you'd put 'include config.bas' first).

I recommend that you only put a 'config' statement AFTER the 'include's if you want to guarantee that it's the setting no matter what.
If in doubt, open the .asm file (F2) and you'll see the CONFIG settings at the very end.

btw - both the 2620 and 2321 are ancient devices... you'll pay a premium for them (if they're in stock).
With Microchip, typically the newer the device the cheaper, more features, and more available. They pretty much never obsolete a part... they just keep raising the price. For example, Digikey shows a DIP pkg 18F2321 is $4.91, while a DIP 18F24Q10 is $1.71. An 18F2620 is $9.24!!!!
In comparison, adjusting for the difference in memory sizes the 18F26Q10 is $1.91

Jerry Messina
Swordfish Developer
Posts: 1473
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: Invalid option

Post by Jerry Messina » Wed Jul 05, 2023 1:02 pm

I decided to develop for the pic that is on the SGLCD backpack
Got a link to that backpack?

If you need help switching devices to something more recent, just holler.

CharlieM
Registered User
Registered User
Posts: 211
Joined: Wed Oct 10, 2007 12:05 am

Re: Invalid option

Post by CharlieM » Wed Jul 05, 2023 2:03 pm

Hi Jerry,
I got a box full of old devices. I am just using what I have. Thanks for the info about the order of includes and such. The backpack is obsolete and there isn't any info on the web. That's why I figured I would just wright my own firmware. It is turning out to be harder than I thought. All my software that worked with win7 doesn't seem to work correctly with win 10. Thanks for all the help.
Running version 2.2.4.0 ICC 1.2.1.0
Regards CharlieM

Jerry Messina
Swordfish Developer
Posts: 1473
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: Invalid option

Post by Jerry Messina » Wed Jul 05, 2023 2:33 pm

I got a box full of old devices
I know what THAT's like! There's probably not much difference between the 2620 and 2321, other than the 2620 having a lot more memory to play with.

Either way, let me know if you run into any issues... these older parts are probably the least tested of the bunch when it comes to some of the newer library modules.

Post Reply