Previously, Zheng Motion Technology shared with everyone the firmware upgrade of motion controllers, ZBasic program development, ZPLC program development, application of communication with touch screens and input/output IO, application of motion controller data and storage, and the use of motion controller ZCAN and EtherCAT buses.
Today, we will explain the application of the motion controller oscilloscope in positive motion technology.
Tutorial video link: " Video Tutorial: Multi-tasking Features of Motion Controllers"
1. Material preparation and controller wiring reference
Materials preparation:
1) One computer with ZDevelop version 3.10.00 software installed.
2) One controller
3) One 24V DC power supply
4) Several bus drivers + motors (or stepper drivers + motors)
5) Several controller wiring terminals
6) Several network cables
7) Several connecting wires
Additionally: I/O devices, extension templates, touch screens, etc., can be selected according to requirements.
Controller wiring reference:
2. Oscilloscope Functions
An oscilloscope is an extremely important part of program debugging and running. It is used to convert signals that are invisible to the naked eye into graphics, making it easier to study the process of various signal changes.
An oscilloscope uses data processed internally by a controller to display the data graphically. It can display various signals, such as axis parameters and axis status. Open the oscilloscope window by going to "View" -> "Oscilloscope" or by clicking the shortcut button in the menu bar.
The oscilloscope must be started before it can be triggered for successful sampling. After opening the oscilloscope and setting the relevant parameters, click start. You can manually trigger sampling, or add the "TRIGGER" command in the program to automatically trigger the oscilloscope sampling.
Oscilloscope sampling diagram
3. Basic Oscilloscope Settings
Oscilloscope settings panel
1) Settings: Open the oscilloscope settings window and set the relevant parameters of the oscilloscope.
2) Startup: Start the oscilloscope (but do not start oscilloscope sampling).
3) Stop: Stop the oscilloscope sampling.
4) XY Mode: When checked, it switches to displaying the interpolation composite trajectory of the two axes in the XY plane.
5) <<: Press to hide the channel name and peak value, only display the channel number.
6) Manual Trigger: Manually trigger the oscilloscope sampling button.
7) Follow: When Follow is enabled, the horizontal axis will automatically move to the real-time sampling point and follow the waveform display.
8) Display: Select whether to display the current channel curve.
9) Number: Select the data source number to be collected, such as axis number, digital IO number, analog IO number, TABLE number, VR number, MODBUS number, etc.
10) Data source: Select the data type to capture from the drop-down menu. Multiple type parameters are available.
11) Offset: Waveform vertical axis offset setting.
12) Scale: One division on the vertical axis.
13) Horizontal scale: The scale of one division on the horizontal axis.
4. Oscilloscope parameter settings
To configure oscilloscope parameters, such as axis numbering, data source, and to open the oscilloscope settings window, you must first stop the oscilloscope. Click the "Settings" button to bring up the "Oscilloscope Settings" window as shown below.
Oscilloscope parameter setting panel
1) Number of channels: The total number of channels to be sampled.
2) Depth: The total number of data samples taken. The greater the depth, the larger the sampling range.
3) Interval: The sampling time interval, measured in system cycles. It depends on the controller firmware version and is generally 1ms by default. This can be checked using the command `SERVO_PERIOD`. Generally, a smaller interval results in more accurate sampling data and a larger amount of data per unit time.
4) TABLE location: Sets the location where the captured data is stored. By default, it automatically uses the space at the end of the TABLE data. You can also customize the configuration, but be careful not to let it overlap with the TABLE data area used by the program.
5) Background color/channel color: Sets the background color corresponding to the waveform of each channel.
6) Display type: Two curve types are available: point and line segment. Line segments make it easier to identify data anomalies.
7) Continuous acquisition: When continuous acquisition is not enabled, sampling will stop after reaching the sampling depth. When continuous acquisition is enabled, the oscilloscope will continuously sample.
8) Export parameters: Check this box when you need to export oscilloscope data.
5. Oscilloscope data import and export
1) Import
The oscilloscope must be stopped before data can be imported and the sampled waveform can be reproduced.
Methods for importing sampled data:
Click "Import", select the data file type previously exported from the oscilloscope, and then open it.
2) Export
The exported parameters display the oscilloscope settings, as well as the data types of each channel and the data for each sampling point.
Methods for exporting sampled data:
First, check "Export Parameters" in the settings, start the oscilloscope sampling, and after sampling is complete, click "Export". Select a folder to save the oscilloscope data. The exported data format is shown in the figure.
Export data format
6. Using an oscilloscope
1) Oscilloscope sampling method
A. Open the project, connect the controller or simulator, and then open the oscilloscope window (you need to connect to the controller or simulator before you can operate the oscilloscope window).
B. In the oscilloscope window, click "Settings", select the number of sampling channels, sampling depth, sampling interval, storage location of the sampling data TABLE (generally, the end space of the TABLE array can be used automatically), and sampling type, etc. After setting, confirm and save the current settings.
C. Next, select the sampling data number and data source, and click the "Start" button.
D. Download the program to the controller and run it. The program needs to include the TRIGGER automatic oscilloscope sampling command. At this time, the oscilloscope starts sampling and displays waveforms from different data sources. The display scale and waveform offset can be adjusted for easy observation of different waveforms.
E. If the waveform accuracy is not high or the display is incomplete, you can click the "Stop" button and then open "Settings" to adjust the sampling interval and sampling depth before re-executing the above sampling process.
2) Precautions for using oscilloscopes
The location for storing the captured data is set. By default, the space at the end of the TABLE data is used automatically. In this case, the starting space address is automatically calculated based on the space occupied by the sampled data.
Calculation method: Sampling data space occupied = number of channels * depth
Example: If the controller's TABLE space size is 320000, with 4 channels and a depth of 30000.
Each sampling point occupies one TABLE, so it will occupy 4 * 30000 = 120000 TABLE positions. 320000 - 120000 = 200000, so the starting position of the TABLE is 200000.
The location where the data is stored can also be customized. If the number of channels and depth are set as above, the initial TABLE space cannot exceed 200,000, otherwise it cannot be set, as shown in the figure below.
The space occupied by the oscilloscope sampling data should not overlap with the TABLE data area used by the program.
The size of the controller TABLE space can be read using the TSIZE command, viewed in the "Controller Status" window, or printed using the online command ?*max.
7. Differences in oscilloscope display types
The oscilloscope sampling curve display types are divided into two categories: points and line segments.
Point: A series of sampling points acquired by an oscilloscope at fixed intervals, as shown in the figure below.
Oscilloscope sampling curve display type: Point sampling display graph
Line segment: Connect the sampling points into a smooth line segment for display, as shown in the figure below. Line segments make it easier to identify data anomalies. It is generally recommended to display data as line segments in situations where there are large fluctuations.
Oscilloscope sampling curve display type: line segment sampling display graph
8. Oscilloscope sampling
Continuous data acquisition:
When continuous sampling is not selected, the oscilloscope will automatically stop sampling after reaching the sampling depth.
In the oscilloscope's "Settings", check "Continuous Acquisition" and then turn on the oscilloscope. After the oscilloscope triggers sampling, it will continue to sample even after reaching the sampling depth, until the "Stop" button is pressed to stop sampling.
All waveform sampling data acquired continuously can be exported.
Oscilloscope sampling time calculation:
For example, depth: 10000, interval: 5
If the system period SERVO_PERIOD=1000, which is a 1ms trajectory planning period, and the interval 5 means that a data point is collected every 5ms, a total of 10,000 data points are collected, and the collection time is 50s.
9. Oscilloscope XY mode
The XY mode supports displaying the interpolated composite trajectory of two axes. When the XY mode is not selected, time is displayed on the horizontal axis, and the vertical axis displays the data values.
The wave pattern is displayed in pairs: curves 1 and 2 are a pair, curves 3 and 4 are a pair, and so on.
Waveforms of motion on each axis
XY mode interpolation synthesis trajectory
10. Oscilloscope-related commands
SCOPE_POS: Read-only parameter, returns the number of points that have been sampled and saved.
SCOPE: Oscilloscope data sampling, saved to TABLE, can sample 8 types of data simultaneously (enable, period, table_start, table_stop, p0 [,p1 [,p2 [,p3 [,p4 [,p5 [,p6 [,p7]]]]]]]).
enable: whether to enable or disable.
period: System cycle, usually 1ms, which can be viewed using SERVO_PERIOD.
table_start: The sampled data is stored at the beginning of the TABLE.
table_stop: The end position of the TABLE, minus the start position, is the number of samples.
p0~p7: Sample data types, equally divided and stored in the TABLE range.
Example:
SCOPE(ON,10,0,1000,DPOS(0),MSPEED(0)) 'Capture DPOS and MSPEED every 10ms and store them in TABLE 0~1000, 0~499 for dpos, and 500~1000 for MSPEED, for a total sampling time of (1000/2)*10=5000ms.
11. Oscilloscope Demonstration Program
1) Continuous trajectory look-ahead application
Waveforms of each parameter
XY mode interpolation synthesis trajectory
2) Electronic cam application
Electronic cam waveform
3) PSO position synchronization output
PSO position synchronization output waveform
That concludes our sharing on the application of motion controller oscilloscopes in positive motion technology. For more exciting content, please follow our official WeChat account.
This article was originally created by Zheng Motion Assistant. We welcome everyone to reprint it for mutual learning and to improve China's intelligent manufacturing capabilities. Copyright belongs to Zheng Motion Technology. Please indicate the source if you reprint this article.