|
|
View previous topic :: View next topic |
Author |
Message |
micman Guest
|
Problem with function!....HELP ME, please! |
Posted: Thu Feb 27, 2003 2:08 am |
|
|
Hi all,
I have a problem with the funcion,
There are 3 function.
When code compiler, the error is "RECURSION NOT PERMITTED"
WHY?? and as I resolve it!
Thanks all!
the following code:
//-------------------------------------------------------------
//------ sf.c --------------
#include "sf.h"
int8 ch,modalita,sec;
const int8 id_mod3 = 0;
const int8 id_mod1 = 2;
const int8 id_mod2 = 4;
void main() {
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_CLOCK_DIV_2);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_counters(RTCC_INTERNAL,RTCC_DIV_2);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
switch (ch)
{
case (id_mod1):
mod1();
break;
case (id_mod2):
mod2();
break;
case (id_mod3):
mod3();
break;
default:
output_low(PIN_A3);
output_low(PIN_A5);
output_d(0xBF);
output_low(PIN_A4);
}
}
void mod1() { //function 1
modalita = read_eeprom(5);
switch (modalita)
{
case (id_mod1):
sec = read_eeprom(1);
break;
case (id_mod2):
mod2();
break;
case (id_mod3):
mod3();
break;
default:
output_low(PIN_A3);
}
}
void mod2() { //function 2
modalita = read_eeprom(5);
switch (modalita)
{
case (id_mod1):
mod1();
break;
case (id_mod2):
sec = read_eeprom(2);
break;
case (id_mod3):
mod3();
break;
default:
output_low(PIN_A3);
}
}
void mod3() { ////function 3
output_low(PIN_A3);
output_low(PIN_A5);
output_d(0xBF);
output_low(PIN_A4);
}
//----------------------------------------------------------
// - sf.h -
#include <16F877.h>
#device *=16
#use delay(clock=20000000)
#fuses HS,PUT,BROWNOUT,NOWDT
void mod1(void);
void mod2(void);
void mod3(void);
//-----------------------------------------------------
___________________________
This message was ported from CCS's old forum
Original Post ID: 12160 |
|
|
Robert Holmer Guest
|
Re: Problem with function!....HELP ME, please! |
Posted: Thu Feb 27, 2003 3:51 am |
|
|
:=Hi all,
:=I have a problem with the funcion,
:=There are 3 function.
:=When code compiler, the error is "RECURSION NOT PERMITTED"
:=WHY?? and as I resolve it!
:=Thanks all!
:=the following code:
Ciao!
Recursion is not allowed with this compiler. MOD1 could call MOD2 and MOD2 could MOD1. Even if it is not going to happen the compiler does not accept it. If one of the calls is removed the compiler will accept the code.
Saluti,
Rob
___________________________
This message was ported from CCS's old forum
Original Post ID: 12161 |
|
|
micman Guest
|
Re: Problem with function!....HELP ME, please! |
Posted: Thu Feb 27, 2003 5:15 am |
|
|
Ciao Rob,
Thanks for answer, parli italiano?, I'm Italian
can possible use "goto ....."
example:
mod1(){
label1:
......
......
......
}
mod2(){
goto label1
}
Why "goto" only possible within function?
Thanks!
:=:=Hi all,
:=:=I have a problem with the funcion,
:=:=There are 3 function.
:=:=When code compiler, the error is "RECURSION NOT PERMITTED"
:=:=WHY?? and as I resolve it!
:=:=Thanks all!
:=:=the following code:
:=
:=Ciao!
:=Recursion is not allowed with this compiler. MOD1 could call MOD2 and MOD2 could MOD1. Even if it is not going to happen the compiler does not accept it. If one of the calls is removed the compiler will accept the code.
:=
:=Saluti,
:=Rob
___________________________
This message was ported from CCS's old forum
Original Post ID: 12164 |
|
|
|
|
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
|
Powered by phpBB © 2001, 2005 phpBB Group
|