The text of a manual · part 17 of 35
Series One Programmable Controllers, Series One/One Plus User's Manual: Chapter 5 Programming, pages 151 to 160
Pages 151 to 160 of 300, from Series One Programmable Controllers, Series One/One Plus User's Manual
The original document is the PDF (40 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the GE Fanuc IC610CPU105A, GE Fanuc IC610CPU105C, Fanuc IC610CPU105A, GE IC610CPU105A, Fanuc IC610CPU105C and GE IC610CPU105C
Page 151
Programming
S-59
GEK-90842 l
Multiplication programming example
Multiplying 4 digits by 4 digits with an answer containing
8 digits.
a40872
2
+I
[s’“l
[s”‘J
[T] piiq i’l
IT’
[TJ
[‘XT”
I”1
[“I
I’]
1’1
171
Ls)
[piq
IENTl
ICmm l pq !FII IRIIII
A 4 digit BCD value is ented into the accumulator hm Inputs 0050-0067. A constant value (1375) is entered as the multiplier. Assume that the answer is an 8 digit BCD number. The lower 4 digits are stared in the accumulator and transfened to Outputs 0140-0157. The upper 4 digits are stored in the auxiliary accumulator (Data Registers 576,577) and transferred to outputs 0160-0177.
Division I#, BCD 4 Digit (F74) The contents of the accumulator are divided by the contents of a specified 2 group reference or a 4 digit BCD constant. The 4 digits of the quotient are stored in the accumulator and the 4 digits of the remainder are stored in the auxiliary accumulator (Data Registers 576,577). If either the dividend or divisor are zero, the Zero flag (776) will tum ON. If the divisor is zero, the Overflow flag (777) will also turn ON. I DOD-014 070 - 075 016-036 040-056 400 - 576 600 - 077
V&id Gmup Rsfefemc8s I/O Points I/O Point8 IntamrrlCoils Shift Register Coils Data Registers(8-bit) f/C Accumulated Value Rwistws
1 oooo- 9999
Constant iddigit 8CDl q rm a40873 I
I
+-I t-x+
GROUP rREFERENCE1
4 DIGIT CONSTANT VALUE tit-x+ r
BCD VALUE
1 xxxx}-+
Page 152
560
Programming GEK-90842 l
Division sequence 15
(4 DIGIT BCD NUMBER)
0 ACCUMULATOR CONTENTS
~~1~0~0~0~1~1~0~0]0~1~1~0~~]0~~ t
REFERENCE + 1 c7
REFERENCE
0 4
3
. olo~olo
O~Ojl~o
7
0 ,2
CjllOlO
1 a
OjllllO
2 GROUP REFERENCE OR 4 DIGIT CONSTANT
3c
4
3
QUOTIENT I 2
REMAINDER 1
0~0~0~0 olololo o~o~o~l~lpp~o
ACCUMULATOR l
I
2 OlllOlO
REGISTER 577
.
3 olo~o~t
4 OlljOlO
REGISTER 576
AUXILIARY ACCUMULATOR v l
1 IlO~OlO
,
I .
The quotient (0 - 4 digits) will be stored in the accumulator as shown. the remain&r (0 - 4 digits) will be stored in the auxiliary accumulator (Data Registers 577,576) as shown. Division programming example
Division of a 4 digit number by another 4 digit number showing how the quotient and remainder written to Outputs.
can be a40875
A 4 digit number is entered into the accumulator fkom Inputs 0030 - 0047. l ‘Ihat number is divided by a number spexified by Inputs 0050 - 0067. l TIE 4 digits of the quotient are stored in the accumlata and are also written to Outputs 0110 - 0127. l ‘Ibe 4 digits of the remainder a stored in the auxikuy accumulator (Data Registers 577,576) and are written to Outputs 0130 - 0147. l
Page 153
Programming
5-61
GE&90842
DwWD (DATA AND) (F75) The contents of the accumulator a~ logically bit ANDed with the contents of a specified 2 group reference or a 4 digit BCD constant. The result is stored in the accumulator. If the answer is 0000, the Zero flag (776) will turn ON. a40876
I
4
Valid &OUD
References
000-014 070 - 075 016 - 036 W-056 400 - 576 600 - 677 l/O Points I/O Points Internal Coils Shift Register Coils Data Registers (O-bit) T/C Accumulated Value Registers (160bit)
oooo- 9999
Constant W-digit BCD)
I-[
+----f r
GROUP REFERENCE q uclcl
D-AND xxx]-+
1
4 DIGIT CONSTANT l-
BCD VALUE 1 liixlclclu
D*AND Sequence a40877 ACCUMULATOR CONTENTS D*AND :
.i
REFERENCE + 1
*
I 1
REFERENCE
4
3
2
1
. 7161514
3]2]110
7161514
312[llO
L
,
2 GROUP REFERENCE OR 4 DIGIT CONSTANT
LOGIC PRODUCT RESULTING BIT PATTERN STORED IN ACCUMULATOR l table for DdND operation A = Accumulator contents D = Contents of reference or constant
Truth
A 0 0 1 1
1
D
1 RESULT
0 1 0 1
0 0 0 1
Page 154
5-62
Programming GE&90842 l
Programming example, DWWD a40878
Assume the data entered into the accumulator from Inputs 0040 - 0057 = 1234 Is logically AND-cd with 2222 l The resulting answer stored in the acmnulator would be 0220 l 0220 is written to Outputs 0060 - 0077 l Accumulator and refemxe contents for above operation 81leshown below l l
Page 155
Programming
5-63
GEK-90842
DoOR (DATA OR) (F76) The contents of the accumulator are logically bit OR-cd with the contents of a specified 2 group reference or a 4 digit BCD constant. The result is stored in the accumulator. If the answer is 0000, the Zero flag (776) will tum ON. wo - 014 070 - 075 016 - 036 040 - 056 400 - 576
I/O Points I/O Points kIternal Coils Shift Register Coils Data Registers @-bit) f/C Accumulated Value Registers (160bit)
600 0 677
.
a40879
Valid Group References
I
1 FLAG 1 ZERO i
Constant W-digit BCD)
OOOO - 9999
I r
GROUP REFERENCE
Elclucl
I
DOR
1
4 DlGfT CONSTANT
I- r
+---I 1-L
III171
776
+--1 f----{WR
1
XXXX J-7
I
BCD VALUE 1
D*OR Sequence a40880 15114113[
9 f 8 17 1 6 ] 5 14 13 1 2 1 1 1 0
12lllllOl
ACCUMULATOR CONTENTS
D.OR
; 4 r
REFERENCE + 1 4 7~6~5~4~3~2~1~0
3 t
/8 ,
REFERENCE 2 716/5~4j3~2[110
1
15~~~4’113’!12’111’110’1 9’1 8’1 7’1 6’1 5’1 4’1 3.1 2’1 1’1 0’ l
Truth table for DaR operation.
A = Accumulator contents D = Contents of reference or constant
1
2 GROUP REFERENCE OR 4 DIGIT CONSTANT.
Page 156
, s-64
Programming GE&90842 l
Prqmmming example, DeOR
Assume data entered into the accumulator fi-om Inputs 0120 - 0137 = 3210 Is logically OR-ed with data from Inputs 0140 - 0157 = 7531 The resulting answer stored in the accumulator will be 7731 7731 is written to Outputs 0160 - 0177 Accumulator and nzfenznce contents for above operation ~RZshown below
Page 157
Programming
565
GEL90842
Shift Right (F80) The contents of the accumulator are shifted to the right by the number of shifts (bits) specified by the instruction. The number of bits shifted can be fkom 1 to 15. The bit positions of bits shifted from the left are filled with zeros. If a “1” is shifted out of the accumulator as a result of the shift, the Carry flag (775) will tum on. If after the shift, the accumulator contains only zeros, the Zero flag (776) will turn on. a40882
IFI +----- 1 +-+“N
,
80 Xi}-+
IT015 r l
FUN 80, Shift Right sequence (6 shifts in example)
ACCUMULATOR CONTENTS BEFORE SHIFT
0~1~1~1~1~0~0~1~0~0~0~1~0~1~0~1
SHIFT RtGHT 6BnS
FUN 80 6
ACCUMULATOR CONTENTS AFTER SHIFT.
AU “0” IN THESE POSITtONS
Shift Left (F81) The contents of the accumulator are shifted to the left by the number of shifts (bits) specified by the instruction. The number of bits shifted can be fkom 1 to 15. The bit positions of bits shifted from the right are f3.M with zeros. If a “1” is shifted out of the accumulator as a result of the shift, the Carzy flag (775) will turn on. If after the shift, the accumulator contains only zeros, the Zero flag (776) will turn on. a40883 IFI r
,
~---_I
}-FuN~~ xXl_t lTO15 mclcl l FUN
81, Shift left sequence (4 shifts in example) ACCUMULATOR CONTENTS BEFORE SHIFK SHIFT LEFT 4BKs
0~1~0~1~1~0~0~0~0~1~1~0~0~0~1~0
FUN81 4
.
4
FLAGS CARRY ZERO 775
776
~“0” .
W THESE
PosmoNS
Page 158
5-66
Progrmming GEK-90842 l
Programmin g example using FUN 80 and FUN 81
This example shows a technique that can be used for deleting unnecessary data after it has been entered into the accumulator. In the example the fourth BCD digit will be deleted. a40884 l
Date entered into accumulator from Inputs 0020 - 0037.
0 l 0 l
1
3
1
6
1
2
3
1
6
1
2
1
0
0
1
3
1
6
1
2
Shifted right, 4 bits.
0 l
5 Shifted left, 4 bits.
The fourth digit (5) has been deleted.
a l
The remaining value is added to the contents of Inputs 0060 - 0077. accumulator and written to Outputs 0100 - 0117.
The result is stored in the
Page 159
Programming
S-67
GEK-90842
Decode (F82) The lower 4 bits (least significant) of the accumulator are decoded to a decimal number from 0 to 15. A “ 1” is placed in the bit position in the accumulator that corresponds to the decoded decimal number. The upper 12 bits of the accumulator are disregarded for this operation. a40885 mmllel
}-{FuN*2]-4
++
I
FUN 82 Decode sequence LOWER 4 BKS OF ACCUMULATOR CONTAIN 1 BCD OfGIl.
WHICH lS DECODED TO A DECMAL NUMBER. A “1” WlLL BE PLACED IN THE ACCUMULATOR POSITlON CORRESPONDING TO THAT DECIMAL NUMBER. AU OTHER POSiTlONS WILL CONTAIN ZEROS.
If the BCD digit to be decoded is an 8, A “1” will be placed in the accumulator at that position as shown.
Programming example, FUN 82 a40886
SHF I 1 0STR El I F I El F 0 I I I I I El0 I STR I SHF I SHF 0OUT El 5
3
2
F
6
4
I I I
I
STR u El
SHF
0OUT I SHF 0
1
El
171 IEEl
A BCD digit (for example: 6) is loaded into the accumulator (lower 4 bits) fkom the lower 4 bits of the refkrence, Inputs 20,21,22, and 23. The bit pattern loaded in the accumulator would be 0 1 1 0. The BCD digit is decoded to a decimal number between 0 - 15 (in this example 6). That number is stored in the corresponding bit position in the accumulator. 0utputs 0040 to 0057 correspond to the 16 bits of the accumuIator. oneoftheoutputswillbeenabledwhenthe accumulator position has a “1” placed in it. When the contact corresponding to the output reference is closed, a coil 100 117 will tum on.
Page 160
5-68
Programming GEK-90842
Encode (F83) A bit in a position in the accumulator is encoded to a 4-bit code representing the position number (O-15) in the accumulator. The resulting 4-bit code is placed in the lower four bits of the accumulator. a40887
EJ El El l
FUN 83 Encode sequence
+--{
}-----[
FUN83
(example)
15
0
ONE BIT IN A POSITKIN IN THE ACCUMULATOR
0~0~0~0~0~0~0~0~0~0~1~0~0~0~0~0 v
POSITION 5
FUN 83
1s ENCODED 5
TO A 4-BIT CODE AND STORED IN THE LOWER 4 BITS OF THE ACCUMULATQR
~~0~0~0~0~0~0jol0~0~0~0~0~0~1~0~1 18 l
4
2
118
4
2
118
4
2
118
4
2
11
I
The upper 12 bits of the accumulator will contain zeros after the FUN 83 has been executed
The 16 bits stored in the accumulator are logically inverted; i.e., 1 to 0 and 0 to 1. L a40888 p-lF-Jp-1 t---i t--+4--i l
Invert sequence 15
0
16 BITS STORED IN ACCUMUCATOR
1~0~0~0~0~~~1~0~0~1~1~0~0~1~1~1 INV 15 0~1~1~1~1~0~0~1~1~0~0~1~1~0~0~0 l
Programming
ARE
0
LOGICALLY INVERTED example, INV SHF ISTR El I3
IENT
I F
0 5
I 0
I ENT
F
I 8
I 4
I ENT
I F
I 7
I 1
0ENT
0 F
I 8
I 4
0ENT
0 F
I 6 i 0
I ENT
I
Data entered into the accumulator fbrn Inputs 0030 - 0047 is inverted. The inverted data is added to data from Inputs 0050 - 0067. The 8nswer is stod l Data is written to 0utputs 0070 - 0107
I
El
IEEl l l in the accumulator, then inverted again.