[SOLVED] [help]function call problem

Status
Not open for further replies.

romel_emperado

Advanced Member level 2
Joined
Jul 23, 2009
Messages
606
Helped
45
Reputation
132
Reaction score
65
Trophy points
1,318
Location
philippines
Activity points
6,061
guys i need help ... How do i call the function mx_cal(); ?? what is that u8 line parameter? i dont have idea how do i call that from the function i made below which is burned_cal();


 
Last edited:

Hi,

In mx_cal(), I didn't see the parameter 'line' being used at all. So, u can supply any value when call it.

e.g. just call mx_cal(5) will do in your routine.

Regards,
Tom
 
yes that is my problem i didnt see the parameter.. i dont know where that u8 line from..

does it perform if i put any value?? thanks


another question.. as what u can see in my burned_cal function is it possible to get the value of weight2 and met2 from the mx_cal() function above?
 

Hi,

I have a quick look,
Ya, u can put any value when call mx_cal. The value is simply not used in the function.

mx_cal() contain an infinite loop which will exit only when idle timeout and Button STAR. So, it will get stuck inside until any of the two condition is meet. As the weight2 and met2 are global variable, they will be updated by any functions that access them, so it is able to be updated by mx_cal() function. I would advice you to initialize them to NULL first, incase mx_call() has not updated them and get exit after power-on.

Regards,
Tom
 
thanks tom...... thanks very much...

how about if i'll do declare like this in the separate *.h file


struct br
{

// User settings
u16 user_weight;

u32 calories;
u16 met_value;
u8 mode;
u8 met2;
u8 weight2;
u8 duration;
};
extern struct br mel;

and then use like this in a function.. does mx_cal(); function can still update the variables namely duration and met2??

void burned_cal(void)
{
if(mel.mode == 1)
{
if(sTime.second == 60)
{
mel.duration++;
}
mx_cal(2);
kcal = ((mel.met2 * 3.5 * (mel.weight2/2.2)) / 200) * mel.duration;
}

}
 
Last edited:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…