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
- 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 modeNote:
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)
- Check which of the pins you would like to assign an alternative function to and set the corresponding bits in 3231h:03h to "1".
- Determine which pins you would like to define as input or output.
- Determine which inputs you would like to define as pull down or pull up.
- Set the values in 3231h:01h and 3321h:02h accordingly.
- Store the object by writing the value "65766173h" in 1010h:03h (see chapterSaving objects) and restart the controller.
- 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.
- The second bit shows the output/input as a level; these are then available on bits 16 to 31.
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.
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|
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:
- Bit 0: Negative limit switch (see Limitation of the range of motion)
- Bit 1: Positive limit switch (see Limitation of the range of motion)
- Bit 2: Home switch (see Homing)
- Bit 3: Interlock (see interlock function)
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: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.
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.
This mode is activated by setting object 3240h:08h (Routing Enable) to "1" .
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.
|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.
|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"|
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".
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.
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.
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.
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.
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:05h: The bit combination applied to the outputs is stored in this subindex.
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:
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).
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)|
|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|
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).
The output is switched on by setting bit 5 in object 60FE:01.
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.