There are two types of programming available in control room. There are CML programming windows, and CMP programming windows. CML stands for Cool Muscle Language. This is the basic code that the motor understands and stores. CMP stands for Cool Muscle Program, and this is the basic structure of CML with some added features which can be written in control room and are compiled into CML before being sent to the motor. The added features of CMP programming are to make more complicated programs easier and faster to write, maintain, and troubleshoot.

Comments

In a CML program, comments can be added after a ‘/’ character. These are limited to 30 characters and are not downloaded to the motor. The CMP file improves on the commenting structure in two ways: addition of multi-line comments, and removal of a character limit.

A single line comment can be written similar to CML by using a ‘//’ before the comment which will end at the next carriage return. You can also write a multi-line comment by preceding with a ‘/*’ and ending with ‘*/’. CMP comments are also colored green in order to differentiate them from the rest of the program. Neither of these comment structures are character limited. These comments are not compiled or sent to the motor.

For example:

//This is a single line comment. It will only be terminated when the line ends. – we should show that because this is no on another line it is not a comment.


/*This is a multi-line comment.

It can have as many lines as

you want until it is terminated */


Definition of Constants

A CMP program also allows you to define a constant to be used elsewhere in the program. This allows you to have a name which you can easily reference multiple times in a program, as well as being able to change a constant in one location and have it automatically change throughout the program. The following is an example of a constant definition:

#define fast 100

#define slow 10

 

This definition will allow you to use the names ‘fast’ and ‘slow’ throughout your program, and when it is compiled these instances will be replaced with the numbers 100 and 10 respectively. The define statements are also colored blue in the CMP window to differentiate them from the rest of the program.

Named Variables

A named variable is a read and write variable which is assigned to a specific motor parameter. This allows you to name specific register values to more easily write and troubleshoot a program. The following is an example of a named variable:

var Home P1

var HighSpeed S1

 

In the above example we have defined the P1 register as “Home” and the S1 register as “HighSpeed”. These names can be used throughout the program and when compiled they will reference the defined registers.


Numbers Within a Bank

In a normal CML program, a number cannot be used within a bank; for instance:

P2=P1+100         

Would not work, you would have to define a different register as 100 and call that from within the bank. By using a CMP file, control room will do this for you automatically. You can in fact write the above statement in a CMP file. When compiled, the software will automatically assign an unused register as the desired number and use that register in the program sent to the motor. If you have used all available register addresses, control room will give you an error. 

  • No labels