I always use include name in front of variable allocated in that include. Eg for ADS1248 include, all variable start with ADS_.
And I create TempB1 var byte,TempB2,3... TempW1 var word..., TempL1 var long... variables in main file of project, and use them for intermediate calculation in all includes and main file. And there variables are newer used in interrupts.
Pin defines are always commented in include file, so I just copy them in main file and write appropriate port names.
Main project file:
For calling functions I use thisCode:TRIS ADCON OSCCON etc register ... 'Temporally variables used everywhere TmpL1 VAR LONG TmpL2 VAR LONG TmpB0 VAR BYTE TmpB1 VAR BYTE TmpB2 VAR BYTE TmpB3 VAR BYTE TmpW VAR WORD 'Variables for project 'Defines for ADS SYMBOL ADS_DOUT = PORTE.2 SYMBOL ADS_SclK = PORTE.3 SYMBOL ADS_DIN = PORTE.4 SYMBOL ADS_DRDY = PORTE.5 SYMBOL ADS_CS = PORTE.6 SYMBOL ADS_RESET = PORTE.7 INCLUDE "ADS1248.pbp"
AdsRegAdr=AdsIDAC0: AdsRegVal=%00000111: GOSUB ADS1248WriteRegister
GOSUB ADS1248ReadResult
IF ADS_Result.15=0 THEN..
So it isn't inconvenience, and looks like functions...
I done few includes that I used in multiple projects, and I don't see any major drawback comparing to C. There project are commercial, so I cant share my work.
Also I'm working on WEB server for PIC in my free time, and I had made DHCP just as include file, and to exclude or include just use #IF. That project should be published here when I finish it.
Bookmarks