Hi, I have the following problem:
I am trying to work my way into some os c programm, and being not qite a pro in programming, I have a hard time with it. I did check the books and the internet but don`t find an answer to my problem.
My working place is mplab Ide v8.9with a project tree consisting mainly of headers and source files, and there is one main file. The source files consist of definitions, declerations and functions.
So I write a function in one of the sourcefiles, with a prototype, and when I call the function inside an other function, no arguments seeme to be passed, either any return value appears.
Basically I don`t quite understand the entire tree, how all the source files work together with the main, wich is rather small.
here`s the main:
// main program for testing the IMU.
int mp_argc;
char mp_argv;
int main(int argc, char argv)
{
// keep these values available for later
mp_argc = argc;
mp_argv = argv;
int main(void)
{
mcu_init();
log_init();
preflight();
udb_init();
dcm_init();
init_config();
init_servoPrepare();
init_states();
init_behavior();
init_serial();
udb_run();
// This never returns.
return 0;
}
Thanks for any help,
John
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Some of the header files are conditional compiled (thats what all the #ifs are). Some of the functions that are declared in those header files are also conditional compiled in the main (this makes sense, since you can't access those functions if they are not compiled).
Also the main is different depending on the SIMSIL flag...
None of the functions (with the exception of one of the versions of main) takes variables, nor do they seem to return any. Also looks like it is using some globals to pass info around (mp_argc and mp_argv are in file scope)...
hope that helps?
Sorry, I don
t see any prototypes, and hitting the compile button, it compiles all right, resulting in a functioning hex file.There s called >sevomix.c< for example, the variable doesn s value from within any function. And as I said, those source files (and headers too are just full of funcions and definitions and declerations.
Where would I put a variable that I`d like to use as a global? Meaning that I can read it´s value anywhere at least inside the source file where it was declared on top?