News:

;) This forum is the property of Proton software developers

Main Menu

I have a strange compilation error

Started by gianmagna, Apr 06, 2025, 02:28 PM

Previous topic - Next topic

gianmagna

I remove the serial port declaration from the program, I don't need it in the program, and the compilation fails looking for a PORTB that doesn't exist on the chip.
I left the declaration, it doesn't disturb the program.
but what's wrong?
Even with positron studio I have the same error
thanks and regards

Gianfranco

before  after


gianmagna

Quote from: gianmagna on Apr 06, 2025, 02:28 PMI remove the serial port declaration from the program, I don't need it in the program, and the compilation fails looking for a PORTB that doesn't exist on the chip.
I left the declaration, it doesn't disturb the program.
but what's wrong?
Even with positron studio I have the same error
thanks and regards

Gianfranco

before
after



gianmagna


top204

#3
The compilers no longer have true default settings for the pins for a peripheral or serial declares, because the devices for the past 10 to 15 years do not always have fixed pins, and they move around from device to device, so defaults are meaningless now.

So the code is defaulting to PORTB because the command you are using requires Declares to tell the compiler what is required for that particular device, and if the device does not have the generic PORT used by the compiler, errors will be produced. The 16LF1823 device does not have a PORTB, and if the Declares had been used for the RSout and RSin commands, the compiler would have issued an error stating that the device does not contain a PORTB.

The pins required for a command or peripheral will only come into play if that command is used in the code listing, and not just because a Declare has not been placed in it. So check your code listing for the command that the Declares relate too.

Do no rely on defaults, and "always" use Declares to set up commands that require them.