- HMI Model: cMT2078X Simulation
- EasyBuilder Pro Version: 6.10.01.359
I’m setting up a Macro to generate an initial test data pattern for a project using the X-Y plot element. Theoretically I’m targetting 1000 points, although we’ll adjust to whatever it can actually handle. When I run the following macro, I get up to the first set of Datasets inside the For loop and past them, but that’s it, it quits after executing the Dataset command, no alerts I can see.
I get the TRACE printout of TRACE(“n_start = %d”, n_start) once and then nothing. I’ve confirmed the 100 word dataset is writing to memory.
short DataTime[100]
float DataCapture[100]
float DataLL[100]
float DataUL[100]
float X_MinMax[2]
//float X_Max
short T_MinMax[2]
//float T_Max
int DataCount = 1000
int Refresh = 3
int StepEnd = 997
int T_Increment = 10
int T_Val = 0
int n
int p = 0
int D_Step = 0
int n_start = 0
float r = 0
float k = 0
//Generates a test pattern to test the display
macro_command main()
X_MinMax[0] = 0
X_MinMax[1] = 0
T_MinMax[0] = 0
T_MinMax[1] = 0
TRACE("StepEnd = %d", StepEnd)
for n = 0 to StepEnd
//Generate an graph
if n <500 then
r= r + 1
else
r= r - 1
end if
k = k + r
DataCapture[p] = k
if DataCapture[p] > X_MinMax[1] then
X_MinMax[1] = DataCapture[p]
end if
if DataCapture[p] < X_MinMax[0] then
X_MinMax[0] = DataCapture[p]
end if
DataTime[p] = T_Val
if DataTime[p] > T_MinMax[1] then
T_MinMax[1] = DataTime[p]
end if
T_Val = T_Val + T_Increment
DataUL[p] = DataCapture[n] * 1.1
if DataUL[p] > X_MinMax[1] then
X_MinMax[1] = DataUL[p]
end if
if DataUL[p] < X_MinMax[0] then
X_MinMax[0] = DataUL[p]
end if
DataLL[p] = DataCapture[n] * 0.9
if DataLL[p] > X_MinMax[1] then
X_MinMax[1] = DataLL[p]
end if
if DataLL[p] < X_MinMax[0] then
X_MinMax[0] = DataLL[p]
end if
p = p + 1
TRACE("n = %d", n)
if ((p >= 100) or (n == StepEnd)) then
SetDataEx(DataCapture[0], "Local HMI", LW, 2004 + n_start, p)//"PROFILE_1_DATA"
//SetData(DataTime[0], "Local HMI", RW, 1000, 100)
SetDataEx(DataTime[0], "Local HMI", RW, 0002 + n_start, p)//"PROFILE_TIME_1"
SetDataEx(DataLL[0], "Local HMI", RW, 1004 + n_start, p)//"PROFILE_1_LL"
SetDataEx(DataUL[0], "Local HMI", RW, 3004 +n_start, p)//"PROFILE_1_HL"
//Incremental so we don't need to hold all the data at the same time
n_start = n_start + 100
SetDataEx(n_start, "Local HMI", "Profile_LineCount", 1)
p = 0
D_Step = D_Step + 1
TRACE("n_start = %d", n_start)
end if
next
//Limits
TRACE("X Min = %f", X_MinMax[0])
TRACE("X Max = %f", X_MinMax[1])
TRACE("T Min = %d", T_MinMax[0])
TRACE("X Max = %d", T_MinMax[1])
SetDataEx(X_MinMax[0], "Local HMI", LW, 2000, 2)//"PROFILE_1_DATA"
SetDataEx(T_MinMax[0], "Local HMI", RW, 0000, 2)//"PROFILE_TIME_1"
SetDataEx(X_MinMax[0], "Local HMI", RW, 1000, 2)//"PROFILE_1_LL"
SetDataEx(X_MinMax[0], "Local HMI", RW, 3000, 2)//"PROFILE_1_HL
SetData(Refresh, "Local HMI", "Profile_Refresh", 1)
end macro_command