News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Forcing where to find an include

Started by TimB, Jun 09, 2023, 09:44 AM

Previous topic - Next topic

TimB

Hi

I was pulling the hair out of my chin yesterday (no hair left on top) trying to work out why my rise time was so slow on an i2c bus.

I use 1k2 resistors which should be plenty fast enough and a 2us delay on the clock. It was only on uploading an image from my scope that I figured the problem. I was saying the clock was at 2us but the scope said otherwise.

The issue turned out to be the i2c software include I was wanting to use was in another folder in the folder the .bas was in was not being used. It instead used the one in the includes folder Positron uses and that had a delay of 2 cycles not 2us.

I used Positron studio IDE to select the include and that normally includes the path. It did not so found it using file explorer and copied the path.

Compiled again, and it again ignored the include I wanted and reverted back to the wrong one. In the end I had to make a new folder and stuff all my includes in that folder along with the .BAS

So my question is how can I force Positron to use the include I want not the one in its folder.

Thanks

Tim

John Lawton

Yes, been there, done that. I have previously tried using the full file path but you can get into trouble if you later copy or move the source files to another location.

IME, the surest way is just to change the include file name(s) to unique names in the same directory as the main .bas file so Positron can only find those, no others anywhere else. You then don't need to use any file path for the include files.

DaveS

I think the order of the Compiler search should be
1: Same folder as the Main bas file
2: User Includes folder
3: Compiler Includes folder

do we have a  User Includes folder already

Dave

John Lawton


top204

See page 446 of the Positron8 compier's manual. In the 'Compiler Directives' section:

QuoteNotes
The file to be included into the BASIC listing may be in one of three places on the hard drive if a
specific path is not chosen.

1... Within the BASIC program's directory.
2... Within the Compiler's current directory.
3... Within the user's Includes folder, located in the user's PDS directory.
4... Within the Includes folder of the compiler's current directory.
5... Within the Includes\Sources folder of the compiler's current directory.

The list above also shows the order in which they are searched for.

I've just noticed it still states "three" places, because I have forgotten to count the extra locations it looks at and alter the text. :-)