MX_ in C

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Gizmo
Posts: 8
Joined: Wed Jan 18, 2006 3:23 am
Contact:

MX_ in C

Postby Gizmo » Thu Apr 06, 2006 1:23 am

I usually open and study the C code that Flowcode generates in order to learn more about C programming. One thing I haven't figured out is: What are the MX_ statements that Flowcode puts at the front of the C code?

Thanks

Ian
Posts: 110
Joined: Thu Sep 29, 2005 10:53 am
Location: Matrix Multimedia
Been thanked: 1 time
Contact:

Postby Ian » Thu Apr 06, 2006 9:23 am

It's mostly component connections and other settings etc. for components.

E.g. if you are using the SPI component it will create defines like:
#define MX_SPI_C
#define MX_SPI_SDI 4

These are used to pass information on to the rest of the code.
In this example we are saying that we are using Port C for SPI, and that the SDI output pin is Pin 4.
For a different device it might need to be Port B Pin 3 etc.
Thus later on in the SPI macro code we can check if MX_SPI_C is defined or not to decide whether to run one bit of code or another.
And we can work with the defined variable MX_SPI_SDI pin without needing to know what that pin is actually set to.

It just makes life easier for us as we can write generic function code and use the MX_defines to pass on the information.

Gizmo
Posts: 8
Joined: Wed Jan 18, 2006 3:23 am
Contact:

Postby Gizmo » Fri Apr 07, 2006 2:05 am

Got it! Thank you very much.