The text of a manual · part 20 of 39
Series 90-30/20/Micro PLC CPU Instruction Set Reference Manual: Chapter 9 - Data Move Functions, pages 159 to 166
Pages 159 to 166 of 337, from Series 90-30/20/Micro PLC CPU Instruction Set Reference Manual
The original document is the PDF (4.4 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 IC692CPU211D / IC692MDR541C, Fanuc IC692CPU211D / IC692MDR541C, GE IC692CPU211D / IC692MDR541C and GE Fanuc IC693CPU311X
Page 159
9 Example 1 In this example, the shift register operates on three (LEN=3) memory locations, %R0002 through %R0004. When the reset contact %I0002 is on, the three shift register words are set to zero. When contact %I0001 closes, the %M0201 contact at the SHFR’s enable input closes for one scan. This shifts the data in %R0004 into output Q’s address, %R0005 (the data that was in %R0005 is discarded). The data in %R0003 shifts into %R0004; the data in %R0002 shifts into %R0003, and the data in %R0001 (IN) shifts into %R0002 (ST). This data flow is shown in the figure below. If desired, data can be re-circulated by using the same address at IN and Q. %M0201
%I0001
%M0201
%I0002
%M0202 SHFR_ WORD R
Q
LEN 00003
%R0001
IN
%R0002
ST
Data Flow Through the SHFR %R0005
%R0001 (IN) %R0002 (ST) %R0003
Shift Register (LEN=3)
%R0004 %R0005 (Q) Discarded
Example 2 In Example 2, the shift register is a BIT type. With a LEN of 100, it operates on memory locations %M0001 through %M0100. When the reset reference CLEAR is active, the SHFR function fills %M0001 through %M0100 with zeros. When NXT_CYC (a “one-shot” contact from a transition coil) is on and CLEAR is off, the SHFR function shifts the data in %M0001 through %M0100 up one bit. The bit in %Q0033 is shifted into %M0001 while the bit shifted out of %M0100 is written to Q (%M0200). The previous value of Q is discarded. | _____ |NXT_CYC | | | - - | | - - - |SHFR_| - | | | | | BIT | | CLEAR | | | - - | | - - - |R Q| - %M0200 | | LEN | | |00100| | | | | | | | | | | %Q0033 - |IN | | | | | | | | %M0001 - |ST | | |_____| |
9-10
Series 90™-30/20/Micro PLC CPU Instruction Set Reference Manual – May 2002
GFK-0467M
Page 160
9
BITSEQ
(BIT) The Bit Sequencer (BITSEQ) function shifts a single logic 1 bit sequentially in a circular path through an array of bits. When the bit is shifted to the end of the array, it will wrap around to the other end of the array on the next shift and continue from there. The BITSEQ function has five input parameters and one output parameter. | | (enable), | BIT_| - (ok) | | | SEQ | | | (reset), |R | | LEN | |00001| (direction), |DIR | | | | | (number), |STEP | | | | | (starting address), |ST | | | |_____| (address) - Enter the beginning address here.
Enable Input Requirement The Bit Sequencer’s Enable input requires a transition from logic zero to logic one in order for the function to execute one shift, and it will not execute again until it receives another positive-going Enable input transition. Therefore, using the contact from a positive transition coil for the Enable input is unnecessary.
R (Reset) Input When this input is on, the Bit Sequencer will not execute. The reset input (R) overrides the enable (EN) and always resets the sequencer. When R is active, the current step number is set to the value specified in the STEP number parameter and all other bits are set to 0. If no STEP number is specified (STEP=0), the step is set to bit 1 and all other bits are set to 0. When EN is active and R is not active, the bit pointed to by the current step number is cleared. The current step number is either incremented or decremented, based on the DIR (direction) parameter. Then, the bit pointed to by the new step number is set to 1.
STEP Input •
When the step number is being incremented and it goes outside the range of (1 ≤ step number ≤ LEN), it is set back to 1.
•
When the step number is being decremented and it goes outside the range of (1 ≤ step number ≤ LEN), it is set to LEN.
The parameter ST is optional. If it is not used (it is left equal to its default of zero), the BITSEQ operates as described above, except that no bits are set or cleared. Basically, the BITSEQ then just cycles the current step number through its legal range.
GFK-0467M
Chapter 9 Data Move Functions
9-11
Page 161
9 DIR (Direction) Input The direction of bit rotation can be changed by turning the DIR input on or off. If on, the bit is incremented through the array. If off, the bit is decremented.
ST (Starting Address) Input and LEN (Length) Parameter The ST input contains a memory location for the starting address of the sequencer array. The length of the array, in bits, is set by the LEN parameter. For example, if ST is %M0001 and LEN equals 16, the array is composed of %M0001 through %M0016. If ST is a %R address, then LEN determines how many consecutive bits in %R memory are included in the array. For example, if ST is %R0004, and LEN equals eight, only the first eight bits of register %R will be used in the array; the last eight bits of %R0004 will be ignored by the Bit Sequencer.
Control Block Memory Required for a Bit Sequencer Each bit sequencer uses three words (registers) of %R memory to store the following information:
current step number word 1 length of sequence (in bits)
word 2 control word word 3
When you program a bit sequencer with Logicmaster, you must enter a beginning address for these three words (registers) directly below the graphic representing the function (see example on next page). The control word stores the state of the Boolean inputs and outputs of its associated function block, as shown in the following format:
15 14
13
12
11 10
9
7
8
6
5
4
3
2
1
0
R e s e rv e d R e s e rv e d
O K ( s ta tu s in p u t) E N ( e n a b le in p u t)
Note Bits 0 through 13 are not used in the Control Block. Also, note that bits need to be entered as 1 through 16, NOT 0 through 15 in the STEP parameter.
9-12
Series 90™-30/20/Micro PLC CPU Instruction Set Reference Manual – May 2002
GFK-0467M
Page 162
9 Parameters Parameter
Description address
Address is the location of the bit sequencer’s current step, length, and the last enable and ok statuses.
enable
When the function is enabled, if it was not enabled on the previous sweep and if R is not energized, the bit sequence shift is performed.
R
When R is energized, the bit sequencer’s step number is set to the value in STEP (default = 1), and the bit sequencer is filled with zeros, except for the current step number bit.
DIR
When DIR is energized, the bit sequencer’s step number is incremented prior to the shift. Otherwise, it is decremented.
STEP
When R is energized, the step number is set to this value.
ST
ST contains the first word of the bit sequencer.
ok
The ok output is energized whenever the function is enabled.
LEN
LEN must be between 1 and 256 bits.
Note Coil checking for the BITSEQ function checks 16 bits from the ST parameter, even when LEN is less than 16.
Valid Memory Types Parameter flow
%I
%Q
%M
%T
%S
%G address
GFK-0467M
%AI
%AQ const
• none
• enable
•
R
•
DIR
•
STEP
•
•
•
•
ST
•
•
•
• ok • †
%R
•†
•
•
•
•
•
•
•
•
•
• • •
Valid reference or place where power may flow through the function. SA, %SB, %SC only; %S cannot be used
Chapter 9 Data Move Functions
9-13
Page 163
9
Example In the following example, the Bit Sequencer operates on bits %M0011 (specified in the ST input) through %M0022 (since LEN equals twelve). Its three-word control block is stored in registers %R0010, %R0011, and %R0012. When %I0002 (on the R input) is on, the sequencer is reset, which means that the bit for step three (specified in the STEP input) will be set to logic one and all other bits will be set to zero. When %I0001 goes to logic 1 (with %I0002 off), the bit for step number 3 is cleared and either the bit for step number 4 will be set if DIR is on, or the bit for step number 2 will be set if DIR is off. %M0100
%I0001 %I0002
BIT_ SEQ R
%I0003
LEN 00012 DIR
CONST 00003
STEP
%M0011
ST %R0010
9-14
%M Bits Step Number
22 21 20 19 18 17 16 15 14 13 12 11 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 1 0 0 Shift Direction Shown for DIR=ON
Series 90™-30/20/Micro PLC CPU Instruction Set Reference Manual – May 2002
GFK-0467M
Page 164
9
COMMREQ Use the Communication Request (COMMREQ) function if the program needs to communicate with an intelligent module, such as a Genius Communications Module or a Programmable Coprocessor Module.
Note The information presented on the following pages shows the general format of the COMMREQ function. You will need additional information to program the COMMREQ for each type of device. Programming requirements for each module that uses the COMMREQ function are described in the module’s documentation. The COMMREQ function has three input parameters and one output parameter. When the COMMREQ function receives power flow, a command block of data is sent to the intelligent module. The command block begins at the reference specified using the parameter IN. The rack and slot # of the intelligent module are specified in SYSID. The COMMREQ may either send a message and wait for a reply, or send a message and continue without waiting for a reply. If the command block specifies that the program will not wait for a reply, the command block contents are sent to the receiving device and the program execution resumes immediately. (The timeout value is ignored.) This is referred to as NOWAIT mode. If the command block specifies that the program will wait for a reply, the command block contents are sent to the receiving device and the CPU waits for a reply. The maximum length of time the PLC will wait for the device to respond is specified in the command block. If the device does not respond within that time, program execution resumes. This is referred to as WAIT mode. The Function Faulted (FT) output may be set ON if: 1.
The specified target (SYSID) is not present in that location.
2.
The specified task (TASK) number is not valid for the targeted device
3.
The data length is 0 (in the Command Block).
4.
The device’s status pointer address (part of the Command Block) does not exist. This may be due to an incorrect memory type selection, or an address within that memory type that is out of range.
Command Block The Command Block provides information to the targeted intelligent module. It contains the command number to be performed as well as any data to be transferred. The address of the Command Block is specified at the IN input to the COMMREQ function. This address may be in any word-oriented area of memory (%R, %AI, or %AQ). The length of the command block depends on the type of module targeted by the COMMREQ and the amount of data to be sent.
GFK-0467M
Chapter 9 Data Move Functions
9-15
Page 165
9 The command block has the following structure: Length (in words) Wait/No Wait Flag address address + 1
Status Pointer Memory Status Pointer Offset address + 2 address + 3
Idle Timeout Value Maximum Communication Time address + 4 address + 5
Data Block address + 6 to address + 133
Information required for the command block can be placed in command block memory using an appropriate programming function such as a Block Move or a series of Moves. _____ | | (enable), |COMM_| - | | | REQ | | | (first word of Command block), |IN FT| - | | (rack/slot number), |SYSID| | | (task ID), |TASK | |_____|
Parameters Parameter
Description enable
While the enable input is on, the communications request is performed once per scan. If it is not desirable to send the COMMREQ multiple times, the enable input should be a contact from a Transition Coil.
IN
IN contains the starting address of the first word of the command block.
SYSID
SYSID contains the rack number (most significant byte) and slot number (least significant byte) of the targeted module.
TASK
TASK contains the task ID of the process on the targeted module.
FT
The FT (fault) output is energized if an error is detected processing the COMMREQ.
Note The Series 90-30 COMMREQ does not have an OK output.
Valid Memory Types Parameter flow enable
•
%I
%Q
%M
%T
%S
%G
IN SYSID
•
•
•
•
TASK FT •
9-16
•
%R
%AI
%AQ
•
•
•
•
•
•
•
•
•
•
•
• const none
•
Valid reference or place where power may flow through the function.
Series 90™-30/20/Micro PLC CPU Instruction Set Reference Manual – May 2002
GFK-0467M
Page 166
9 Example In the following example, when enable input %I0001 is on, a command block starting at %R0100 (specified at the IN input) is sent to communications task 1 (TASK input = 1) in the module located at rack 0, slot 8 (SYSID=0008) of the PLC. If an error occurs while processing the COMMREQ, the Fault (FT) output turns on, which turns on %M0100. Notice that the address at input IN specifies the starting address of the Command Block. Also, the hex. number at SYSID specifies the rack and slot number of the targeted module; the high byte refers to the rack number and the low byte refers to the slot number. Therefore, the SYSID of 0008 in the example refers to rack 00 and slot 08, as shown. Rack 0 (zero) always refers to the main or CPU rack, so if the targeted module was in an expansion or remote rack, the high byte of SYSID would contain a non-zero number that corresponds to the configured rack number where the targeted module is located.
%I0001 COMM_ REQ
%R0100
IN
%M0100
FT
LEN 00001 CONST SYSID 0008 CONST TASK 00001
Command Block %R0100 %R0101 %R0102 %R0103 Etc.
GFK-0467M
Chapter 9 Data Move Functions
Series 90-30 PLC, Rack 0 Power CPU Supply
Slot Number:
1
2
3
4
5
6
7
8
9 10
9-17