NP5 CANopen Online Manual

Digital inputs and outputs

This controller is equipped with 6 digital I/O pins. Of these, 4 can be configured as either input or output. Pins DIO5_IO_MISO and DIO6_IO_CLK are preset as inputs.

Defining input and output assignments

Digital inputs/outputs 1…4 can be freely assigned on the PCI connector strip of the device, see also Pin assignment and 3231h Flex IO Configuration.

  • Pin 1: DIO1_IO_CS
  • Pin 2: DIO2_CD_CLK
  • Pin 3: DIO3_CD_DIR
  • Pin 4: DIO4_IO_MOSI
  • Subindex 03h Alternate Function Mask: This bit mask defines whether the alternative function of the pin is to be activated.

    To activate an alternative function, set the corresponding bit to "1":

    Bit Pin Alternative function
    1 DIO2_CD_CLK Clock input in clock-direction mode
    2 DIO3_CD_DIR Direction input in clock-direction mode
    Note:

    If you do not activate the alternative function, you can no longer use the corresponding pin as a normal input/output.

    If the Clock-direction mode is activated, the pins for clock and direction are automatically configured accordingly and the settings in 3231h are overwritten.

  • Subindex 01h Output Mask: This bit mask defines whether the pin is used as input or output (depending on whether an alternative function was activated for the pin in subindex 03h):
    • Bit = "0": Pin is input (default)
    • Bit = "1": Pin is output
  • Subindex 02h Pullup Mask: This bit mask defines whether the pin is a pullup or pulldown:

    • Bit = "0": Pin is pulldown (default)
    • Bit = "1": Pin is pullup

    Subindex 02h is only active for the pin if it is defined as an input.

Example for subindex 01h: Pin 2 and pin 3 are to be outputs, value = "6" (=0110 b)

  1. Check which of the pins you would like to assign an alternative function to and set the corresponding bits in 3231h:03h to "1".
  2. Determine which pins you would like to define as input or output.
  3. Determine which inputs you would like to define as pull down or pull up.
  4. Set the values in 3231h:01h and 3321h:02h accordingly.
  5. Store the object by writing the value "65766173h" in 1010h:03h (see chapterSaving objects) and restart the controller.

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.

Tip: The first 4 I/O pins can also be configured as outputs, see Defining input and output assignments. If these are configured as outputs, the current status can still be read back in bits 16 to 19 of object 60FDh. The assignment of the bits in 60FDh thereby remains unchanged; bit 20 corresponds to input 5 and bit 21 to input 6.

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:

PIN/input Name for Input Routing
B3/DIO1_IO_CS physical input 1
B4/DIO2_CD_CLK physical input 2
B5/DIO3_CD_DIR physical input 3
B6/DIO4_IO_MOSI physical input 4
B7/DIO5_IO_MISO physical input 5
B8/DIO6_IO_CLK physical input 6

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".

  • 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" .

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 and their numbers can be found in the following lists.

Number
dec hex Signal source
00 00 Signal is always 0
01 01 Physical input 1
02 02 Physical input 2
03 03 Physical input 3
04 04 Physical input 4
05 05 Physical input 5
06 06 Physical input 6
07 07 Physical input 7
08 08 Physical input 8
09 09 Physical input 9
10 0A Physical input 10
11 0B Physical input 11
12 0C Physical input 12
13 0D Physical input 13
14 0E Physical input 14
15 0F Physical input 15
16 10 Physical input 16
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 physical input 1
130 82 Inverted physical input 2
131 83 Inverted physical input 3
132 84 Inverted physical input 4
133 85 Inverted physical input 5
134 86 Inverted physical input 6
135 87 Inverted physical input 7
136 88 Inverted physical input 8
137 89 Inverted physical input 9
138 8A Inverted physical input 10
139 8B Inverted physical input 11
140 8C Inverted physical input 12
141 8D Inverted physical input 13
142 8E Inverted physical input 14
143 8F Inverted physical input 15
144 90 Inverted physical input 16
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 is to be routed to bit 16 of object 60FDh:

The number of the signal source for input 1 is "1". The routing for bit 16 is written in 3242h:11h.

Hence, object 3242h:11h must be set to the value "1".

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.

To activate the interlock function, you must switch on the special function by setting bit 3 in 3240:01h to "1".

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 Input Routing, set 3240h:08h to "1".
  2. To route input 4 to bit 3, set 3242h:04h to "4".

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 first 4 I/O pins can be configured as outputs, see Defining input and output assignments. 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.

Wiring

Note: Always observe the maximum capacity of the output (see Pin assignment).

The digital outputs, with the exception of the brake output, have a digital level of 3.3 V DC. The maximum admissible current is 10 mA.

The brake output is implemented as open drain. Hence, an external voltage supply as shown in the following figure is always necessary. See also Automatic brake control.

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".

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 the PWM output (software PWM)
02h Configuration of output 1
03h Configuration of output 2 (if available)
0nh Configuration of output n (if available)
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:05h and 06h
11XXh Inverted PWM signal that is configured with object 2038h:05h and 06h
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
▶   next

Contents