|
Re: Calling functions from other documents
Quote:
Originally Posted by Kilroy0846
In MPLAB, how do I call functions from other files in a project?
Here is my code:
Code:
static int counter;
counter = Get_Encoder_3_Count();
And the Get_Encoder_3_Count() function is located in the file encoder.c
Here is the function code:
Code:
long Get_Encoder_3_Count(void)
{
long count;
INTCONbits.RBIE = 0;
count = Encoder_3_Count;
INTCONbits.RBIE = 1;
return(count);
}
The error that I get is:
Error - could not find definition of symbol 'Get_Encoder_3_Count' in file 'V:\frc-code-2007-8722\FrcCode_2007_8722\user_routines.o'.
|
The problem could be that you tried to return a 'long' (4 bytes) variable into an 'int' (2 bytes) holder. Let me know if that helps any.
__________________
Team #2970 Alum
Team #1652 Alum
2006: School Mascot for Team 1652
2007-2008: Programmer for Team 1652 (Robot Mafia)
2009: Programmer on Team 1652 (Robot Mafia), Programmer on Team 2970 (eSchool eBots)
2010-2016: Volunteer, Wisconsin Regional
2017: Programming Mentor, FRC 4247 (CougarBOTS, Obama SCTE, Milwaukee, WI)
Last edited by ShotgunNinja : 03-02-2008 at 19:43.
|