Code won't compile when I save the uC file somewhere else.

Coding and general discussion relating to the compiler

Moderators: David Barker, Jerry Messina

Post Reply
bradsprojects
Posts: 28
Joined: Thu Nov 29, 2012 12:29 am
Location: Australia

Code won't compile when I save the uC file somewhere else.

Post by bradsprojects » Sun Mar 02, 2014 12:13 pm

Hi all,

Unfortunately I am having a rather strange / annoying problem where I can compile a piece of code perfectly fine in SF when using the standard 18F26K22.bas file.

BUT

If I save the 18F26K22.bas file to my user library and name it something different like 18F26K22New.bas (and then modify the code to include the renamed file). It will no longer compile but give me a whole heap of compilation errors.

Just to be as clear as I can, here is how I include the file when it works:

Code: Select all

Device = 18F26k22
I then click on the 18f26k22.bas file in the left hand code explorer window. I then save the 18f26k22.bas file to my user library and rename it to 18f26k22New.bas (note - I do not modify the file in any way)

I then modify my code to:

Code: Select all

Device = 18F26k22New
I click compile and it no longer compiles! in fact, here are the errors that I am getting:
screen-capture-13.png
screen-capture-13.png (65.04 KiB) Viewed 2876 times
Anyone have any ideas / thoughts on the possible problem here?

On another similar note - Where is the original 18f26k22 file located? is it an actual file or is it somehow embedded into SF? Because I can find a whole lot of other files in the Swordfish\Includes folder, but 18f26k22 is not one of them, even though SF recognises it.

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Re: Code won't compile when I save the uC file somewhere els

Post by David Barker » Sun Mar 02, 2014 12:44 pm

There are a few problems here

(1) device files must be located in the "Includes" system folder
(2) A device *.bas file must have an associated *.inc file

Regardless of the above, you cannot do what you are trying to do. The assembler (MPASMWin.exe) has no concept of a device called "18F26K22New". It will only recognise a valid Microchip device. That is, 18F26K22.

If you want to change the contents of a device file, then

(1) copy the *.bas system file and rename something like 18F26K22.bas.bak
(2) edit 18F26K22.bas

bradsprojects
Posts: 28
Joined: Thu Nov 29, 2012 12:29 am
Location: Australia

Re: Code won't compile when I save the uC file somewhere els

Post by bradsprojects » Sun Mar 02, 2014 12:58 pm

Thanks for that David,

Although I am unable to find the 18f26k22.bas or 18f26k22.inc files.

I have done a search in windows but it returns nothing. I have scrolled right through the Swordfish\Includes folder and they are not located there either (although there are loads of other micro controllers in there). The strange thing is that when i use this piece of code:

Code: Select all

Device = 18F26k22
SF recognises it and it shows up in my left hand code explorer window. I can then click on the 18f26k22 icon and it opens up the 18f26k22.bas file.

I guess the thing that I am trying to get my head around is that as you say, I must have both a 18f26k22.bas and a 18f26k22.inc file in my \includes folder. However I can't find either of these files yet somehow swordfish knows about them.

I would like to be able to get into these two files so that I can add support for using PORTE pin 3 (which by default is not included in that 18f26k22.bas file.

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Re: Code won't compile when I save the uC file somewhere els

Post by David Barker » Sun Mar 02, 2014 1:10 pm

goto "VIEW...EDITOR OPTIONS" and then check "Display full filename path in application title bar" - you will then see the full path displayed in the application title bar when you open a file.

bradsprojects
Posts: 28
Joined: Thu Nov 29, 2012 12:29 am
Location: Australia

Re: Code won't compile when I save the uC file somewhere els

Post by bradsprojects » Sun Mar 02, 2014 11:11 pm

Yep, that did it!

I guess the thing that was throwing me was that (in my experience) when you install a program in windows, it ends up in the program files folder. So I went into there and sure enough, there was swordfish (and swordfishSE) so I was focusing on the files within there the whole time and there was no include files for the 18f26k22.

Performing a windows search yielded nothing for the 18f26k22 files either.

But upon your recommendation I found that the files were actually not in the program files folder, but rather in the program data folder (which looks to be hidden by default).

So I accessed this folder through explorer and the 18f26k22 files were there!

I then proceeded to modify the files to account for PORTE and all seems to be working.

I guess the one thing that was really throwing me offtrack was that there was a swordfish folder in program files, and I was only looking there for the include files. The second thing was that the location that these files were actually held, was hidden to me (maybe I needed to log in as admin perhaps?)

All in all, It's now fixed up and thank you for your help David.

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Re: Code won't compile when I save the uC file somewhere els

Post by David Barker » Sun Mar 02, 2014 11:42 pm

Yes, the file system for win7, win8 etc is completely different from XP, primarily because of UAC...

Post Reply