December 2001 PLC Modules 7 – 179
Module 9020/9021/9022 Write in the word range
The TNC writes the given byte, word or double word to the defined location in 
the word memory. Indexed writing is possible by specifying a variable as 
designation of the memory location.
Call:
PS B/W/D/K <Address of the byte to be written>
PS B/W/D/K <Byte to be written>
CM 9020 ; WRITE BYTE TO ADDRESS
PS B/W/D/K <Address of the word to be written>
PS B/W/D/K <Word to be written>
CM 9021 ; WRITE WORD TO ADDRESS
PS B/W/D/K <Address of the double word to be written>
PS B/W/D/K <Double word to be written>
CM 9022 ; WRITE DOUBLE WORD TO ADDRESS
Error recognition:
Example of 
Module 9020
Initial state:
Byte B10 = 35 (address)
Byte B100 = 120 (byte to be written)
Byte B35 = ?
Marker Value Meaning
M4203 0 Byte was written
1 Error code in W1022
W1022 3 Invalid address was programmed
5 Module 9021: Specified address is not a word address
Module 9022: Specified address is not a double word 
address
Function STL Accumulator content (dec) Data stack (dec)
xx xx xx xx
Save the address 
(B10) of the byte to 
be written from the 
word accumulator to 
the data stack.
PS B10 35 35
Save byte B100 from 
the word 
accumulator in the 
data stack.
PS B100 120 120
Write data stack in 
byte B35.
CM 9020 120