Oscilloscope
Function description of the Oscilloscope structure¶
Oscilloscope is a sophisticated tool for recording up to 32 channels - the values of up to 32 different registers depending on time.
It detects and stores the values of the selected registers in the shared memory TGM_Oscilloscope
at a certain time interval.
The data can then be worked with in other parts of the PLC or in Windows applications.
The TGM_Oscilloscope
shared memory is typically 1 048 576 bytes in size.
The actual size must be found from the value of the TGM_System.HEADER.Mem_Size_OSC
register.
The TGM_Oscilloscope
memory is common to the data of all recorded channels.
When recording the values of one channel, the entire memory is dedicated to it, when recording data of multiple channels, the memory is evenly divided between the individual channels.
The layout of the recorded data in the TGM_Oscilloscope
memory and their offsets are determined by TG Motion; these parameters are stored in the appropriate registers.
Note
The uniformity of the TGM_Oscilloscope memory distribution is related to the number of bytes needed to record the values of each register.
For example, when recording two registers, one of type Long Integer (4 bytes) and the other of type Double (8 bytes), TG Motion divides the shared memory TGM_Oscilloscope
in a 1:2 ratio so that the same number of samples can be recorded for both channels.
Warning
Recording time decreases as the number of recorded channels increases
At the TG Motion level, the data is read and recorded by the Oscilloscope utility into the shared memory TGM_Oscilloscope
after executing Program_04.
This ensures time synchronisation of the recorded values.
However, a read and write does not have to occur every Cycle_Time; the number of Cycle_Time during which a write occurs is determined by the Number_Periods
register.
Note
At the Windows level, Control Observer offers the Oscilloscope utility, in which the recorded data can be displayed in the form of a graph, saved to a file, read back, change the recording and display parameters, or perform your own recording.
Warning
Oscilloscope works as one instance that can be used from both PLC and Control Observer. However, it cannot be used simultaneously from PLC, Control Observer or other applications.
Note
For a detailed description of the Oscilloscope Control Observer utility, see the Control Observer chapter.
Oscilloscope registers and their meaning¶
The registers that the Oscilloscope utility uses to control or store its settings are located in the TGM_System
shared memory starting at offset 4736
.
For clarity, they can be divided into three groups:
- general registers - refer to the settings of the Oscilloscope utility as a whole
- channel registries - only valid for specific channels
- auxiliary registers - contain information about the record
General registers Oscilloscope¶
The general registers are used for general setup and control of the Oscilloscope utility.
Parameter | Description |
---|---|
Control | Used to control the Oscilloscope structure. |
- 0: Not recording or used to stop recording. | |
- >0: Activate a record; triggers a record or wait for a Trigger (depending on the Status register). | |
Status | Displays the status of the Oscilloscope structure. |
- 0: No recording or waiting for Trigger. | |
- 1: Recording in progress. | |
- 2: Waiting for Trigger. | |
Number_Periods | Number of servotics per sample. Specifies the number of Cycle_Time for which one Oscilloscope data record is made. |
Number_Channels | Number of recorded or logged channels. |
Memory_Type_Trigger | Type of shared memory where the trigger register is located. |
- 0: TGM_System | |
- 1: TGM_Data | |
- 2: TGM_Cam_Profile | |
- 3: TGM_Oscilloscope | |
- 4: TGM_Servo | |
- 5: TGM_Dio | |
- 6: TGM_Interpolator | |
- 7: InterpolatorWriteMemory | |
- 8: InterpolatorReadMemory | |
- 9: TGM_ODS | |
- 10: TGM_CNCEX | |
- 11: TGM_GCODE | |
Offset_Trigger | Offset of the trigger register in the memory given by the Memory_Type_Trigger register. |
Mode_Trigger | Trigger algorithm mode. |
- 0: Triggering inactive. | |
- 1: Triggering on the leading edge. | |
- 2: Triggering on the descending edge. | |
Type_Trigger | Trigger register data type. |
Level_Trigger | Trigger register value at which the record is triggered. |
Note
The trigger register can be any shared memory register.
Warning
Although the read trigger register values may not be continuous, the trigger algorithm assumes continuity.
E.g. with Level_Trigger = 20
, Mode_Trigger = 1
and consecutive trigger register values 17 and 22 loaded, it is assumed that the value 20 has already been reached and the Oscilloscope record is triggered.
Principle of operation of utility Oscilloscope¶
If Mode_Trigger = 0, then when the Control > 0 register is set, the Oscilloscope utility starts recording data. The record can be terminated by setting the Control register = 0. If Mode_Trigger > 0, then when the Control register is set to Control > 0, the Oscilloscope utility activates a trigger algorithm that tests and evaluates the trigger register values every Cycle_Time. When the trigger condition is met, data recording is started. The Oscilloscope record can be terminated by setting the Control = 0 register.
Note
If the dedicated TGM_Oscilloscope memory becomes full during Oscilloscope recording, recording stops automatically and the Control and Status registers are set to 0.
Note
For a complete list of all Oscilloscope registers, including descriptions, see. Appendix.
Channel registers¶
These registers determine the parameters related to each channel.
This is the location of the recorded data in the TGM_Oscilloscope
memory, the determination of the data source (memory type and offset) and the data type of the recorded register.
Each channel has the following quartet of registers.
Parameter r | Description |
---|---|
Offset | Offset of recorded channel data in TGM_Oscilloscope memory (allocated by TG Motion). |
Memory_Type_Value | Type of shared memory where the register is located. |
- 0: TGM_System | |
- 1: TGM_Data | |
- 2: TGM_Cam_Profile | |
- 3: TGM_Oscilloscope | |
- 4: TGM_Servo | |
- 5: TGM_Dio | |
- 6: TGM_Interpolator | |
- 7: InterpolatorWriteMemory | |
- 8: InterpolatorReadMemory | |
- 9: TGM_ODS | |
- 10: TGM_CNCEX | |
- 11: TGM_GCODE | |
Offset_Value | Offset of the recorded register in memory given by the Memory_Type_Value value. |
Type_Value | Data type of the logged register. |
- 0-3: Integer 32 bits | |
- 4-7: Integer 64 bits | |
- 8: Double (floating point number of 64 bits) | |
- 9: Float (floating point number of 32 bits) |
Helpful registers¶
Auxiliary registers inform about the recording parameters of the Oscilloscope utility.
- Number_Samples - number of samples available
- Actual_Samples - current number of recorded samples
- Sample_Time - sampling time interval
(Sample_Time = Cycle_Time × Number_Periods) [μs]
Note
The Actual_Samples register is incremented by 1 with each sample while a record is in progress.
When sampling is stopped (e.g. when the Control = 0
register is set), the value of the Actual_Samples
register indicates the last sample performed.
Oscilloscope registers overview and description¶
General registers Oscilloscope
name | access | offset | description | |
Control | RW | 4736 | used to control the Oscilloscope structure 0 - no recording or stopping recording >0 - activating the Oscilloscope record (starts recording or waiting for Trigger) |
|
Status | R | 4740 | Oscilloscope structure state 0 - not recording 1 - recording 2 - waiting for trigger |
|
Number_Periods | RW | 4744 | number of servotics per sample. Specifies the number of Cycle_Time for which one record is made data Oscilloscope | .
|
Number_Channels | RW | 4748 | number of recorded channels | |
Memory_Type_Trigger | RW | 4752 | type of shared memory that contains the trigger register | |
Offset_Trigger | RW | 4756 | offset of trigger register in memory given by Memory_Type_Trigger register | |
Mode_Trigger | RW | 4760 | trigger algorithm mode 0 - trigger inactive 1 - leading edge 2 - trailing edge |
|
Type_Trigger | RW | 4764 | data type of trigger register variable | |
Level_Trigger | RW | 4768 | trigger register value at which the record is triggered |
OSC channel registers -> CHANNEL_00
name | access | offset | description | |
Offset | R | 4776 | offset of recorded channel data in TGM_Oscilloscope memory | |
Memory_Type_Value | RW | 4780 | type of shared memory in which the register being recorded is located 0 - TGM_System 1 - TGM_Data 2 - TGM_Cam_Profile 3 - TGM_Oscilloscope 4 - TGM_Servo 5 - TGM_Dio 6 - TGM_Interpolator 7 - InterpolatorWriteMemory 8 - InterpolatorReadMemory 9 - TGM_ODS 10 - TGM_CNCEX 11 - TGM_GCODE |
|
Offset_Value | RW | 4784 | offset of the recorded register in the memory given by the value of Memory_Type_Value | |
Type_Value | RW | 4788 | data type of the register being recorded 0-3 - integer 32 bits 4-7 - integer 64 bits 8 - double (floating point number of 64 bits) 9 - float (floating point number of 32 bits) |
registers of other OSC channels -> CHANNEL_01 - CHANNEL_31
name | offset | description | ||
CHANNEL_01 | 4792 | registers belonging to channel 01 | ||
CHANNEL_02 | 4808 | registers belonging to channel 02 | ||
׀ | ||||
CHANNEL_31 | 5272 | registers belonging to channel 31 |
helpful registers
name | access | offset | description | |
Number_Samples | R | 5288 | number of samples available | |
Actual_Samples | R | 5292 | current number of recorded samples | |
Sample_Time | R | 5296 | sampling time interval (Sample_Time = Cycle_Time × Number_Periods) [μs] |