#************************** Generate periodic signals. No Hardware required ***********************************************
#++++++++++++++++++++++++++ Periodische Signale erzeugen. Keine Hardware erforderlich ++++++++++++++++++++++++++++++++++++++++++++

# Set the number of points ("samples") per second / Anzahl der Datenpunkte pro Sekunde
_DataFreq = 10

# Amplitude for all signals / Amplitude für alle Signale:
constA= 10;

constPI=3.1415926;

# Generate sine x1 / Erzeuge ein Sinussignal x1
x1= constA*sin(CNT*2*constPI/100);

#x2: Calculate the deviation of x1, so that it's a cosine with the same amplitude. Altenatively:
#x2= constA*cos(CNT*2*constPI/100);
# x2: Bilde die Ableitung aus dem Sinus x1, d.h. ein Cosinus-Signal mit derselben Amplitude
x2= (100/(2*constPI)) * (x1-x1L);

#x3: Rectangle / Rechtecksignal
IF(CNT<50){x3= constA};
ELIF(CNT<100){x3= -(constA)};
# uncomment the following line if this code for rectangle signal is used alone. Otherwise, it's resettet below.
#ELIF(CNT>=100){RESET(0)};
ENDIF;

# x4: Triangle / Dreiecksignal
IF(CNT < 25) {x4= CNT*4*constA/100};
ELIF(CNT < 75) {x4= 2*constA-(CNT*4*constA/100)};
ELIF(CNT < 100) {x4= (CNT*4*constA/100) - 4*constA};
ENDIF;
IF(CNT=99) {RESET(0)};