CM1-C

Internal State Variables

Internal state variables are special assignments for variables that give the user access to important motor specific data. The following tables list available state variables

Motor Status Variables

Name

Description

R/W

Unit

"Ux"

Status

  • Read the motor operating status

Value

Status Description

0

In motion

4

Over torque error

8

In position

16

Motor disabled

A complete list of status values can be found at Status and Error States

RO

-

"Px"

Position

  • Reading this variable will return the motor position

  • Writing this variable will set the motor position to the assigned value

It is recommended a write only occurs when the motor is stationary.


R/W

Pulses

"Sx"

Speed

  • Read motors speed

RO

Pulses/second

"Ix"

Current

  • Read motors current

The current limit depends on the motor size. The following table shows the range for each motor

Motor Size

Range

11S30

±50

11L30

±65

17S30

±60

17L30

±110

23S30

±120

23L30

±180


RO

-

"Tx"

Target Current

  • Read motors target current

See "Ix" for each motors value range

RO

-

"Ex"

Error Status

  • Read the value of any error/alarm.

This variable differs from "Ux" in that it will only include status values that indicate a motor error/alarm/fault

RO

-

"Pe"

Position Error

  • Read the error between the target position and the actual position

RO

Pulses

Inputs and Outputs

General Variables

Name

Description

R/W

Unit

"AIN4"

Analog Input Value

Read the value of the analog on input 4

Range: 0 to 1023

RO

-

"Fx"

INPUT2 Frequency

Read the frequency of the signal on input 2

Range: 0 to 2000

RO

1KHz

"Cx"

INPUT2 High Speed Counter

Count rising edge triggers in IN2. This counter uses the processor's high speed
counter and will read pulses up to a frequency of 2MHz

Write to the counter to set a clear/set a starting value.

This counter is very sensitive and will pick up noise and bounce in the signal

R/W

-

"Cx2"

INPUT2 Counter

Counts pulses every 1ms on IN2. Useful on counting inputs use with relays or mechanical switches.
The internal debounce algorithm eliminates unwanted noise and counts.

R/W

-

"Cx3"

INPUT3 Counter

Counts pulses every 1ms on IN3. Useful on counting inputs use with relays or mechanical switches.
The internal debounce algorithm eliminates unwanted noise and counts.

R/W

-

"Cx4"

INPUT4 Counter

Counts pulses every 1ms on IN4. Useful on counting inputs use with relays or mechanical switches.
The internal debounce algorithm eliminates unwanted noise and counts.

R/W

-

"AO2"

Analog Output Value

Set the analog value on OUT2. K34 and K34 must be set correctly to use.

Range: 0 to 255 (0V to 4.5V)

R/W

-

Digital Inputs

Name

Description

R/W

Unit

"IN"

Input Value

Read the combined value of the inputs. Value is calculated as a binary combination

IN1=1
IN2=2
IN3=4
IN4=8

Example: IN1 and IN4 are ON, IN2 and ON3 are off

IN=9

RO

-

"INMK"

Input Mask

Mask the inputs so only the required inputs return a value in IN

R/W

-

"IN1F"
"IN2F"
"IN3F"
"IN4F"

IN falling edge

Read the falling edge for the given input. The variable returns the number of falling edges since the last read. The value is set to 0 on a read.

RO

-

"IN1R"
"IN2R"
"IN3R"
"IN4R"

IN rising edge

Read the rising edge for the given input. The variable returns the number of rising edges since the last read. The value is set to 0 on a read.

RO

-

Timers and Counters

Name

Description

R/W

Unit

"Tmr"

1ms count down timer

Writing a value into the countdown timer will start the count down. The count down timer will decrement every 1ms
until 0.

Range: 0 to +32,767

R/W

1ms

"Cnt"

1ms up counter

The "Cnt" counter is a free running up counter. The counter can be set to any +ve value by writing to it.
It will count up from that value every 1ms. When the counter reaches its limit it resets to 0 and continues counting up.

Range: 0 to +2,147,783,647

R/W

1ms

Pushmode Variables

Name

Description

R/W

Unit

"PTmr"

Set the pushmode timer

  • Set the pushmode time (same as K61) dynamically.

  • Value is in milliseconds.

R/W

1ms

"PV%"

Set the pushmode value

  • Set as as a value of peak torque

  • Can be changed dynamically during a push mode

Range: 0 to 800

R/W

0.1% of peak torque

"PVal"

This variable has been deprecated. It is recommended to use "PV%" in new designs

  • Read or write the pushmode target value. This value can be changed during a push

  • Maximum value is 80% of the current limit. See "Ix" for limits.

R/W

-

Motion Variables

Name

Description

R/W

Unit

"DPos"

Switch on/off dynamic positioning

This function has been deprecated. It is recommended to use Direct Control for changing the target position during motion.

When using the direct mode positioning command (^) the target position is not updated when a new P0 is set. "DPos" sets the behavior of the ^ function

"DPos" Value

Description

0

Direct position operates as standard. Writing P0 does not immediately change the target position

1

Writing to P0 will immediately update the target position. If there is no motion ^ must be sent to start motion

2

Writing to P0 will immediately update the target position, If the motor is stationary it will immediately start motion and does not require ^ to start motion.

R/W

-

"MOP"

Writing to "MOP" enables the direct control modes of operation

"MOP" Value

Description

0

Off - CML mode (Normal Operation)

2

Profile mode

4

Dynamic position mode

10

Torque mode

See Direct Control in the CM1-T user guide for information on how to use the modes.

R/W

-

The motor controller uses an internal motion generator that calculates the 1ms position target. Writing to the variables will overwrite the next 1ms target. Caution should be taken if it cannot be guaranteed to write every 1ms as this could cause intermittent motion

Name

Description

R/W

Unit

"Pt"

Read the 1ms position target generated by the motion generator

RO

pulses

"Dx"

Set the next position target

  • Writing to this variable will overwrite the motion generators next
    position target.

  • To effectively use this the logic must be able to scan and write to "Dx"
    every 1ms.

It is not recommended to use this variable unless it is guaranteed the value can be updated every 1ms.
Unless this value is written every 1ms the internal motion generator will overwrite the value.

R/W

pulses

"St"

Set the next speed target.

  • This value is set in pulses and is the amount of pulses the motor will increment in the next 1ms.

It is not recommended to use this variable unless it is guaranteed the value can be updated every 1ms.
Unless this value is written every 1ms the internal motion generator will overwrite the value.

R/W

pulses

Random Number

The "RND" variable provides a pseudo-random number generator that can be used anywhere a random value is required, for example randomised delays, dither, or test sequences.

Name

Description

R/W

Unit

"RND"

Random number

  • Reading "RND" returns the next random number.

  • Writing "RND" sets the output range. Write a positive value N so reads return a number from 0 to N inclusive; write 0 or leave it unset (the power-up default) to return the full signed 32-bit range, approximately -2,147,483,648 to +2,147,483,647.

To produce a range that does not start at 0, set the range to (max - min) and subtract the offset. For example a span of 10 offset by -5 gives a value from -5 to +5.

The variable must first be bound to the "RND" register as a setup step, outside any bank (for example V1="RND"). Reading or writing the bound variable then only works inside a program bank (B) or logic bank (L); it has no effect from the direct command line.

Logic bank example - bind outside the banks, set the range once in an initialisation bank (L1), then read the value in a continuously running bank (L2):

V1="RND"

L100
L1
V1=10
JL2
END
L2
V2=V1-5
END

V2 holds a fresh random number from -5 to +5 on every scan of L2.

Program bank example - bind outside the bank, then set the range and read within it:

V1="RND"

B1
V1=10
V2=V1-5
END

"RND" is automatically seeded at each power-up from internal hardware signals (a free-running timing counter and the analog inputs), so the sequence normally differs on every power cycle. No manual seeding is required.

The seed entropy depends on the motor's analog state at power-up. If the motor is powered but de-energised and the shaft is held at the same position across power cycles, the starting value may repeat. "RND" is a statistical generator intended for general use and is not cryptographically secure.

R/W

-

Data Retention

Two variables can be used to save data to non-volatile memory. Data will be written on a change.

Name

Description

R/W

Unit

"EEP1"

Memory 1

32 bit

R/W

-

"EEP2"

Memory 2

32 bit

R/W

-


The memory has a limited amount of writes. Caution should be taken to not excessively write to memory