Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

MPLAB IDE C programming µc project

oversprayoverspray Member Posts: 14 ✭✭

Hi,
I noticed a difference between programming a simple C or C++ program compared to working with a project tree for example on mplab ide.
The project consists of many source files .c, and headers.h, there is one main.c.
All the c and c++ books teach to prototype and define functions outside the main, then call the function from inside the main and pass values or references or results back and force.
Now, on this hughe os c project, written for a particular µc the main is rather small, and has a lot of precompiler #if, but the real programming is done in those source files, consisting of functions over functions. I didnt see a single prototype of one. When I write a new function, no parameters are being passed when I for example call same function from within another function. Also when I declared a variable on top of a source file, assuming I would create a global variable, it is not working as one, I cant even read it`s value from within a function on the same source file.
The only way I was able to pass a value to other files was through a global declaration on a .h file. But with function parameters I am stuck. How can I pass them on the same source file to other functions, without even bother with the main?
Can someone help me to understand the basic functioning of the program structure as used by IDE projects for µC ?

Appreciate any help,
John

Sign In or Register to comment.