Proton BASIC Community

Proton (Positron) => Beginners => Topic started by: GERARD on Nov 02, 2023, 04:13 PM

Title: Differences between Positron and Proton
Post by: GERARD on Nov 02, 2023, 04:13 PM
Hello,
With Proton I had written a program that I wanted to modify with Positron but in no longer compiled.

PIC 16F88
With Proton :
    Config1 0x3F31     
    Config2 0x3FFC

With Positron :
  @ CONFIG_REQ = 0 ; Override Compiler's configuration settings
    Asm
    __Config _Config1, 0x3F31     
    __Config _Config2, 0x3FFC     
    EndAsm

Why this difference?


18F26K22
In another program, the compiler gives warnings because I'm using the org directive to place data in flash memory.
Can you explain? How can I stop getting warnings?
Thank you in advance.
Title: Re: Differences between Positron and Proton
Post by: RGV250 on Nov 02, 2023, 05:50 PM
Declare Warnings = off (Page 417 of the manual).
Personally I would never turn the warnings off as the compiler is letting you know there might be an issue.

Bob
Title: Re: Differences between Positron and Proton
Post by: Mapo on Nov 02, 2023, 06:05 PM
Declare Warnings = off
org xxxx
Declare Warnings = on


Mapo
Title: Re: Differences between Positron and Proton
Post by: GERARD on Nov 02, 2023, 08:24 PM
Quote from: Mapo on Nov 02, 2023, 06:05 PMDeclare Warnings = off
org xxxx
Declare Warnings = on


Mapo

It works, but why didn't I get a warning with Proton but I do with Positron?
Title: Re: Differences between Positron and Proton
Post by: RGV250 on Nov 02, 2023, 08:59 PM
QuoteIt works, but why didn't I get a warning with Proton but I do with Positron?
I cant answer why but probably Les decided it needed it so added it like lots of other improvements Positron has over Proton. It just keeps evolving.

Bob
Title: Re: Differences between Positron and Proton
Post by: Stephen Moss on Nov 03, 2023, 09:36 AM
Quote from: GERARD on Nov 02, 2023, 04:13 PMHello,
With Proton I had written a program that I wanted to modify with Positron but in no longer compiled.

PIC 16F88
With Proton :
    Config1 0x3F31     
    Config2 0x3FFC

With Positron :
  @ CONFIG_REQ = 0 ; Override Compiler's configuration settings
    Asm
    __Config _Config1, 0x3F31     
    __Config _Config2, 0x3FFC     
    EndAsm

Why this difference?

I cannot recall if using Config1 followed by a hex value was every allowed, maybe I just did not use it.
If it was not then I can only assume that either the error was not previously trapped and reported or that method was rendered void as a change to how the compiler handles the configuration fuses needed to be made.
Possibly the latter, when it became apparent that there were difference between the Fuse Name the compiler used and those in the data sheet/source file the fuse configurator used due to subsequent changes made by Microchip, thus it became necessary to add a method of writing to the congif registers directly without the compiler creating the hex values based on the relevant fuse name being used, which saved rewriting hundreds of PPI/Def files for older devices potentially multiple times to keep up with any subsequent Microchip changes.

Below is the different outputs from the Fuse Configurator...
Use Compiler Fuse Names:
Config1 FOSC_EXTRCCLK, WDTE_ON, PWRTE_OFF, MCLRE_ON, BOREN_ON, LVP_ON, CPD_OFF, WRT_OFF, DEBUG_OFF, CCPMX_RB0, CP_OFF
Config2 FCMEN_ON, IESO_ON
 
Use Microchip Fuse names (May be same as the compiler names):
Config1 FOSC_EXTRCCLK, WDTE_ON, PWRTE_OFF, MCLRE_ON, BOREN_ON, LVP_ON, CPD_OFF, WRT_OFF, DEBUG_OFF, CCPMX_RB0, CP_OFF
Config2 FCMEN_ON, IESO_ON

ASM Format 1:
Declare Reminders Off
@ CONFIG_REQ = 0          ; Override Compiler's configuration setting
asm-
__Config _Config1, 0x3FFF ;FOSC_EXTRCCLK & WDTE_ON & PWRTE_OFF & MCLRE_ON & BOREN_ON & LVP_ON & CPD_OFF & WRT_OFF & DEBUG_OFF & CCPMX_RB0 & CP_OFF
__Config _Config2, 0x3FFF ;FCMEN_ON & IESO_ON
endasm-
Declare Reminders On 

ASM Format 2:
Declare Reminders Off
@ CONFIG_REQ = 0          ; Override Compiler's configuration setting
asm-
__Config _Config1, 0x3FFF ;FOSC_EXTRCCLK & WDTE_ON & PWRTE_OFF & MCLRE_ON & BOREN_ON & LVP_ON & CPD_OFF & WRT_OFF & DEBUG_OFF & CCPMX_RB0 & CP_OFF
__Config _Config2, 0x3FFF ;FCMEN_ON & IESO_ON
endasm-
Declare Reminders On

Note that hex values are only used with the ASM output, I don't know if it is because the 16F88 is a simple device that both ASM outputs look the same but certainly for more complicate device if memory serves one format is as above, the other lists the fuses individually like this...
@ CONFIG_REQ = 0          ; Override Compiler's configuration setting
asm-
Config DSBOREN = OFF         ; BOR disabled in Deep Sleep
Config DSWDTEN = OFF         ; DSWDT disable
Config DSWDTOSC = LPRC       ; DSWDT uses Low Power RC Oscillator (LPRC
Config DSWDTPS = DSWDTPS0    ; 1:2 (2.1 ms
Config RTCOSC = LPRC         ; RTCC uses Low Power RC Oscillator (LPRC
Config SOSCSEL = IO          ; SOSC pins have digital I/O functions (RA4 =RB4 


Personally, tend to use the __Config _Config1, 0x3FFF ;FOSC_EXTRCCLK & WDTE_ON & PWRTE_OFF & MCLRE_ON & BOREN_ON & LVP_ON & CPD_OFF & WRT_OFF & DEBUG_OFF & CCPMX_RB0 & CP_OFF style fuse configurator output as it take up less space than listing one fuses per line and ensures I won't have any issues if the Compiler & Fuse Configurator are using different Fuse names.
Title: Re: Differences between Positron and Proton
Post by: GERARD on Nov 03, 2023, 08:45 PM
Quote from: RGV250 on Nov 02, 2023, 08:59 PM
QuoteIt works, but why didn't I get a warning with Proton but I do with Positron?
I cant answer why but probably Les decided it needed it so added it like lots of other improvements Positron has over Proton. It just keeps evolving.

Bob

Thank you, I'll keep that in mind for my next programmes.
Title: Re: Differences between Positron and Proton
Post by: GERARD on Nov 03, 2023, 08:48 PM
Stephen,
I'm going to take good note of your comments, which will be useful. Thank you very much.