Skip to content

ModusToolbox Examples

djaumann edited this page Feb 17, 2022 · 1 revision

Examples

The example directory for the modus toolbox includes all standard examples in one setup. Therefore you can use them by simply change a definition.

These examples are included:


//!< This is a list of all examples which are covered with here.
enum examples_t
{
	BASICTEST            = 1,      //!< \brief basicTest just starts and stops a motor */
	ADVANCEDTEST,                  //!< \brief advanceTest runs a motor up and down */
	ERRORDIAGNOSIS,                //!< \brief errorDiagnosis shows the use of the error registers */
	MULTIPLECONTROLLERS,           //!< \brief multipleControllers shows how to implement stacked shields */
	MULTIPLEMOTORS                 //!< \brief multipleMotors shows how to use more than one motor */
};

The examples itself are in subdirectories below the example directory.

You can change the running example by just changing the EXAMPLE definition:


//!> Select the example which is compiled. There are a number of different examples defined which can be switched here.
#define EXAMPLE                     BASICTEST

Then compile and run it.

There is also a possibility to change between single or multiple half-bridges, in case you motor need more current than the 0.9A, which a half-bridge can deliver.

// Select the number of connected half-bridges to be used
// If only two half-bridges are used (one high, one low) than a motor with only 0.9A can be used,
// otherwise the controller will signal an over-current error.
// If you motor or application needs more, than multiple half-bridges can be connected.
// If you choose four half-bridges, than 1.8A can be reached.
// The following settings are possible:
// - 2U two half-bridges with 0.9A are used, which is sufficient for small motors. This is the default setting
// - 4U with 1.8A, which is sufficient for bigger motors like most computer fans
#define TWO_BRIDGES                 2U
#define FOUR_BRIDGES                4U
#define MULTI_HALF_BRIDGES          TWO_BRIDGES

Just change from TWO_BRIDGES to FOUR_BRIDGES.

  • TWO_BRIDGES means that H1 and H5 are used
  • FOUR_BRIDGES means that H1/H2 and H3/H4 are used