- HMI Model: cMT3072XH
- EasyBuilder Pro Version: V6.09.02.651
To start off, I am fairly new to the macro editor in EasyBuilder Pro.
I am trying to assign a string value to a variable based on the numeric value in another variable (utilizing a case statement) in a macro, but I keep getting the compile error “error C34: expected constant expression” for the actions in my case statement. Any help would be appreciated.
NOTE, I am also doing this because it seems the Allen Bradley SLC5/03 DH485 driver does not support string addresses. Previously, when using the RS232/DF1 driver, I just did all of this in the PLC and then pulled the data from the string address in the PLC.
macro_command main()
//Initialize variables
int DieRecipeInt = 0
char DieRecipeName[16] = ""
//Pull data from tag containing the die recipe number
GetData(DieRecipeInt, "Local HMI", LW, 24,1)
//Determine which recipe is currently running and fill DieRecipeName with the corresponding recipe name
select case DieRecipeInt
case 1
DieRecipeName = "ULTRA SLOW"
break
case 2
DieRecipeName = "SLOW"
break
case 3
DieRecipeName = "SLOW UP, MID SLOW DOWN"
break
case 4
DieRecipeName = "MID-SLOW"
break
case 5
DieRecipeName = "SLOW UP, MID DOWN"
break
case 6
DieRecipeName = "MEDIUM"
break
case 7
DieRecipeName = "MEDIUM-LONG"
break
case 8
DieRecipeName = "HIGH-MID"
break
case 9
DieRecipeName = "MID-AGGRESSIVE"
break
case 10
DieRecipeName = "SLOW UP, MID SLOW DOWN"
break
case 11
DieRecipeName = "MIDD-AGG-LONG"
break
case 12
DieRecipeName = "AGGRESSIVE"
break
case else
DieRecipeName = "INVALID RECIPE NAME"
break
end select
//Send data to HMI variables for display objects
SetData(DieRecipeName, "Local HMI", LW, 25,16)
end macro_command