Direct Addressing Of The Cpu Memory Areas - Siemens Simatic S7-200 System Manual

Programmable controller
Hide thumbs Also See for Simatic S7-200:
Table of Contents

Advertisement

CPU Memory: Data Types and Addressing Modes
7.1

Direct Addressing of the CPU Memory Areas

The S7-200 CPU stores information in different memory locations that have unique
addresses. You can explicitly identify the memory address that you want to access. This
allows your program to have direct access to the information.
Using the Memory Address to Access Data
To access a bit in a memory area, you specify the address, which includes the memory area
identifier, the byte address, and the bit number. Figure 7-1 shows an example of accessing a
bit (which is also called "byte.bit" addressing). In this example, the memory area and byte
address (I=input, and 3=byte 3) are followed by a period (".") to separate the bit address
(bit 4).
I 3
.
4
MSB = most significant bit
LSB = least significant bit
Figure 7-1
By using the byte address format, you can access data in many CPU memory areas (V, I, Q,
M, and SM) as bytes, words, or double words. To access a byte, word, or double word of
data in the CPU memory, you must specify the address in a way similar to specifying the
address for a bit. This includes an area identifier, data size designation, and the starting byte
address of the byte, word, or double-word value, as shown in Figure 7-2. Data in other CPU
memory areas (such as T, C, HC, and the accumulators) are accessed by using an address
format that includes an area identifier and a device number.
MSB
7
VB100
Most significant byte
MSB
15
VW100
MSB
31
VD100
MSB = most significant bit
LSB = least significant bit
Figure 7-2
7-2
Bit of byte, or bit number: bit 4 of 8 (0 to 7)
Period separates the byte address
from the bit number
Byte address: byte 3 (the fourth byte)
Area identifier (I = input)
Accessing a Bit of Data in the CPU Memory (Byte.bit Addressing)
LSB
0
VB100
Least significant byte
8
7
VB100
VB101
Most significant byte
24
23
VB100
VB101
Comparing Byte, Word, and Double-Word Access to the Same Address
MSB
7 6 5 4 3 2 1 0
I 0
I 1
I 2
I 3
I 4
I 5
I 6
I 7
V B 100
Byte address
Access to a byte size
Area identifier (V memory)
V W 100
Byte address
LSB
Access to a word size
0
Area identifier (V memory)
Least significant byte
16
15
8
7
VB102
VB103
V D 100
Byte address
Access to a double word size
Area identifier (V memory)
S7-200 Programmable Controller System Manual
C79000-G7076-C230-02
LSB
LSB
0

Advertisement

Table of Contents
loading

Table of Contents