Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Problem adding subs/functions to Include Files - SOLVED

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
TSEYFARTH

Bascom Member



Joined: 01 Jul 2006
Posts: 1054

usa.gif
PostPosted: Sun Aug 31, 2014 12:06 am    Post subject: Problem adding subs/functions to Include Files - SOLVED Reply with quote

Hello all,

I am working on a project that has existing include files that I need to add subs to. The Compiler directive to include this file is at the beginning of the main file. The new subs I need to add to the file, are not used until the middle of the Main Loop. If I add a new sub at the end of the existing file, I get an error on compile where the compiler says the sub does not exist. If I move it above an existing file, then it says the now last sub does not exist. If I remove or remark the new one, regardless of position, and remark the code calling the new sub, all is OK.

I tried deleting the .err file from the folder and restarting the computer.

Previously this has happened too, and has led to lots of wasted time. Suddenly it just works. No apparant rhyme or reason - at least that I can figure out.

Can anyone tell me if there is a procedure to use, or file to delete that helps the IDE keep track of the Subs/functions etc?

BTW, I do have at the top of the main loop CONFIG SUBMODE = NEW

Also, I added to the main loop just above where the subs are called, the include directive again. Makes no difference

$Include "rfm24w_subs_004c.inc"
If rfm24_bit_Rx_Ready=1 then call RFM24_RecData_Dave
If bit_Start_Tx_flg = 1 then call RFM24_SndData_Dave


**EDIT**
If I remark the calling code, but leave the sub intact, the project compiles without error. However if I use check syntax, I get error in the first sub of this include file "local allowed only in sub or function" Both of the locals below are listed in the check syntax.
sub RFM24_Configure()
local b_dat as byte
local b_Length as byte


This makes no sense to me but maybe someone else can help explain.
**********

Any guidance/suggestions would be appreciated!
Thank you,
Tim




(BASCOM-AVR version : 2.0.7.7 )


Last edited by TSEYFARTH on Sun Aug 31, 2014 3:07 am; edited 1 time in total
Back to top
View user's profile
TSEYFARTH

Bascom Member



Joined: 01 Jul 2006
Posts: 1054

usa.gif
PostPosted: Sun Aug 31, 2014 3:07 am    Post subject: Reply with quote

Problem SOLVED, maybe....

I *think* the problem was the use of End If, instead of End Sub in one case. That was found only after removing the code for CONFIG SUBMODE = NEW , and creating a new .inc file that was only use for declarations - yes, I know it defeats the purpose of the CONFIG SUBMODE = NEW feature but in this case, it actually got the IDE/Compiler to give me an error that made sense, and was really the cause of the whole thing.

After getting the error, it was corrected, the project reverted back to use CONFIG SUBMODE = NEW, the .inc file holding the declarations was removed as in included file and it worked!

Just thought others may have run into something like this before and perhaps this thread will be of future help.
Tim
Back to top
View user's profile
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum