Chapter 4 Instruction Structure The type of Var1 is a word array, and its size is 11 words. The range is from Var1[0] to Var1[10]. The type of Var2 is a word, and its size is one word. When StartBit[0] is ON, E0=10, E1=1, Var1[0]@E0=Var1[10], Var2=Var1[10], and StarrtBit[0]@E1=StartBit[1]. StartBit[1] is ON. 4_ Additional remark: When you declare the variables in ISPSoft, and the variables are added to the contents of the registers to form the addresses to the actual data, you must note the addresses to prevent the program from being executed incorrectly. 3. Using index registers in an interrupt instruction: The index registers E0~E9 in the main program (e.g.
POU, SFC, and FB) are different from the ones (index registers E0~E9) in the interrupt program. They are independent groups of index registers and they work separately. You can use ISPSoft to monitor the values of index registers in the main program. Application: If you use E0 in the main program and in the interrupt program. When an interrupt occurs, before executing the interrupt program, the system stores the value of E0 in the main program. After the interrupt program is executed, the value of E0 in the main program will be retained. So that the interrupt program will not affect the value of E0 in the main program and the result of the main program execution can stay unaffected.
Refer to the following example, if you need to monitor the values of index registers E0-E9 in the interrupt program, or if the main program is also using the values of index registers E0-E9 in the interrupt program. (Note: It is NOT recommended to use index registers as global variables. If you need to use it as a global variable, you need to declare or define other devices to use it as a global variable.) 4-9