5. Initial Programming
219
5. Initial Programming
The main goal of this chapter is to help in the programming and configuration of Hadron Xtorm
Series CPUs so that the user will be able to take the first steps before starting a controller
programming.
Hadron Xtorm Series CPUs use the IEC 61131-3 standard for language programming, which are IL,
ST, LD, SFC and FBD, and besides these, an extra language, CFC. These languages can be separated
in text and graphic. IL and ST are text languages and are similar to Assembly and C, respectively.
LD, SFC, FBD and CFC are graphic languages. LD uses the relay block representation and it is
similar to relay diagrams. SFC uses the sequence diagram representation, allowing an easy way to
see the event sequence. FBD and CFC use a group of function blocks, allowing a clear vision of the
functions executed by each action.
The programming is made through the MasterTool Xtorm interface. MasterTool Xtorm allows the
use of the six languages in the same project, so the user can apply the best features offered by each
language, resulting in more efficient applications development, for easy documentation and future
maintenance.
Memory Organization and Access
Hadron Xtorm Series uses an innovative memory organization and access feature called big-endian,
where the most significant byte is stored first and will always be the smallest address (e.g. %QB0
will always be more significant than %QB1, as in Table 5-1, where, for HADRON XTORM CPU,
string, the letter U is byte 0 and the letter O is the byte 7).
Besides this, the memory access must be done carefully as the variables with higher number of bits
(WORD, DWORD, and LONG), use as index the most significant byte, in other words, the %QD4
will always have as most significant byte the %QB4. Therefore, it will not be necessary to make
calculus to discover which DWORD correspond to defined bytes. Table 5-1 shows little and big
endian organization.
HSB <
– Little-endian (Traditional) –> LSB
BYTE
%QB7 %QB6 %QB5 %QB4 %QB3 %QB2 %QB1 %QB0
U
C
P
X
T
O
R
M
WORD
%QW3
%QW2
%QW1
%QW0
UC
PX
TO
RM
DWORD
%QD1
%QD0
CPUX
TORM
LWORD
%QL0
CPU XTORM
HSB <
– Big-endian (HADRON XTORM) –> LSB
BYTE
%QB0 %QB1 %QB2 %QB3 %QB4 %QB5 %QB6 %QB7
U
C
P
X
T
O
R
M
WORD
%QW0
%QW2
%QW4
%QW6
UC
PX
TO
RM
DWORD
%QD0
%QD4
CPUX
TORM
LWORD
%QL0
CPUXTORM
Table 5-1. Example