News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Include Files?

Started by CPR, Nov 22, 2025, 11:01 AM

Previous topic - Next topic

CPR

I've written a set of procedures (and initialisation block) for a SHT31 using the MSSP1 module of a 18F25K22. I'd quite like to place these into an 'include' file just for neatness and re-use. I understand if the include file has the extension '.BAS' then the compiler will place the content of that include - "My_I2C.bas" - at the exact position I call it in my main program.

My question is - are includes with the extension '.INC' treated differently? If so, can anyone point me to where I can find out how best to structure my include as a '.inc' file?

RGV250

Hi,
The INC file is not treated any differently, if you wanted to you could give it a BAS name and include that and it would be the same.
As for structure, it is exactly the same as the BAS file, it just makes the code neater.

Regards,
Bob

CPR

Thanks for the reply. Just to confirm, a ".bas" effectively "pastes" the code within it at the point where I specify
"include My_I2C.bas"

Is that the same for a ".inc" ? Or does a .inc differ subtly in  some fashion?

I've had a look through the manual at includes, but it only mentions includes ending with ".bas"

flosigud

The file needs to be a txt file and suffix can be anything. No subtle difference.

CPR

Thanks for the clarifications  :)