News:

;) This forum is the property of Proton software developers

Main Menu

Compiler issue with PIC16F526 processor

Started by W Grundmann, Sep 03, 2026, 05:56 AM

Previous topic - Next topic

W Grundmann

Hi To everyone,

I just purchased the latest version of Positron and am trying some of my old programs. One of my 2 dongles stopped working and I am investigating, if Positron is a suitable plan B for old projects in case my only working dongle also fails.

During this investigation I found that Positron and V3.7.5.5 Proton come up with assembly errors. V3.5.5.5 Proton compiles fine.

I reduced the program to the following lines

Device = 16F526
Xtal=8

Declare Reminders Off
@ CONFIG_REQ = 0
Asm-
__Config  0x0FDC
Endasm-
Declare Reminders On

We sell large quantities of the product based on the PIC16F526 processor. The customer also requires feature changes from time to time.

Therefore it is important for us to be able to support the PIC16F526 processor in the future - even if the only remaining dongle fails.

Can you please help.



RGV250

#1
Hi,
I am not sure where the duplicate is but if you comment out OPTION_REG=0X01FF in the 16F526.PPI file it compiles. Only edit in a text editor, I use Notepad++
'OPTION_REG=0X01FF  <<<<<<<<<<<<<<<<<<<
[REGEND]

SFR Bit Definitions
[BITSTART]

This was compiled in 4.0.6.2

The file is in C:\ProgramFiles(X86)\ProtonIDE\Includes\PPI

Regards,
Bob

RGV250

#2
Hi,
I tried looking a bit further and with this
Device = 16F526
Xtal=8
It fails to compile with
OPTION_REG=0X01FF on line 35 in the ASM and
OPTION_REG=0X10 on line 159.

I am not sure if it is relevant but OPTION_REG is also in the .def file?
$define _OPTION_REG 511

Bob

Stephen Moss

#3
I noticed the same thing as Bob.
I think there should be an entry for the Option register in the .def file, however the value of 511 after it seems much higher than the values for the other registers, just speculating here as I am more familiar with the contents of the .PPI files than the .def files but maybe that is the result of a typo.

If the same code is compiling OK in Proton then I would try using a comparison program like WinMerge to compare the Proton versions of the .PPI and .def (C:\ProgramFiles(X86)\ProtonIDE\Includes\Defs) files for the device with the Positron versions. If there are differences in regard to the options register then try backing up the relevant Positron files so you can easily restore them if the following does not work.

Try alter the Option register data in the Positron version of the Files to be the same as that of the Proton version of the file and see it it compiles then.

RGV250

Hi Stephen,
511 is the same as 0X01FF.
The bit that puzzles me is where the 0X10 comes from.
Also when i looked at the datasheet it did not show an address for OPTION reg?

It would be nice if Les gave us a simple relation as to where the PPI / DEF files are used as they seem to do the same job which causes me confusion.

Bob

Dompie

Why not use the official Positron compiler naming for the Option-register bits for the 16F526 instead of cryptic asm statements.

In the 16F526.def you find the names of the bits:
; OPTION_REG Bits
$define OPTION_REGbits_NOT_RBWU OPTION_REG.7
$define OPTION_REGbits_NOT_RBPU OPTION_REG.6
$define OPTION_REGbits_T0CS OPTION_REG.5
$define OPTION_REGbits_T0SE OPTION_REG.4
$define OPTION_REGbits_PSA OPTION_REG.3
$define OPTION_REGbits_PS2 OPTION_REG.2
$define OPTION_REGbits_PS1 OPTION_REG.1
$define OPTION_REGbits_PS0 OPTION_REG.0

Johan

RGV250

Hi,
QuoteWhy not use the official Positron compiler naming for the Option-register bits for the 16F526 instead of cryptic asm statements
That is not the issue, it fails to compile even without any code, just the device and xtal as there are duplicate OPTION_REG's defined.

Regards,
Bob

See_Mos

#7
am I missing something here?

0x0FDC requires 12 bits but the data sheet shows the Option register as only 8 bits.

I also tried a few thing but also keep getting compilation errors

Even
Device = 16f526
Xtal 8
While 1 = 1 : Wend

causes the compile error Duplicate label ("OPTION_REG" or redefining symbol that cannot be redefined)


Pepe

The compiler doesn't generate the line
LIST P = 16F526, F = INHX8M, W = 2, X = ON, R = DEC, MM = ON, N = 0, C = 255
and if you remove Option_Reg = 0x1ff the program works in Proteus