CPB EtherCAT Technical Manual

Digital inputs and outputs

This controller has 24 I/O pins, which can be configured as either input or output.

Defining input and output assignments

Some pins can be freely assigned. Which those are can be seen in the following table. You can find the assignment as set in the factory settings in chapter Pin assignment.

Define the function of each configurable pin in the corresponding subindex of object 3272h (Usage Of Pins Available On Connector). All of the pins listed in the following table can be assigned the following functions:

  • Digital input or output
  • Input Range Selection
  • Analog Input Control
  • Capture Input
  • SPI Chip Select

The following pins also support alternative functions:

Pin Alt. Function 1 Alt. Function 2 Subindex in 3272h
4, ANA1 Analog input 1 (factory settings) 01h
6, ANA2 Analog input 2 (factory settings) 02h
18, H1 Hall sensor input 1 (factory settings) 03h
19, DIO11 04h
20, H2 Hall sensor input 2 (factory settings) 05h
21, DIO13 SPI Data OUT (MOSI) 06h
22, H3 Hall sensor input 3 (factory settings) 07h
23, ENC1B incr. Encoder 1, B (factory settings) SSI encoder 2, Data IN 08h
24, ENC1A incr. Encoder 1, A (factory settings) SSI encoder 2, clock 09h
25, SSI1_MISO SSI encoder 1, Data IN (factory settings) SPI Data IN (MISO) 0Ah
26, ENC1I incr. Encoder 1, Index (factory settings) 0Bh
27, SSI1_CLK SSI encoder 1, clock (factory settings) SPI Clock 0Ch
29, DIO14 0Dh
39, DIO1 Clock input in clock-direction mode Channel A of the virtual encoder output 0Eh
41, DIO3 0Fh
42, DIO2 Direction input in clock-direction mode Channel B of the virtual encoder output 10h
43, DIO5 11h
44, DIO4 12h
45, DIO7 13h
46, DIO6 14h
47, DIO9 PWM output 0 15h
48, BRAKE Brake output (factory settings) 16h
50, DIO10 PWM output 1 17h
56, DIO12 18h

In object 3272h, you define how each pin is to be used by writing the corresponding value in the corresponding subindex.

Value Function
0 digital input
128 digital output
256/257 Input Range Selection
384/385 Analog Input Control
512 analog input
640 Hall sensor input
768 Encoder input (incremental)
896 Encoder input (SSI)
1024 PWM output / brake output
1152 Virtual encoder output
1280 Clock/direction input in Clock-direction mode
1408 Generic SPI
1536/1537 Capture Input

Then store your configuration by writing the value "65766173h" in 1010h:03h (see chapterSaving objects) and restart the controller.

Example

Pin 39 (DIO1) is to be the clock input in Clock-direction mode.

Pin 42 (DIO2) is to be the direction input in Clock-direction mode.

  1. Set 2372h:0Eh and 2372h:10h to "1280".
  2. Set 1010h:03h to "65766173h“.

Input Range Selection

You can assign up to two of the configurable pins this function. These pins are only digital outputs that can be controlled via the corresponding bit in 3240h:06h (set to High if bit=1):

Value in 3272h:xxh Control bit in 3240h:06h
384 0
385 1

With these pins, you can control appropriate external circuits that toggle the switching level of the digital inputs, e.g., between 5/24 V.

Analog Input Control

You can assign up to two of the configurable pins this function. These pins are only digital outputs that can be controlled via the corresponding bit in 3221h:06h (set to High if bit=1):

Value in 3272h:xxh Control bit in 3221h:00h
256 0
257 1

With these pins, you can control appropriate external circuits that toggle the corresponding analog input between voltage measurement and current measurement. The first pin (in the order given in the table of alternative functions) controls the first analog input and the second pin controls the second.

Capture Input

You can assign up to two of the configurable pins this function. These pins are capture inputs that are configured via the corresponding subindices in 3241h:

Value in 3272h:xxh Configuration in 3241h
1536 Capture Input 1: Subindex 1 to 4
1537 Capture Input 2: Subindex 5 to 8

If there is a level change at these pins, the current encoder position is noted. The first pin assigned the function (in the order given in the table of alternative functions) is the first capture input (Capture Input 1).

Generic SPI

The controller can communicate with external devices via this SPI interface, e.g. port expanders or displays.

Note: The used SPI peripheral must support a clock frequency of at least 164 KHz.

All configurable pins can be assigned the Chip Select function, with the exception of the pins that are intended for the following functions:

Pin SPI function Subindex in 3272h
21, DIO13 Data OUT (MOSI) 06h
25, SSI1_MISO Data IN (MISO) 0Ah
27, SSI1_CLK Clock 0Ch

To activate the respective function, write the value "1408" in 3272h:xxh.

Note: Only the first (in the order given in the table of alternative functions) pin configured as Chip Select is used. If you need multiple pins with the function, use one pin as digital output.

The settings of the SPI interface are located in object 3273h:01h (Generic SPI Hardware Configuration):

  • Bit 0 (Clock Phase):
    • Value = "0": Data transfer begins with the first falling clock edge (with polarity = 1)
    • Value = "1": Data transfer begins with the first rising clock edge (with polarity = 1)
  • Bit 1 (Clock Polarity): With this bit, you can invert the polarity of the clock signal. The value 0 means the level remains on Low if the clock is idling.
  • Bits 2 to 4 (baud rate): You set the clock frequency here:
    • 000b: 21 MHz
    • 001b: 10.5 MHz
    • 010b: 5.25 MHz
    • 011b: 2625 KHz
    • 100b: 1312.5 KHz
    • 101b: 656.25 KHz
    • 110b: 328.125 KHz
    • 111b: 164.0625 KHz
  • Bit 10 (CS Polarity): With this bit, you can invert the polarity of the Chip Select. Value 0 means that the level remains on High if the signal is idling.

 

The data are sent/received via the following objects:

  • 3274h (Generic SPI Mosi Data):
    • Subindex 1 to 1Fh (Generic SPI Mosi Data Byte #1 to #31): You write the data that are to be sent here, divided into up to 31 bytes.
    • Subindex 0 (Length of SPI message to be sent): Then enter the number of bytes here (= subindicies) that are to be sent. In the next millisecond cycle, the data are sent and the subindex is reset to the value "0".
  • 3275h (Generic SPI Miso Data): You read the received data here.
    • Subindex 0 (Length of received SPI message): The value tells you how many data bytes (= subindices) were received.
    • Subindex 1 to 1Fh (Generic SPI Miso Data Byte #1 to #31): The data that were received are located here.

Bit assignment

The software of the controller assigns each input and output two bits in the respective object (e.g., 60FDh Digital Inputs or 60FEh Digital Outputs):

  1. The first bit corresponds to the special function of an output or input. These functions are always available on bits 0 to 15 (inclusive) of the respective object. These include the limit switches and the home switch for the digital inputs and the brake control for the outputs.
  2. The second bit shows the output/input as a level; these are then available on bits 16 to 31.

Example

To manipulate the value of output 2, always use bit 17 in 60FEh.

To activate the "negative limit switch" special function of input 1, set bit 0 in 3240h:01h; to query the status of the input, read bit 0 in 60FDh. Bit 16 in 60FDh also shows the status of input 1 (independent of whether or not the special function of the input was activated).

This assignment is graphically illustrated in the following drawing.

Digital inputs

Overview

Note: For digital inputs with 5 V, the length of the supply lines must not exceed 3 meters.
Note: The digital inputs are sampled once per millisecond. Signal changes at the input less than one millisecond in duration are not processed.

The following inputs are available in the factory settings:

Pin Name
39 DIO1
42 DIO2
41 DIO3
44 DIO4
43 DIO5
46 DIO6
45 DIO7
47 DIO9
50 DIO10
19 DIO11
56 DIO12
21 DIO13
29 DIO14

Object entries

The value of an input can be manipulated using the following OD settings, whereby only the corresponding bit acts on the input here.

  • 3240h:01h (Special Function Enable): This bit allows special functions of an input to be switched off (value "0") or on (value "1"). If input 1 is not used as, e. g., a negative limit switch, the special function must be switched off to prevent an erroneous response to the signal generator. The object has no effect on bits 16 to 31.

    The firmware evaluates the following bits:

    If, for example, two limit switches and one home switch are used, bits 0–2 in 3240h:01h must be set to "1".

    Note: Because the Input Routing (see following chapter) is activated in the factory settings, object 3240h:01h has no function in this controller. To use the special functions, configure the source for bits 0 to 3 of 60FDh in 3242h:01h to :04h according to your cabling.
  • 3240h:02h (Function Inverted): This subindex switches from normally open logic (a logical high level at the input yields the value "1" in object 60FDh) to normally closed logic (the logical high level at the input yields the value "0").

    This applies for the special functions (except for the clock and direction inputs) and for the normal inputs. If the bit has the value "0", normally open logic applies; for the value "1", normally closed logic applies. Bit 0 changes the logic of input 1, bit 1 changes the logic of input 2, etc.

  • 3240h:03h (Force Enable): This subindex switches on the software simulation of input values if the corresponding bit is set to "1".

    In this case, the actual values are no longer used in object 3240h:04h, but rather the set values for the respective input. Bit 0 corresponds to input 1 here, bit 1 to input 2, etc.

  • 3240h:04h (Force Value): This bit specifies the value that is to be read as the input value if the same bit was set in object 3240h:03h.

  • 3240h:05h (Raw Value): This object contains the unmodified input value.

  • 60FDh (Digital Inputs): This object contains a summary of the inputs and the special functions.

Computation of the inputs

Computation of the input signal using the example of input 1:

The value at bit 0 of object 60FDh is interpreted by the firmware as negative limit switch; the result of the complete computation is stored in bit 16.

Input Routing

Principle

To perform the assignment of the inputs more flexibly, there is a mode called Input Routing Mode. This assigns a signal of a source to a bit in object 60FDh.

Activation

This mode is activated by setting object 3240h:08h (Routing Enable) to "1" (this is the case in the factory setting).

Note: Entries 3240h:01h to 3240:04h then have no function until Input Routing is again switched off.
Note: If Input Routing is switched on, the initial values of 3242h are changed and correspond to the function of the input as it was before activation of Input Routing. The inputs of the controller behave the same with activation of Input Routing. Therefore, you should not switch back and forth between the normal mode and Input Routing.

Routing

Object 3242h determines which signal source is routed to which bit of 60FDh. Subindex 01h of 3242h determines bit 0, subindex 02h determines bit 1, and so forth. The signal sources in the factory settings and their numbers can be found in the following lists.

Note: If you deactivate the Input Routing, bits 16 to 31 correspond to the first 16 subindices in the table of alternative functions.
Number
dec hex Signal source
00 00 Signal is always 0
01 01 ANA1 (Pin 4)
02 02 ANA2 (Pin 6)
03 03 H1 (Pin 18)
04 04 DIO11 (Pin 19)
05 05 H2 (Pin 20)
06 06 DIO13 (Pin 21)
07 07 H3 (Pin 22)
08 08 ENC1B (Pin 23)
09 09 ENC1A (Pin 24)
10 0A SSI1_MISO (Pin 25)
11 0B ENC1I (Pin 26)
12 0C SSI1_CLK (Pin 27)
13 0D DIO14 (Pin 29)
14 0E DIO1 (Pin 39)
15 0F DIO3 (Pin 41)
16 10 DIO2 (Pin 42)
17 11 DIO5 (Pin 43)
18 12 DIO4 (Pin 44)
19 13 DIO7 (Pin 45)
20 14 DIO6 (Pin 46)
21 15 DIO9 (Pin 47)
22 16 BRAKE (Pin 48)
23 17 DIO10 (Pin 50)
24 18 DIO12 (Pin 56)
65 41 Hall input "U"
66 42 Hall input "V"
67 43 Hall input "W"
68 44 Encoder input "A"
69 45 Encoder input "B"
70 46 Encoder input "Index"

The following table describes the inverted signals of the previous table.

Number
dec hex Signal source
128 80 Signal is always 1
129 81 Inverted ANA1 (Pin 4)
130 82 Inverted ANA2 (Pin 6)
131 83 Inverted H1 (Pin 18)
132 84 Inverted DIO11 (Pin 19)
133 85 Inverted H2 (Pin 20)
134 86 Inverted DIO13 (Pin 21)
135 87 Inverted H3 (Pin 22)
136 88 Inverted ENC1B (Pin 23)
137 89 Inverted ENC1A (Pin 24)
138 8A Inverted SSI1_MISO (Pin 25)
139 8B Inverted ENC1I (Pin 26)
140 8C Inverted SSI1_CLK (Pin 27)
141 8D Inverted DIO14 (Pin 29)
142 8E Inverted DIO1 (Pin 39)
143 8F Inverted DIO3 (Pin 41)
144 90 Inverted DIO2 (Pin 42)
145 91 Inverted DIO5 (Pin 43)
146 92 Inverted DIO4 (Pin 44)
147 93 Inverted DIO7 (Pin 45)
148 94 Inverted DIO6 (Pin 46)
149 95 Inverted DIO9 (Pin 47)
150 96 Inverted BRAKE (Pin 48)
151 97 Inverted DIO10 (Pin 50)
152 98 Inverted DIO12 (Pin 56)
193 C1 Inverted Hall input "U"
194 C2 Inverted Hall input "V"
195 C3 Inverted Hall input "W"
196 C4 Inverted encoder input "A"
197 C5 Inverted encoder input "B"
198 C6 Inverted encoder input "Index"

Example

Input 1 should be routed to bit 0 of object 60FDh in order to be used as a negative limit switch.

  1. To activate the Input Routing, set 3240h:08h to "1" (already set in the factory settings).
  2. To route input 1 (DIO1) to bit 0, set 3242h:01h to "14".

Interlock function

The interlock function is a release that you control via bit 3 in 60FDh. If this bit is set to "1", the motor can move. If the bit is set to "0", the controller switches to the error state and the action stored in 605Eh is executed.

Use Input Routing to define which signal source is routed to bit 3 of 60FDh and is to control the interlock function.

Example

Input 4 is to be routed to bit 3 of object 60FDh to control the interlock function. A low level is to result in an error state.

  1. To activate the Input Routing, set 3240h:08h to "1" (already set in the factory settings).
  2. To route input 4 (DIO4) to bit 3, set 3242h:04h to "18".

Digital outputs

Outputs

The outputs are controlled via object 60FEh. Here, output 1 corresponds to bit 16 in object 60FEh, output 2 corresponds to bit 17, etc., as with the inputs. The outputs with special functions are again entered in the firmware in the lower bits 0 to 15. The only bit assigned at the present time is bit 0, which controls the motor brake.

You must have first defined the desired pins as output, see Defining input and output assignments.

Wiring

The digital outputs have a digital level of 3.3 V DC. The maximum admissible current is approx. 10 mA.

Object entries

Additional OD entries are available for manipulating the value of the outputs (see the following example for further information). As with the inputs, only the bit at the corresponding location acts on the respective output:

  • 3250h:01h: No function.

  • 3250h:02h: This is used to switch the logic from normally open to normally closed. Configured as normally open, the output outputs a logical high level if the bit is "1". With the normally closed configuration, a logical low level is output accordingly for a "1" in object 60FEh.

  • 3250h:03h: If a bit is set here, the output is controlled manually. The value for the output is then in object 3250h:4h; this is also possible for the brake output.

  • 3250h:04h: The bits in this object specify the output value that is to be applied at the output if manual control of the output is activated by means of object 3250h:03h.

  • 3250h:05h: The bit combination applied to the outputs is stored in this subindex.

  • 3250h:08h: For activating the Output Routing.

  • 3250h:09h: For switching control of the Power LED on/off. If bit 0 is set to "1", the green LED is activated (flashes in normal operation). If bit 1 is set to "1", the red LED is activated (flashes in case of an error). If the bit is set to "0", the respective LED remains off.

Computation of the outputs

Example for calculating the bits of the outputs:



Output Routing

Principle

The "Output Routing Mode" assigns an output a signal source; a control bit in object 60FEh:01h switches the signal on or off.

The source is selected with 3252h:01 to n in the "high byte" (bit 15 to bit 8). The assignment of a control bit from object 60FEh:01h is performed in the "low byte" (bit 7 to bit 0) of 3252h:01h to n (see following figure).

Activation

This mode is activated by setting object 3250h:08h (Routing Enable) to "1" (this is the case in the factory setting).

Note: Entries 3250h:01h to 3250:04h then have no function until Output Routing is again switched off.

Routing

The subindex of object 3252h determines which signal source is routed to which output. The output assignments are listed in the following:

Subindex 3252h Output Pin
01h Configuration of output 1 (pin 4)
02h Configuration of output 2 (pin 6)
03h Configuration of output 3 (pin 18)
04h Configuration of output 4 (pin 19)
05h Configuration of output 5 (pin 20)
06h Configuration of output 6 (pin 21)
07h Configuration of output 7 (pin 22)
08h Configuration of output 8 (pin 23)
09h Configuration of output 9 (pin 24)
0Ah Configuration of output 10 (pin 25)
0Bh Configuration of output 11 (pin 26)
0Ch Configuration of output 12 (pin 27)
0Dh Configuration of output 13 (pin 29)
0Eh Configuration of output 14 (pin 39)
0Fh Configuration of output 15 (pin 41)
10h Configuration of output 16 (pin 42)
11h Configuration of output 17 (pin 43)
12h Configuration of output 18 (pin 44)
13h Configuration of output 19 (pin 45)
14h Configuration of output 20 (pin 46)
15h Configuration of output 21 (pin 47)
16h Configuration of output 22 (pin 48)
17h Configuration of output 23 (pin 50)
18h Configuration of output 24 (pin 56)
Note: The maximum output frequency of the PWM output (software PWM) is 2 kHz. All other outputs can only produce signals up to 500 Hz.

Subindices 3252h:01h to 0nh are 16 bits wide, whereby the high byte selects the signal source (e. g., the PWM generator) and the low byte determines the control bit in object 60FEh:01.

Bit 7 of 3252h:01h to 0nh inverts the controller from object 60FEh:01. Normally, value "1" in object 60FEh:01h switches on the signal; if bit 7 is set, the value "0" switches on the signal.

Tip: To deactivate routing, enter the value FFFFh.
Number in 3252:01 to 0n
00XXh Output is always "1"
01XXh Output is always "0"
02XXh Encoder signal (6063h) with frequency divider 1
03XXh Encoder signal (6063h) with frequency divider 2
04XXh Encoder signal (6063h) with frequency divider 4
05XXh Encoder signal (6063h) with frequency divider 8
06XXh Encoder signal (6063h) with frequency divider 16
07XXh Encoder signal (6063h) with frequency divider 32
08XXh Encoder signal (6063h) with frequency divider 64
09XXh Position Actual Value (6064h) with frequency divider 1
0AXXh Position Actual Value (6064h) with frequency divider 2
0BXXh Position Actual Value (6064h) with frequency divider 4
0CXXh Position Actual Value (6064h) with frequency divider 8
0DXXh Position Actual Value (6064h) with frequency divider 16
0EXXh Position Actual Value (6064h) with frequency divider 32
0FXXh Position Actual Value (6064h) with frequency divider 64
10XXh PWM signal that is configured with object 2038h (brake output)
11XXh Inverted PWM signal that is configured with object 2038h (brake output)
12XXh PWM signal that is configured with object 3260h
13XXh PWM signal that is configured with object 3261h
Note:

On any change of the "encoder signal" (6063h) or the current position (6064h in user-defined units) by an increment, a pulse is output at the digital input (for frequency divider 1). Take this into account when selecting the frequency divider and the unit, especially when using sensors with low resolution (such as Hall sensors).

Example

The encoder signal (6063h) is to be applied to output 1 with a frequency divider 4. The output is to be controlled with bit 5 of object 60FE:01.

  • 3250h:08h = 1 (activate routing)
  • 3252h:02h = 0405h (04XXh + 0005h)
  • 04XXh: Encoder signal with frequency divider 4
  • 0005h: Selection of bit 5 of 60FE:01

The output is switched on by setting bit 5 in object 60FE:01.

Example

The brake PWM signal is to be applied to output 2. Because the automatic brake control uses bit 0 of 60FE:01h, this should be used as control bit.

  • 3250h:08h = 1 (activate routing)
  • 3252h:03h = 1080h (=10XXh + 0080h). Where:
    • 10XXh: Brake PWM signal
    • 0080h: Selection of the inverted bit 0 of object 60FE:01

Virtual encoder output

You have the option of outputting the actual position via two pins of the controller and passing it on to your PLC or another controller. The maximum frequency here is 200 kHz.

Activating the function of the pins

To activate the function, set 2372h:0Eh and 2372h:10h to "1152".

See also Defining input and output assignments.

Selecting the type of output signals

You can select one of the following types in object 205Ch02h:

  • Value "0": two 90° phase-shifted channels on channel A (leading when moving in the positive direction) and B, analogous to an incremental encoder
  • Value "1": a clock and direction signal on channel A and B, analogous to the signals in Clock-direction mode
  • Value "2": two clock signals, analogous to the signals in Right / left rotation mode (CW / CCW mode)

Selecting the source of the position data

The position data of one of the existing feedbacks are reproduced via the encoder output.

To select the source, set bit 3 in the corresponding subindex of object 3203h to "1". If you do not set a bit, the value from 205C:01h is used.

Setting the resolution of the output signals

Define the conversion of source signal into virtual encoder signals via the numerator in 205C:03h and the denominator in 205C:04h.

▶   next

Contents