MX_ in C

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

Moderators: Benj, Mods

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

MX_ in C

Post by Gizmo »

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:

Post by Ian »

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:

Post by Gizmo »

Got it! Thank you very much.

Post Reply