Gyro-Camera Compiling Issue

I’ve been attempting to get all the important bits and pieces of Kevin’s gyro code into his camera workspace, and seem to have succeeded except for a couple annoying compiler errors. Before anything, these may all be caused because I’m using MPLab 6.62.

Issue one:

During the compile, error #1027 comes up, stating that it cannot find the gyro.h file included in user_routines.c or user_routines_fast.c . I have properly merged it into the workspace. The adc.h file shows no problems, and is found properly.

//User_routines.c or user_routines_fast.h

#include <stdio.h>

#include "ifi_aliases.h"
#include "ifi_default.h"
#include "ifi_utilities.h"
#include "user_routines.h"
#include "serial_ports.h"
#include "camera.h"
#include "tracking.h"
#include "terminal.h"
#include "adc.h"
#include "gyro.h"          //(This line is the problem)

extern unsigned char aBreakerWasTripped;

Issue #2:

In the gyro code, there are several ints variables called in Process_Data_From_Master_uP(). They are flagged during the compile, with an “out of scope” label, but in many other functions, similar variable are defined, without issue. Moving the offending variable out of the function’s brackets seems to fix the problem.

void Process_Data_From_Master_uP(void)
    static unsigned int i = 0;              //These variable throw the flag. All of 
    static unsigned int j = 0;              //them.
    int temp_gyro_rate;
    long temp_gyro_angle;
    int temp_gyro_bias;

    Getdata(&rxdata);   /* Get fresh data from the master microprocessor. */

Both workspaces compile fine on their own, and with the commenting or movement of the problems, the merged workspace compiles as well. I’m sure I’m making a single dumb error. Has anyone seen this before?

If you want, zip-up your build directory and send it to me. I’ll have some time later today to look at it.


Here it is. Thanks for the help!

Got it. I’ll get back to you.


I fixed a few things:

  1. I copied adc.c/.h & gyro.c/.h into the main build directory. When you include a header file, the compiler assumes it’s in the build directory unless a path is provided.

  2. I added the ADC and timer 2 interrupt handler routines to interruptlow(). The gyro code needs these.

I tested the code and it works with my camera and ADXRS150 gyro.

-Kevin (1.85 MB) (1.85 MB)