LW:9000 pointer and then use an RWI address 5 (RWI:5) to GetData() or SetData() {LW:9000 = 15 + RWI:5
à
RW:20}.
The pointer has a maximum limitation of 32767, so LW:9000 can indirectly address
from an offset of 0 to 32767. To indirectly address recipe registers above 32767, you
will need to have the RWI address set to a higher address.
The macro code on the next page will clear all general-use recipe memory area. Because of the pointer’s limitation
(max of LW:9000 = 32767), it breaks up the incrementing of memory into two sections, the lower half (0 to 29999)
and upper half (30000 to 59999).
// Macro clear memory routine
Macro_Command main( )
int Address = 0
short Initial = 0
short Done = 0
short Section = 0
// LW:2 is used as an indicator in the project
SetData(Section, LW_Binplc,2,1) // LW:2 = 0 (Lower
Half)
For Address = 0 To 29999
SetData(Address, LW_Binplc,9000,1) // LW:9000 incr.
through memory
SetData(Initial, RWI_Binplc,0,1) // RWI:0 indirect
address is Low
Next Address
Section = 1
SetData(Section, LW_Binplc,2,1) // LW:2 = 1 (Upper
Half)
For Address = 0 To 29999
SetData(Address, LW_Binplc,9000,1) // LW:9000 incr.
through memory
SetData(Initial, RWI_Binplc,30000,1) // RWI:0 indirect
address is Upper
Next Address
SetData(Done, LB_Binplc,1,1) // Turn off the bit
that called the macro
End Macro_Command
Using 32-bit Registers Within Macros
When reading or writing a 32-bit (2-word) register that is external to the macro using GetData() or SetData(), you
must use an array of (2) 16-bit ‘shorts’. Internally, the macro can use an ‘int’ type variable to store a value up to +/-
2,147,483,647 (a signed 32-bit register). But when using the GetData() or SetData() functions it only does a 16-bit
external transfer even though it may be declared as ‘int’ (32-bit).
// This routine writes Hex value 0x12345678 to a 32-bit holding
register
short Data[2]
int value = 0x12345678
// split 32-bit value into (2) 16-bit values
Data[1] = (value & 0xFFFF0000) > 16 //store the MSW
Data[0] = value & 0x0000FFFF //store the LSW
// store the (2) 16-bit values into LW14 and LW15
SetData(Data[0] ,LW_Binplc ,14,2)
// This routine reads a 32-bit holding register
short Data[2]
// grab a 32-bit register [(2) 16-bit] value from a PLC register
address 4x:1
GetData(Data[0] ,4x_Binplc ,1,2)
1010-1001a, Rev 02
252
Sil ver Se ries In stal la tion & Op er a tion Man ual
Содержание Silver HMI504T
Страница 1: ...1010 1001A Rev 02...
Страница 20: ...1010 1001a Rev 02 16 Silver Series Installation Operation Manual OIT to PC Serial Port Pin Assignments...
Страница 32: ...1010 1001a Rev 02 28 Silver Series Installation Operation Manual...
Страница 128: ...1010 1001a Rev 01 124 Silver Series Installation Operation Manual...
Страница 156: ...1010 1001a Rev 02 152 Silver Series Installation Operation Manual...
Страница 166: ...1010 1001a Rev 02 162 Silver Series Installation Operation Manual...
Страница 216: ...1010 1001a Rev 01 212 Silver Series Installation Operation Manual...
Страница 251: ...1010 1001a Rev 02 Macros 247 Set Bit Objects Attributes Dialog Project Example of Add 2...
Страница 264: ...End Macro_Command 1010 1001a Rev 02 260 Silver Series Installation Operation Manual...
Страница 268: ...1010 1001a Rev 01 264 Silver Series Installation Operation Manual...