-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added example script for PROFIBUS decoding using waveform files
- Loading branch information
1 parent
d415bbe
commit 48fea92
Showing
10 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
%% LIBRARIES | ||
% Manually add libraries to path | ||
% Preferrably using Git or by downloading a released version | ||
% | ||
% Author: Frederic Depuydt <frederic.depuydt@outlook.com> | ||
% Url: https://github.com/fredericdepuydt/matlab-libraries/releases | ||
% Command: git clone https://github.com/fredericdepuydt/matlab-libraries.git libraries | ||
|
||
%% CLEAN WORKSPACE AND FIGURES | ||
clear all; | ||
close all; | ||
|
||
%% CREATING SCOPE OBJECTS FROM WAVEFORM FILE | ||
|
||
% For the DPO4054B a waveform file of type .isf is required | ||
% using scope class -> isfread function -> file and verbosity as parameters | ||
% file = "tek0000CH1.isf" | ||
% verbose = -1 -> Full depth verbosity (Output everything to CLI) | ||
objDPO4054B = scope.isfread("DPO4054B/tek0000CH1.isf", -1); | ||
|
||
% Both functions return an object of class scope | ||
|
||
%% PLOTTING SCOPE OBJECT | ||
CH1 = objDPO4054B.channels(1); | ||
X = objDPO4054B.time; | ||
Y = objDPO4054B.values(CH1); | ||
|
||
figure(1); | ||
plt(X,Y); | ||
|
||
%% CREATING PROFIBUS (Currently UART Class) object | ||
objUART = uart.decode(objDPO4054B, 1, 1500000, -1); | ||
|
||
%% PLOT UART OBJECT | ||
figure(); | ||
objUART.plot(0,0,1) | ||
axis([objUART(1).time objUART(end).time_end -3 3]); | ||
|
||
%% TABLE WITH PACKETS | ||
figure(); | ||
objUART.table() | ||
|
||
%% EXPORT TO PROFITRACE | ||
objUART.ptdwrite("test.ptd",-1); | ||
|
||
%% IMPORT FROM PROFITRACE | ||
newUART = uart.ptdread("test.ptd",-1); | ||
|
||
%% FILTERING PROFIBUS PACKETS | ||
SD1 = objUART.filter('SD1'); | ||
SD2 = objUART.filter('SD2'); | ||
SD3 = objUART.filter('SD3'); | ||
SD4 = objUART.filter('SD4'); | ||
SC = objUART.filter('SC'); | ||
|
||
|
||
SD2or4 = objUART.filter('SD2 OR SD4'); | ||
|
||
Master = objUART.filter('SA = 74'); | ||
|
||
Retries = objUART.filter('FC = 6D'); | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Frederic Depuydt,PC-FREDERIC/fdepu,,09.10.2020 14:07,file:///C:/Users/fdepu/AppData/Roaming/LibreOffice/4; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
%% LIBRARIES | ||
% Manually add libraries to path | ||
% Preferrably using Git or by downloading a released version | ||
% | ||
% Author: Frederic Depuydt <frederic.depuydt@outlook.com> | ||
% Url: https://github.com/fredericdepuydt/matlab-libraries/releases | ||
% Command: git clone https://github.com/fredericdepuydt/matlab-libraries.git libraries | ||
|
||
%% CLEAN WORKSPACE AND FIGURES | ||
clear all; | ||
close all; | ||
|
||
%% CREATING SCOPE OBJECTS FROM WAVEFORM FILE | ||
|
||
% For the MSO5054B a waveform file of type .wfm is required | ||
% using scope class -> wfmread function -> file and verbosity as parameters | ||
% file = "waveform_CH1.wfm" | ||
% verbose = -1 -> Full depth verbosity (Output everything to CLI) | ||
objMSO5045B = scope.wfmread('MSO5045B/waveform_CH1.wfm',-1); | ||
|
||
% Both functions return an object of class scope | ||
|
||
%% PLOTTING SCOPE OBJECT | ||
CH1 = objMSO5045B.channels(1); | ||
X = objMSO5045B.time; | ||
Y = objMSO5045B.values(CH1); | ||
|
||
figure(1); | ||
plt(X,Y); | ||
|
||
%% CREATING PROFIBUS (Currently UART Class) object | ||
objUART = uart.decode(objMSO5045B, 1, 1500000, -1); | ||
|
||
%% PLOT UART OBJECT | ||
figure(); | ||
objUART.plot(0,0,1) | ||
axis([objUART(1).time objUART(end).time_end -3 3]); | ||
|
||
%% TABLE WITH PACKETS | ||
figure(); | ||
objUART.table() | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.