Stepper Motor Controller
Cdios 6166

Command / Reply / Event messages V2.6
New or up-date devices are visible marked V2.x 

 

Cdios Controller Commands  |  Cdios Firmware Page

6166 Cdios Module V1.2  |  6166 Cdios Module V2.06166 Cdios Module V2.5

Addition to V2.5:

All CDIOS messages are presented as 8 bytes long. When variable length messages are selected, the part of the message that is not send over the CAN bus is represented in italic/lightgray text.


Command code 20h: Set stepper motor configuration

Command

Module ID

Selector

4

5

6

7

8

20h

0 - 15

0

Minimum Speed
(lsb)         (msb)

Maximum Speed
(lsb)         (msb)

 Slope

1

On current

Off current

Forward end switch

Reverse end switch

Prescaler


Parameter

Range

Default

Units

Description

Minimum Speed

62 - 2500

100

half steps per second

The actual step speed depends on the prescaler setting.

Maximum Speed

62 - 30000

5000

Slope

1 - 255

5

half steps per milli-
second

Acceleration / Deceleration slope

Run Current

1 - 40

10

0.1A

Set maximum motor current while motor is running, 0.1 - 4.0 A

Stop Current

0 - 40

3

Set maximum motor current (holding current) when motor is stopped, this can be used to save energy.

Forward End switch

0 - 1

1

 

Enable/disable (1/0) forward end switch checking

Reverse End switch

0 - 1

1

 

Enable/disable (1/0) reverse end switch checking

Prescaler 0 - 5 0  

This will divide the minimum speed, maximum speed and slope setting by a factor.
This division is performed by the hardware.

The software will use/report speeds as if there is no prescaler, however motor positions are the actual ones.

Prescaler Factor Actual
Minimum Speed
Actual
Maximum Speed
0 1 62 30000
1 2 31 15000
2 4 15.5 7500
3 8 7.75 3750
4 16 3.875 1875
5 32 1.9375 937.5

Example: If you want to run the stepper motor at a very slow speed of 5.25 half steps/second, then set minimum speed to 84, prescaler to 4 and issue a start command. The motor will run at 84 / 16 half steps per second.

 

This command is only valid when the stepper motor is not running.

Confirmation reply message (suppressed when 'Confirm' is 0):

 

Reply

Module ID

3

4

5

6

7

8

20h

0 - 15

0

0

0

0

0

0

If any error occurs, the current speed settings remain unchanged and an error message is returned

Possible error message:

 

Error

Module ID

3

4

5

6

7

8

A0h

0 - 15

0

0

Error Status1

Error Status2

0

0


Parameter

Bit

 Description

Error Status1

0

1 = Motor is running or a command is latched

1

1 = Selector parameter out of range

2

1 = Minimum speed parameter out of range

3

1 = Maximum speed parameter out of range

4

1 = Slope parameter out of range


Parameter

Bit

 Description

Error Status2

0

1 = Run current parameter out of range

1

1 = Stop current parameter out of range

2

1 = Forward end switch parameter out of range

3

1 = Reverse end switch parameter out of range

4 1 = Prescaler parameter out of range
 


Command code 20h: Read stepper motor configuration

Command

Module ID

Selector

4

5

6

7

8

20h

0 - 15

80 - 81h

0 0 0 0 0

Normal reply is: 

Reply

Module ID

Selector

4

5

6

7

8

20h

0 - 15

80h

Minimum Speed
(lsb)         (msb)

Maximum Speed
(lsb)         (msb)

 Slope

81h

On current

Off current

Forward end switch

Reverse end switch

Prescaler

 

Parameter

 Description

All

Same format as in the 'Set stepper motor configuration' command

Possible error message: 

Error

Module ID

3

4

5

6

7

8

A0h

0 - 15

0

0

Error Status

0

0

0


Parameter

Bit

 Description

Error Status

1

1 = Selector parameter out of range



Command code 21h: Read position

This command returns the current 24 bits (signed) stepper motor position.
A 32 bits long-int is sent in the message for application layer compatibility.

Command

Module ID

3

4

5

6

7

8

21h

0 - 15

0

0

0

0

0

0

 

Reply

Module ID

3

4

5

6

7

8

21h

0 - 15

0

(lsb)

    (msb)

0

Stepper motor position

Parameter

Value

 Description

Stepper Motor Position

32 bits-long-int

This command returns the current 24 bits (signed) stepper motor position

 


Command code 22h: Set position

This command sets the current 24 bits (signed) stepper motor position.
A 32 bits long-int is sent in the message for application layer compatibility.

 

Command

Module ID

3

4

5

6

7

8

22h

0 - 15

0

(lsb)

    (msb)

0

Stepper motor position

This command is only valid when the stepper motor is not running.

Allowable range for stepper motor position: -8388608 up to 8388607

Confirmation reply message (suppressed when 'Confirm' is 0):

 

Reply

Module ID

3

4

5

6

7

8

22h

0 - 15

0

0

0

0

0

0

If any error occurs, the current setting remains unchanged and an error message is returned

Possible error message:

 

Error

Module ID

3

4

5

6

7

8

A2h

0 - 15

0

0

Error Status

0

0

0


Parameter

Bit

 Description

Error Status

0

1 = Motor is running

1

1 = Stepper motor position parameter out of range

  


Command code 23h: Goto position

This command causes the stepper motor to move to the given 24 bits (signed) stepper motor position.

A 32 bits long-int is sent in the message for application layer compatibility.

 

Command

Module ID

3

4

5

6

7

8

23h

0 - 15

Selector

(lsb)

    (msb)

0

Stepper motor position / amount of steps

When selector < 4 then this command is only valid when the stepper motor is not running.

 

Parameter

Bit

 Description

Selector

0

Move motor absolute to the given position

1

Write position into internal latch, motor will move after SYNC command (note 1)

When a SYNC pulse is received without prior reception of the goto command with selector = 1, the motor state remains unchanged.

2

Move motor relative, motor moves forward when given amount of steps is positive.
New motor position is calculated by adding the amount of steps to the current position, as long this is in the stepper motor position range of -8388608 up to 8388607 (motor will move to the limit)

3

Write relative position into internal latch, motor will move after SYNC command (note 1)

When a SYNC pulse is received without prior reception of the goto command with selector = 3, the motor state remains unchanged.


Parameter

Value

 Description

Stepper Motor Position

32 bits-long -int

Allowable range: -8388608 up to 8388607

Confirmation reply message (suppressed when 'Confirm' is 0):

 

Reply

Module ID

3

4

5

6

7

8

23h

0 - 15

0

0

0

0

0

0

If any error occurs, the current setting remains unchanged and an error message is returned

Possible error message:

 

Error

Module ID

3

4

5

6

7

8

A3h

0 - 15

0

0

Error Status

0

0

0


Parameter

Bit

 Description

Error Status

0

1 = Motor is running

1

1 = Emergency stop or watchdog status active (note 2)

2

1 = Selector parameter out of range

  


Command code 24h: Start

This command is used to control the motor motion 'manually'
Do not combine this command with the 'goto position' command.

 

Command

Module ID

3

4

5

6

7

8

24h

0 - 15

Selector

Direction

Option

MotorSpeed
(lsb)             (msb)
0

 

Parameter

Value

 Description

Selector

0

Motor starts directly according to 'Direction' and 'Option'

1

Motor starts after SYNC command (note 1)

Direction

0

Motor starts in Forward direction, if forward end switch is inactive or forward end switch checking is disabled

1 Motor starts in Reverse direction, if reverse end switch is inactive or reverse end switch checking is disabled
Option

0

Motor starts and remains at minimum speed

1 Motor starts at minimum speed and accelerates to maximum speed
This option is allowed to be given when the motor already was started with option 0, however, direction has to be the same.
2 Motor starts and remains at minimum speed until the forward (when direction if forward) or reverse (when direction is reverse) end switch is activated, even if end switch checking is disabled

3

Motor will accellerate/decellerate from its current speed to the selected motor speed.
  • MotorSpeed is zero; the motor will stop
  • MotorSpeed < minimum speed; minimum speed is used
  • MotorSpeed > maximum speed, maximum speed is used

This option is not allowed to be given when the motor was already started with option 2 or the motor is performing a GOTO operation.
Otherwise it can be given at any time.

MotorSpeed

0 - 30000

Target MotorSpeed in half steps/second with option 3.
Actual motorspeed will be clamped to minimum / maximum speed and divided by prescaler value.

Confirmation reply message (suppressed when 'Confirm' is 0):

 

Reply

Module ID

3

4

5

6

7

8

24h

0 - 15

0

0

0

0

0

0

If any error occurs, the current setting remains unchanged and an error message is returned

Possible error message:

 

Error

Module ID

3

4

5

6

7

8

A4h

0 - 15

0

0

Error Status

0

0

0


Parameter

Bit

 Description

Error Status

0

1 = Motor is running

1

1 = Emergency stop or watchdog status active (note 2)

2

1 = Motor is running in opposite direction

3

1 = Selector parameter out of range

4

1 = Direction parameter out of range

5

1 = Option parameter out of range

6 1 = End switch active, cannot start
7 1 = MotorSpeed parameter out of range, only checked if Option = 3
  


 Command code 25h: Stop

This command is used to control the motor motion 'manually', or to stop (abort) the motor after a 'goto' command (only option 1 allowed then)..

Command

Module ID

3

4

5

6

7

8

25h

0 - 15

Selector

Option

0

0

0

0


Parameter

Value

 Description

Selector

0

Stop command is executed immediately

1

Stop command is latched and executed after receiving SYNC command (note 1)


Parameter

Value

 Description

Option

0

Motor decelerates to minimum speed and remains at minimum speed

1

Motor decelerates to minimum speed and then stops (motor current will be set to 'stop current', 500 ms after the motor was stopped).

This option also stops the motor when is was started with a goto command.

2

Motor current is switched completely off

3

Release emergency stop condition, the emergency stop input has to be inactive (note 2).

 

 Confirmation reply message (suppressed when 'Confirm' is 0):

 

Reply

Module ID

3

4

5

6

7

8

25h

0 - 15

0

0

0

0

0

0

If any error occurs, the current setting remains unchanged and an error message is returned

Possible error message:

 

Error

Module ID

3

4

5

6

7

8

A5h

0 - 15

0

0

Error Status

0

0

0

 

Parameter

Bit

 Description

Error Status

0

1 = Motor is running (when option 2 selected)

1

1 = Emergency stop or watchdog status active (note 2)

2

1 = Motor is not running (when option 0 or 1 selected)

3

1 = Selector parameter out of range

4

1 = Option parameter out of range

5

1 = No emergency stop condition to release (when option 3 selected)
 


Command code 26h: Read motor status

This commands reads the internal stepper motor controller module status

 

Command

Module ID

3

4

5

6

7

8

26h

0 - 15

Selector

0

0

0

0

0

 

Parameter

Value

 Description

Selector

0

Read motor status

1

Read motor speed

Normal reply message:

Reply

Module ID

Selector

4

5

6

7

8

26h

0 - 15

0

Status 1

Status 2

0

0

0

1 MotorSpeed
(lsb)              (msb)
 

Parameter

Bit

 Description

Status1

0

1 = Motor is running forward

1

1 = Motor is running reverse

2

1 = Motor is running until end switch found

3

1 = Motor is running at minimum speed

4

1 = Motor is running at maximum speed

5

1 = Motor is accelerating

6

1 = Motor is decelerating

7

1 = Goto command is being executed

Status2

0

1 = Forward end switch active

1

1 = Reverse end switch active

2

1 = Emergency stop input is active (note 2)

3

1 = Motor was stopped by an active and enabled forward end switch,
These status bit will be cleared by a start command

4

1 = Motor was stopped by an active and enabled reverse end switch,
These status bit will be cleared by a start command

5

1 = Motor was stopped by an active emergency stop input
This status bit can only be cleared by a stop command with option 3, 'Goto' , 'Start' and other 'Stop' commands return an error is this bit is set.

6 1 = Motor was stopped by 0.5 second 'watchdog' time-out.
The Cdios controller checks the 6166 with a short interval, when this fails, the 6166 performs an emergency stop...
This status bit can only be cleared by a stop command with option 3, 'Goto' , 'Start' and other 'Stop' commands return an error is this bit is set.
7 1 = Motor stepping driver is in the 'home' position (1 of 8).
This bit will remain zero as long as the motor is running
 

Value

 
MotorSpeed

0 - 30000

The actual motor speed (internal value before the prescaler)
 
Possible error message:

 

Error

Module ID

3

4

5

6

7

8

A6h

0 - 15

0

0

Error Status

0

0

0

 

Parameter

Bit

 Description

Error Status

0

1 = Selector parameter out of range


Command code 27h: Set event on motor status change mask

This commands defines the motor controller status bits to scan for change.

 

Command

Module ID

Selector

4

5

6

7

8

27h

0 - 15

0

Mask1

Mask2

0

0

0


Parameter

Bit

 Description

Mask1

0

1 = enable bit 0 of the status 1 byte

until

1 = enable ...

7

1 = enable bit 7 of the status 1 byte

 

Parameter

Bit

 Description

Mask2

0

1 = enable bit 0 of the status 2 byte

until

1 = enable ...

7

1 = enable bit 7 of the status 2 byte

At power on or reset, the internal masks are cleared.

Confirmation reply message (suppressed when 'Confirm' is 0): 

Reply

Module ID

3

4

5

6

7

8

27h

0 - 15

0

0

0

0

0

0

 

Possible error message: 

Error

Module ID

3

4

5

6

7

8

A7h

0 - 15

0

0

Error Status

0

0

0


Parameter

Bit

 Description

Error Status

0

1 = Selector parameter out of range



Command code 27h: Read event on motor status change mask

This commands defines the motor controller status bits to scan for change.

 

Command

Module ID

Selector

4

5

6

7

8

27h

0 - 15

80h

0

0

0

0

0


Normal reply:

 

Reply

Module ID

Selector

4

5

6

7

8

27h

0 - 15

80h

Mask1

Mask2

0

0

0

 

Parameter

 Description

All

Same format as in the 'Set event on motor status change mask' command

Possible error message: 

Error

Module ID

3

4

5

6

7

8

A7h

0 - 15

0

0

Error Status

0

0

0


Parameter

Bit

 Description

Error Status

0

1 = Selector parameter out of range



Command code 05h: Store configuration

This command stores the current or the default I/O module configuration into internal EEPROM memory.
The configuration is restored from this memory after power on or a reset command.

Command

Module ID

3

4

5

6

7

8

05h

0 - 15

Selector

43h

44h

53h

0

0


Parameter

Value

 Description

Selector

0

Store current configuration

1

Change configuration into default and then store it.

The internal EEPROM erasing / programming takes 120 up to 250 milli-seconds, then the reply message is send.
During programming I/O communication with this module is inhibited.

Sending a command will result in a general error message with errorcode = 8.

The confirmation reply message for this command is NEVER SUPPRESSED.

Reply

Module ID

3

4

5

6

7

8

05h

0 - 15

0

0

0

0

0

0


 Possible error message:

 

Error

Module ID

3

4

5

6

7

8

85h

0 - 15

0

0

Error Status

0

0

0


Parameter

Bit

 Description

Error status

0

1 =  Selector parameter out of range

1 1 = 'password' bytes 4-6 in command are not equal to 43h,44h,53h
2 1 = Configuration EEPROM programming error
 


Events

If an enabled motor status bit changes state, a read motor status event message is sent:

 

Event

Module ID

3

4

5

6

7

8

66h

0 - 15

0

Status1

Status2

0

0

0


Parameter

Bit

 Description

Status1

0

1 = Motor is running forward

1

1 = Motor is running reverse

2

1 = Motor is running until end switch found

3

1 = Motor is running at minimum speed

4

1 = Motor is running at maximum speed

5

1 = Motor is accelerating

6

1 = Motor is decelerating

7

1 = Goto command is being executed

 

Parameter

Bit

 Description

Status2

0

1 = Forward end switch active

1

1 = Reverse end switch active

2

1 = Emergency stop input is active (note 2)

3

1 = Motor was stopped by an active and enabled forward end switch,
These status bit will be cleared by a start command

4

1 = Motor was stopped by an active and enabled reverse end switch,
These status bit will be cleared by a start command

5

1 = Motor was stopped by an active emergency stop input
This status bit can only be cleared by a stop command with option 3, 'Goto' , 'Start' and other 'Stop' commands return an error is this bit is set.

6 1 = Motor was stopped by 0.5 second 'watchdog' time-out.
The Cdios controller checks the 6166 with a short interval, when this fails, the 6166 performs an emergency stop...
This status bit can only be cleared by a stop command with option 3, 'Goto' , 'Start' and other 'Stop' commands return an error is this bit is set.
 

All status data is given in two bytes, so the application has to find out itself which status actually changed.


Note 1: Any latched command (still waiting for SYNC) will be cleared when:
  • A 'goto', 'start' or 'stop' command is given with a selector value of 0
  • A 'set position' command is given
Note 2: Whenever the emergency stop input is active or a watchdog time-out occurs, the emergency status (status2 bit 5) is set and the motor is stopped.

This condition can only be cleared by sending a 'stop' command with option 3


Home  |  Cdios