Using ISR to call a procedure in a different module?

General discussion on mikroBasic.
Post Reply
Author
Message
extrapilot
Posts: 130
Joined: 28 Nov 2006 17:59

Using ISR to call a procedure in a different module?

#1 Post by extrapilot » 07 Jun 2007 00:26

Hi

Sorry if this is addressed in some previous thread- I searched with no luck.

I have an ISR that handles data IO (USART commands), and I would like to have the ISR call a procedure to process the received information (so that polling is not needed). I have no problem calling a procedure within the module containing the ISR, but if I try to call a proecedure in another module, I get an error "ProcessData not declared,' where ProcessData is the procedure name in question.

In my Main module, I have included both the ISR module and the module containing the procedure "ProcessData." I can call ProcessData from the main module.

I saw a note suggesting that procedure/functions had to have their prototypes defined prior to 'impelements' to make them global (accessible to modules other than the Main module), but then I saw a note from ME saying that this was not yet implemented.

Am I doing something wrong here? I would rather not have to merge my data processing module into my ISR module- this separation is largely the reason for modules in general...

Any help is appreciated-
Regards,
R

jpc
Posts: 1986
Joined: 22 Apr 2005 17:40
Location: France 87

#2 Post by jpc » 07 Jun 2007 07:27

if you have a module containg a ISR ( or whatever procedure) then all code called should be available to that module . Simples solutionl would be to have the procedure inside the module , alternatively you can use another module thereby making available its contents to your module.
By only making them available to main module your module is not aware , however , and this can be a little surprising , once a module uses another module ALL will be visible in the main module.
You have a look at help on scope and visibility allthough this is not completely accurate. Interface section implementation for the moment seems only effective for constant and variable declarations, NOT procedures and functions

extrapilot
Posts: 130
Joined: 28 Nov 2006 17:59

#3 Post by extrapilot » 07 Jun 2007 17:03

Hi JPC

Thank you for your response. May I ask for clarification here? Are you suggesting that if the Main module (call it module A) has an include for the ISR module (call it B), and for the Parsing module (C), that B cannot see C? And, that a workaround is to have A include B, and B include C? I tried having reciprocal includes A included BC, C included B, and that caused an infinite loop in the compile process and crashed during the build.

Best,
Rob

jpc
Posts: 1986
Joined: 22 Apr 2005 17:40
Location: France 87

#4 Post by jpc » 07 Jun 2007 18:13

if you need something from module C in Module B then module B should have a include C clause . If you respect this hierarchie you never will have circular references. A can include the same C without risk.

Molten308
Posts: 5
Joined: 17 Jun 2011 07:21
Location: Western Australia
Contact:

Re: Using ISR to call a procedure in a different module?

#5 Post by Molten308 » 17 Jun 2011 07:29

I am having this exact same issue, where the compiler bombs out saying not enough RAM for CALL stack. It seems to be related to circular calling, but using the include statement as JPC has stated, did not fix the issue.

I am using compiler 4.6 Mikrobasic on a 16F628A PIC.

I wish module B to invoke a procedure on Module C. Whenever I install the procedure into module B (to invoke in module C) I get the error.

Installing an include statement in B - include "C" the fault comes back, ad the compiler has the RAM issue.

Any assistance of how to get around this would be appreciated.

User avatar
slavisa.zlatanovic
mikroElektronika team
Posts: 1321
Joined: 07 Apr 2009 09:39

Re: Using ISR to call a procedure in a different module?

#6 Post by slavisa.zlatanovic » 17 Jun 2011 08:31

Hi!

Please, create a minimal project which depicts the issue you're talking about and send it to me (slavisa.zlatanovic@mikroe.com).
Be sure to send me your whole project and not just source units. I'll try to reproduce your problem and suggest further steps.
Thanks!
Best regards
Slavisa

Post Reply

Return to “mikroBasic General”