Bring Values and Sucesses To Our Customers

Home / Support and services / Technical Support

Technical support

Technical Support

Zmotion Motion Controller Position Latch Function

In motion control solutions, latch function is usually required.

Today, Zmotion brings “Motion Controller Position Latch” function for you, there are several latch modes, you can select flexibly according to your specific requirements. In this article, take Zmotion motion controller ZMC408CE (a video description for ZMC408CE) as an example to share latch related knowledge with you.



1
What is Latch Function?

The function of the latch is to respond immediately when the external IO signal is triggered, then lock the current position of the motor/encoder. It is usually used to latch the position of the product when the optical fiber sensor is encountered on the assembly line, and lock the position of the color mark on the packaging material.

1.png

(1) Characteristics of Latch

-- it supports latching encoder axis, bus axis, pulse axis and virtual axis (different types of controllers support different types of axes for latching).

--there are single latch and high-speed continuous latch modes.

-- it supports 4-channel simultaneous latching , which are R0, R1, R2, and R3 four latching channels respectively, and up to 8 latch ports can be latched at the same time, latch respond speed is fast.

-- the value of MPOS is latched when there is encoder feedback, and the value of DPOS is latched when there is no encoder feedback.

Please note different models controllers support different latching channel numbers, for specific  information, refer to the corresponding hardware manual.

Here, take motion controller ZMC408CE as the example.

ZMC408CE motion controller supports 4 latching channels, relevant interfaces are IN0-IN3.

For communication interfaces, ZMC408CE include RS232, RS485, EtherNET, CAN bus, EtherCAT bus and U disk interface, and there are 8 differential pulse output interfaces on board (including encoder input), 1 dedicated handwheel interface and AD/DA analog interface.  

2.png

ZMC408CE motion controller supports EtherCAT bus connection, and the refresh cycle can be up to 500us. In addition, it supports rich motion control functions with 32 axes motion control at most (8-axis pulse axis + EtherCAT axis / encoder axis / virtual axis), for example, linear interpolation, any circular interpolation, space arc, helical interpolation, electronic cam, electronic gear, synchronous follow, virtual axis setting, etc. What's more, real-time motion control can be achieved through optimized network communication protocol.

ZMC408CE not only supports 8-channel PWM output , but also supports hardware comparison output, hardware timer and precision output in motion .

3.png


(2) Steps to Latch

--Usage of Latch--

a. to determine whether the current hardware conditions meet the latching requirements , it is necessary to determine the axis of the latching position, and the IO signal should be connected to the input port IN that supports latching.

b. set the latch input mapping port REG_INPUT , the function is to map the latched channel R0/R1/R2/R3 to the physical input port IN, and the input port needs to support the latch function.

c. set the latch mode through REGIST , which needs to be selected according to the type of the latched axis.

d. wait for the latch to trigger MARK / MARKB / MARKC / MARKD, when the latch is triggered, it becomes true.

e. after the latch is completed, print the latch position information REG_POS / REG_POSB / REG_POSC / REG_POSD.

f. the starting and ending coordinates of the latched position can be read , and the latched position can be called by other commands.

--Latch Related Commands--

4.png

REG_INPUTS -- Map latch input

REGIST -- Set latch mode

MARK/MARKB/MARKC/MARKD -- Judge whether latch is triggered

REG_POS/REG_POSB/REG_POSC/REG_POSD -- store position after latched

When the latch occurs, the MARK / MARKB / MARKC / MARKD corresponding to the latch channel will be set to ON, and the latched position will be stored in the parameter REG_POS / REG_POSB / REG_POSC / REG_POSD.


(3) Map Latch Input (REG_INPUTS) Description

REG_INPUTS mapping rules are as follows, the setting of REGIST latch mode needs to be set in conjunction with REG_INPUTS.

5.png

For example:

REG_INPUTS = $3210, which means R3, R2, R1 and R0 correspond to IN3, IN2, IN1 and IN 0 respectively.

REG_INPUTS = $1023, which means R3, R2, R1 and R0 correspond to IN1, IN0, IN2 and IN 3 respectively.

REG_INPUTS = $1000, which means R3, R2, R1 and R0 correspond to IN1, IN0, IN0 and IN 0 respectively.

In this way, R0, R1, R2 and R3 signals matched by REGIST mode are not physical IO channel, but it can brings flexibility.

Actually, the output signal R0 can be relative to any one of IN(0)...IN(7) on the device (the optional input channel must be the latch channel specified in the hardware manual), or both R0 and R3 correspond to the same input port.


(4) REG_POS Latch Position Description

The local IO used can latch the mapping of the channel through REG_INPUTS . Please note the data storage locations of different latch signal channels are different, as shown in the table below. For details, refer to the description of the REGIST instruction.  

6.png




2
Latch Mode -- REGIST

As mentioned above, latch mode is set through REGIST, that is, select suitable latch mode according to axis type that is to be latched . There are single-time latch and continuous latch .

Therefore, different latch methods are with different trigger marks for latch signals, and latched position data are stored into different positions.

Latch channel supported by different axis types:

--encoder axis and pulse axis with feedback are latched by R0, R1, and Z pulse.

--the pulse axis and virtual axis without feedback are latched by R0 and R1.

--EtherCAT or RTEX bus axis types are latched by R2 and R3.

In addition, the EtherCAT bus can use the drive's own latch mode. For details, refer to the drive manual.


(1) Single-time Latch

REGIST(mode)

7.png

Note: rising edge and falling edge correspond to hardware state of controller inside.For ZMC series motion controller, it is valid when in OFF state, so falling edge is from without signal to with signal. For ECI series motion controller, it is valid when in ON state, rising edge is from without signal to with signal.

It is recommended to test the regist edge through below simple routine, then apply into project.


(2) Continuous Latch

Continuous latching is supported by adding 100 to the mode, and the latching result is stored in TABLE.

REGIST(100+mode, tableindex, numes)

mode: latch mode.

tableindex: the table position where the content of the continuous latch is stored. The first table element stores the number of latches, and the coordinates of the latches are stored later. The number of max stored = numes -1, when it exceeds, write in cycle.

numes: the number of tables occupied.

The continuous latch mode performs continuous latching on the two channels respectively, which can realize continuous latching of the upper and lower edges.

(ECI20150829 and above firmware support, 4 series controller 20170523 and above firmware support)

100+mode: only a single channel mode can be used, adding 100 means using continuous latch.

8.png



3
Latch Routines

(1) Latch for Pulse-axis (without feedback) / Virtual-axis

It can use R0 or R1 channel, ATYPE=1/7 is set as pulse-axis, ATYPE=0 means virtual axis, then MPOS value is latched (no measurement, MPOS is false, then copy DPOS), when it is with feedback, real MPOS value measured by encoder is latched. If supports Z signal, Z signal mode also can be used.

Reference configuration:

9.png

Routine:

10.png

It can be seen from the waveform, IN(0) has signal to trigger latch, and REGIST(4) takes effect to latch current DPOS position then store it into REG_POS.

11.png

Modify the mode as REGIST(3), others are the same.

12.png


(2) Latch for Pulse-axis (with feedback) / Encoder-axis

It can use R0, R1 or Z channels (it is only valid in equipment that is with Z signal), when ATYPE is set to 4 or 5, which means pulse-axis, when it is 3 or 6, which means MPOS value is latched.

Routine:

13.png

It can be seen from the waveform, IN(0) has signal to trigger latch, at this time, latch current DPOS position then store it into REG_POS.

14.png


(3) Latch Multi-axis Position

When multi-axis position is latched, it needs to set latch for each axis separately. In below interpolation, there are 2 axes' positions are latched.

Routine:

15.png

16.png

Note: when multi-axis use same one latch hardware input port, same latch R channel needs to be used (for example, mode 3 / mode 4). when use different R-channel, it needs to map into different hardware inputs.


(4) Continuous Latch Mode

The position after the continuous latch signal is triggered. The above axis types all support the continuous latch mode. It is recommended to open a separate task to execute the continuous latch program without interfering with the operation of other programs. And the latching times and the position data can be read at any time through the TABLE register.

Routine:

17.png

The position data of continuous latch captured by oscilloscope: no need WHILE loop, continuous latch can be achieved.

18.png

Read latching times and position data through register:

19.png


(5) Latch Bus Driver

R2 and R3 channels can be used. It supports pulse-axis by setting ATYPE as 4/5, and it supports both EtherCAT and RTEX bus by setting ATYPE as 65/50, then latch MPOS value.

Using the EtherCAT bus driver, latch mode provided by the controller can be used , and the configuration method is similar to the above. Also, the latch mode that comes with the EtherCAT bus driver can be used (refer to the driver manual to complete the configuration).

When using the latch mode that comes with the EtherCAT bus driver, select the probe that the driver supports latch, and then access the latch signal.

Note: the drive PDO needs to contain the 60b8h latched data dictionary, and DRIVE_PROFILE directly selects the mode test with latch.

The latch mode adopts the mode provided by REGIST (test which modes support is required). After triggering the driver to latch, the driver will automatically transfer the latch position to the corresponding REG_POS / REG_POSB / REG_POSC / REG_POSD, and then the corresponding MARK becomes true, the user does not need to get the information from the driver data dictionary.

Routine:

20.png

Use the continuous latch mode REGIST(100+3,0,100), and use 100 spaces starting from TABLE(0) to save the latch data, where TABLE(0) saves the number of consecutive latches, TABLE(1)- TABLE(99) save the position of each latch.

21.png

22.png



ABOUT ZMOTION

That's all, thank you for your reading -- Zmotion Motion Controller Position Latch Function

For more information, please pay close attention to "Support"  and   "Download" , and there are other platforms about Zmotion - Youtube   &   LinkedIn   &   Twitter    &   Tiktok    &   Facebook including technical information (development environment, routine code), product showing, company development, etc.

Hope to meet you, talk with you and be friends with you.  Welcome!

This article is edited by ZMOTION, here, share with you, let's learn together.

ZMOTION: DO THE BEST TO USE MOTION CONTROL.

Note: Copyright belongs to Zmotion Technology, if there is reproduction, please indicate article source. Thank you.

Zmotion Technology focuses on development of motion control technology and general motion control products, it is a national high and new technology enterprise. Due to its concentration and hard work in motion control technology, ZMOTION already become one of the fastest growing industrial motion control companies in China, and is also the rare company who has managed core technologies of motion control and real time industrial control software completely. Here, Zmotion provides motion controller, motion control card, vision motion controller, expansion module and HMI. In addition, there is one program software developed by Zmotion -- ZDevelop. It is a good choice for you to program and compile. And program through upper computer, there is PC manual.

Zmotion Technology provides motion control card, motion controller, vision motion controller, expansion module and HMI. ( more keywords   for Zmotion: EtherCAT motion control card, EtherCAT motion controller, motion control system, vision controller, motion control PLC, robot controller, vision positioning...)

Have a good day, best wishes, see you next time.

2013-2023 版权所有 Zmotion Corp. Copyright Reserved 粤ICP备13037187号-1