The text of a manual · part 10 of 60
C200HX/C200HG/C200HE Programmable Controllers Operation Manual, pages 84 to 93
Pages 84 to 93 of 586
The original document is the PDF (3.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 Omron C200HE-CPU42-E
Page 84
Section 3-6
DM (Data Memory) Area Word(s) DM 6551
Bit(s) 00 to 07 08 to 15
DM 6552
00 to 15
DM 6553
00 to 07 08 to 11 12 to 15
DM 6554
00 to 07 08 to 15
Function Baud rate 00: 1.2K, 01: 2.4K, 02: 4.8K, 03: 9.6K, 04: 19.2K Frame format Start Length Stop 00: 1 bit 7 bits 1 bit 01: 1 bit 7 bits 1 bit 02: 1 bit 7 bits 1 bit 03: 1 bit 7 bits 2 bit 04: 1 bit 7 bits 2 bit 05: 1 bit 7 bits 2 bit 06: 1 bit 8 bits 1 bit 07: 1 bit 8 bits 1 bit 08: 1 bit 8 bits 1 bit 09: 1 bit 8 bits 2 bit 10: 1 bit 8 bits 2 bit 11: 1 bit 8 bits 2 bit Transmission delay 0000 to 9999: BCD in 10-ms units. Node number (Host Link) 00 to 31 (BCD) Start code enable (RS-232C) 0: Disable; 1: Set End code enable (RS-232C) 0: Disable (number of bytes received) 1: Set (specified end code) 2: CR, LF Start code (RS-232C) 00 to FF (binary) 12 to 15 of DM 6553 set to 0: Number of bytes received 00: Default setting (256 bytes) 01 to FF: 1 to 255 bytes
Default 1.2 K
Parity Even Odd None Even Odd None Even Odd None Even Odd None
1 start bit, 7-bit data, 1 stop bit, even parity
0 ms 0 Disabled Disabled
0000
12 to 15 of DM 6553 set to 1: End code (RS-232C) 00 to FF (binary) Communications Board Port A Settings (DM 6555 to DM 6559) The following settings are read continually while the PC is ON. DM 6555 00 to 03 Port settings 0: Standard (1 start bit, 7-bit data, even parity, 2 stop bits, 9,600 bps) 1: Settings in DM 6556 04 to 07
CTS control setting 0: Disable CTS control 1: Enable CTS control
Disable
08 to 11
Words linked for 1:1 PC Link (Can’t be changed once set in the 1:1 PC Link Master.) 0: LR 00 to LR 63; 1: LR 00 to LR 31; 2: LR 00 to LR 15
LR 00 to LR 63
Maximum PT node number for 1:N NT Link 1 to 7 BCD (1 to 3 with a 12 to 15
66
Standard
PC)
Communications mode 0: Host Link; 1: RS-232C; 2: 1-to-1 link slave; 3: 1-to-1 link master; 4: NT Link (1:1); 5: NT Link (1:N); 6: Protocol Macro
Host Link
Page 85
Section 3-6
DM (Data Memory) Area Word(s) DM 6556
Bit(s) 00 to 07 08 to 15
DM 6557
00 to 15
DM 6558
00 to 07 08 to 11 12 to 15
DM 6559
00 to 07 08 to 15
Function Baud rate 00: 1.2K, 01: 2.4K, 02: 4.8K, 03: 9.6K, 04: 19.2K Frame format Start Length Stop 00: 1 bit 7 bits 1 bit 01: 1 bit 7 bits 1 bit 02: 1 bit 7 bits 1 bit 03: 1 bit 7 bits 2 bit 04: 1 bit 7 bits 2 bit 05: 1 bit 7 bits 2 bit 06: 1 bit 8 bits 1 bit 07: 1 bit 8 bits 1 bit 08: 1 bit 8 bits 1 bit 09: 1 bit 8 bits 2 bit 10: 1 bit 8 bits 2 bit 11: 1 bit 8 bits 2 bit Transmission delay 0000 to 9999: BCD in 10-ms units. Node number (Host Link) 00 to 31 (BCD) Start code enable (RS-232C) 0: Disable; 1: Set End code enable (RS-232C) 0: Disable (number of bytes received) 1: Set (specified end code) 2: CR, LF Start code (RS-232C) 00 to FF (binary) 12 to 15 of DM 6558 set to 0: Number of bytes received 00: Default setting (256 bytes) 01 to FF: 1 to 255 bytes
Default 1.2 K
Parity Even Odd None Even Odd None Even Odd None Even Odd None
1 start bit, 7-bit data, 1 stop bit, even parity
0 ms 0 Disabled Disabled
0000
12 to 15 of DM 6558 set to 1: End code (RS-232C) 00 to FF (binary)
3-6-6 Special I/O Unit Area Settings The setting in bits 08 through 15 of DM 6602 determines the size and location of the Special I/O Unit Area, as shown in the following table. Setting Mode Function 00 C200H-compatible DM 1000 through DM 2599 are used for the Special I/O Unit Area. RAM Mode • Data in the Special I/O Unit Area can be read/written. 01
• The data cannot be converted to ROM. C200H-compatible The contents of DM 7000 through DM 7999 are transferred to DM 1000 through DM 1999 ROM Mode 1 at startup and DM 1000 through DM 1999 are used for the Special I/O Unit Area. • The UM Area Allocation operation must be performed beforehand. • The data is compatible with C200H applications that use EEPROM/EPROM.
02
• ROM conversion is possible indirectly by converting DM 7000 through DM 7999 to ROM. DM Linear Mode 1 DM 7000 through DM 7999 are used for the Special I/O Unit Area. • The UM Area Allocation operation must be performed beforehand. • DM 1000 through DM 1999 can be used as regular DM. • DM 7000 through DM 7999 can be converted to ROM.
67
Page 86
Section 3-8
TC (Timer/Counter) Area
Setting Mode Function 11 C200H-compatible The contents of DM 7000 through DM 8599 are transferred to DM 1000 through DM 2599 ROM Mode 2 at startup and DM 1000 through DM 2599 are used for the Special I/O Unit Area. • The UM Area Allocation operation must be performed beforehand. • ROM conversion is possible indirectly by converting DM 7000 through DM 8599 to ROM. 12
DM Linear Mode 2 DM 7000 through DM 8599 are used for the Special I/O Unit Area. • The UM Area Allocation operation must be performed beforehand. • DM 1000 through DM 2599 can be used as regular DM. • DM 7000 through DM 8599 can be converted to ROM.
DM 7000 through DM 9999 cannot be read or overwritten directly from the program. To read this data from the program, the data must be copied to another data area or regular DM using the EXPANSION DM READ – XDMR(––) instruction. When C200H-compatible ROM Mode or DM Linear Mode is set, the UM Area Allocation operation must be performed in advance to allocate part of the ladder program area for use as expansion DM. A system error (FAL 9B) will occur if memory isn’t allocated as expansion DM. Refer to 7-2-15 UM Area Allocation for details on the UM Area Allocation operation. When DM Linear Mode is set, the Special I/O Unit’s data area will begin from DM 7000 instead of DM 1000 so add 6000 to the DM addresses where they appear in the Special I/O Unit’s Operation Manual. When the Special I/O Unit Area setting is 01, 02, 11, or 12 and expansion DM beyond DM 8000 hasn’t been allocated, a Special I/O Unit error will occur for a Unit with unit number A through F when the Unit accesses its allocated area.
3-7
HR (Holding Relay) Area The HR area is used to store/manipulate various kinds of data and can be accessed either by word or by bit. Word addresses range from HR 00 through HR 99; bit addresses, from HR 0000 through HR 9915. HR bits can be used in any order required and can be programmed as often as required. The HR area retains status when the system operating mode is changed, when power is interrupted, or when PC operation is stopped. HR area bits and words can be used to preserve data whenever PC operation is stopped. HR bits also have various special applications, such as creating latching relays with the Keep instruction and forming self-holding outputs. These are discussed in Section 4 Writing and Inputting the Program and Section 5 Instruction Set. Note The required number of words is allocated between HR 00 and HR 42 for routing tables and to monitor timers when using SYSMAC NET Systems.
3-8
TC (Timer/Counter) Area The TC area is used to create and program timers and counters and holds the Completion flags, set values (SV), and present values (PV) for all timers and counters. All of these are accessed through TC numbers ranging from TC 000 through TC 511. Each TC number is defined as either a timer or counter using one of the following instructions: TIM, TIMH, CNT, CNTR(12), and TTIM(87). No prefix is required when using a TC number in a timer or counter instruction. Once a TC number has been defined using one of these instructions, it cannot be redefined elsewhere in the program either using the same or a different instruction. If the same TC number is defined in more than one of these instructions or in the same instruction twice, an error will be generated during the program check. There are no restrictions on the order in which TC numbers can be used.
68
Page 87
Section 3-9
LR (Link Relay) Area
Once defined, a TC number can be designated as an operand in one or more of certain set of instructions other than those listed above. When defined as a timer, a TC number designated as an operand takes a TIM prefix. The TIM prefix is used regardless of the timer instruction that was used to define the timer. Once defined as a counter, the TC number designated as an operand takes a CNT prefix. The CNT is also used regardless of the counter instruction that was used to define the counter. TC numbers can be designated for operands that require bit data or for operands that require word data. When designated as an operand that requires bit data, the TC number accesses the completion flag of the timer or counter. When designated as an operand that requires word data, the TC number accesses a memory location that holds the PV of the timer or counter. TC numbers are also used to access the SV of timers and counters from a Programming Device. The procedures for doing so using the Programming Console are provided in 7-1 Monitoring Operation and Modifying Data. The TC area retains the SVs of both timers and counters during power interruptions. The PVs of timers are reset when PC operation is begun and when reset in interlocked program sections, but the PVs of counters are retained. Refer to 5-10 INTERLOCK and INTERLOCK CLEAR – IL(02) and ILC(03) for details on timer and counter operation in interlocked program sections. The PVs of counters are not reset at these times. Note that in programming “TIM 000” is used to designate three things: the Timer instruction defined with TC number 000, the completion flag for this timer, and the PV of this timer. The meaning in context should be clear, i.e., the first is always an instruction, the second is always a bit, and the third is always a word. The same is true of all other TC numbers prefixed with TIM or CNT.
3-9
LR (Link Relay) Area The LR area is used as a common data area to transfer information between PCs. This data transfer is achieved through a PC Link System. Certain words will be allocated as the write words of each PC. These words are written by the PC and automatically transferred to the same LR words in the other PCs in the System. The write words of the other PCs are transferred in as read words so that each PC can access the data written by the other PCs in the PC Link System. Only the write words allocated to the particular PC will be available for writing; all other words may be read only. Refer to the PC Link System Manual for details. The LR area is accessible either by bit or by word. LR area word addresses range from LR 00 to LR 63; LR area bit addresses, from LR 0000 to LR 6315. Any part of the LR area that is not used by the PC Link System can be used as work words or for SYSMAC NET Link or SYSMAC LINK Systems. LR area data is not retained when the power is interrupted, when the PC is changed to PROGRAM mode, or when it is reset in an interlocked program section. Refer to 5-10 INTERLOCK and INTERLOCK CLEAR – IL(02) and ILC(03) for details on interlocks.
69
Page 88
Section 3-10
UM Area
3-10 UM Area With the C200HX/HG/HE PCs, the UM area contains the ladder program. Part of the UM area can be allocated for use as expansion DM or the I/O comment area. The usable size of the UM area ranges from 3.2 KW in the C200HE-CPU11-E to 31.2 KW in the A Programming Console or SYSMAC Support Software (SSS) can be used to allocate expansion DM, but the I/O comment area can be allocated with SSS only. The structure of the DM and UM areas is shown in the following illustration. DM 0000
DM 6144
DM 6600
DM 6655
PC Setup
DM 7000
Reserved
DM 9999 Expansion DM Area (0 to 3 KW)
I/O Comment Area
Ladder program
Variable size
Special I/O Unit Default Area DM 1000 to DM 1999
Fixed DM Area
Normal DM Area
UM Area (32 KW max.) ROM-convertible Area
Note Refer to the SYSMAC Support Software (SSS) Manual for details on using SSS to allocate UM for expansion DM or I/O comments. Refer to 7-2-15 UM Area Allocation for details on using the Programming Console to allocate UM for expansion DM. Area Normal DM
Function This area can be used freely for calculations and programming instructions. DM can be accessed in word units only. DM 1000 through DM 2599 are assigned to Special I/O Units when Special I/O Units are being used, but can be used as normal DM when the Special I/O Unit Area has been set to DM 7000 through DM 8599 in the PC Setup (DM 6602).
PC Setup Reserved Expansion DM
The PC Setup contains various settings that control PC operation. This area is reserved for system use. It cannot be accessed by the user. This area contains initialing data such as Special I/O Unit data, numerical or character string tables for PTs, and calculation data. Data can’t be read directly from the expansion DM area as it can from normal DM.
Expansion DM can be overwritten by performing the Hexadecimal/BCD Data Modification operation from a Programming Console or by transferring edited DM data from SYSMAC Support Software. I/O comment This area is used to store I/O comments, which can be saved together with the program. The I/O comments will be automatically uploaded with the program and automatically allocated to that monitoring can be perform with I/O comments. Ladder program This area is used to store the ladder program created by the user. UM area words allocated to expansion DM and/or the I/O Comment Area are taken from the ladder program area.
Note
1. The ladder program area is reduced proportionately when UM area words are allocated to expansion DM and/or the I/O Comment Area. Make sure that there is enough excess capacity in the ladder program area before allocating memory to expansion DM and/or the I/O Comment Area. 2. The default setting for the UM area doesn’t have any memory allocated to expansion DM or the I/O Comment Area. This memory must be allocated by the user as required.
70
Page 89
Section 3-12
EM (Extended Data Memory) Area
3-11 TR (Temporary Relay) Area The TR area provides eight bits that are used only with the LD and OUT instructions to enable certain types of branching ladder diagram programming. The use of TR bits is described in Section 4 Writing and Inputting the Program. TR addresses range from TR 0 though TR 7. Each of these bits can be used as many times as required and in any order required as long as the same LR bit is not used twice in the same instruction block.
3-12 EM (Extended Data Memory) Area In addition to the high-capacity DM area, C200HG and C200HX PCs are equipped with an EM area that can store up to 18K-words of data. The EM area is divided into banks which contain 6,144 words each (EM 0000 through EM 6143). The C200HG PCs have one bank (bank 0) and the C200HX PCs have three banks (banks 0, 1, and 2). The effective bank is called the current bank.
3-12-1 Using the EM Area The EM area can’t be accessed directly by most instructions, but the PCs are provided with the EMBC(––), XFR2(––), BXF2(––), and IEMS(––) instructions to manage EM area data. Instruction EMBC(––) XFR2(––) BXF2(––) IEMS(––)
Example 1
Function Changes the current bank to the specified bank number. Transfers data within the current EM bank or between the current EM bank and one of the regular data areas. Transfers data between the specified EM bank and another EM bank or a regular data area. Switches the destination of indirect addressing to the specified EM bank. Can also switch the destination back to DM.
The following example uses EMBC(––) to set the current bank to bank 1 and XFR2(––) to transfer the contents of EM 2000 through EM 2999 to DM 0000 through DM 0999. After execution of a program section, the contents of DM 0000 through DM 0999 are transferred back to EM 2000 through EM 2999.
EMBC #0001
XFR2 #1000 #2000 D0000
Data processing performed with data in DM 0000 through DM 0999. XFR2 #1000 D0000 #2000
Note If BXF2(––) were used to perform the data transfers, any EM bank could be specified and EMBC(––) would not be required to select EM bank 1. Example 2
The following example uses IEMS(––) to change the destination for indirect addressing to EM bank 1. After this instruction is executed, operands
71
Page 90
Section 3-12
EM (Extended Data Memory) Area access words in EM bank 1 and not the DM area. In this case, the second operand in the MOV(21) instruction transfers #1234 to a word in the EM bank. (For example, #1234 will be moved to EM 0100 if DM 0000 contains 0100.) Later in the program, the destination for indirect addressing is switched back to the DM area by executing IEMS(––) with an operand of 000.
IEMS #E0B1
MOV #1234 ∗D0000
IEMS 000
Note
1. Be sure to return the indirect addressing destination to its default (the DM area) when necessary. The destination will be returned to the DM area automatically at the beginning of the next cycle. 2. The destination for indirect addressing reverts to the DM area at the start of interrupt subroutines, but can be changed within a subroutine. The destination is returned to its original setting when control is returned to the main program.
3-12-2 The Current EM Bank The current EM bank is set to bank 0 when the PC is turned on, and the current EM bank can be changed by EMBC(––) or IEMS(––). Unlike the destination for indirect addressing, the current bank number is not initialized at the start of a cycle or the start of an interrupt subroutine. After the PC has been turned ON, the switched bank status will be resumed after the PC mode is changed or execution of an interrupt subroutine is completed.
72
Page 91
SECTION 4 Writing and Inputting the Program This section explains the basic steps and concepts involved in writing a basic ladder diagram program, inputting the program into memory, and executing it. It introduces the instructions that are used to build the basic structure of the ladder diagram and control its execution. The entire set of instructions used in programming is described in Section 5 Instruction Set. 4-1 4-2 4-3 4-4
Basic Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Instruction Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Program Capacity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Basic Ladder Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4-1 Basic Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4-2 Mnemonic Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4-3 Ladder Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4-4 OUTPUT and OUTPUT NOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4-5 The END Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4-6 Logic Block Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4-7 Coding Multiple Right-hand Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5 The Programming Console . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5-1 The Keyboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5-2 PC Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5-3 The Display Message Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6 Preparation for Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6-1 Entering the Password . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6-2 Buzzer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6-3 Clearing Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6-4 Registering the I/O Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6-5 Clearing Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6-6 Verifying the I/O Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6-7 Reading the I/O Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6-8 Clearing the I/O Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6-9 SYSMAC NET Link Table Transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7 Inputting, Modifying, and Checking the Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7-1 Setting and Reading from Program Memory Address . . . . . . . . . . . . . . . . . . . . . 4-7-2 Entering and Editing Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7-3 Checking the Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7-4 Displaying the Cycle Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7-5 Program Searches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7-6 Inserting and Deleting Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7-7 Branching Instruction Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7-8 Jumps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8 Controlling Bit Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8-1 DIFFERENTIATE UP and DIFFERENTIATE DOWN . . . . . . . . . . . . . . . . . . . . 4-8-2 KEEP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8-3 Self-maintaining Bits (Seal) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9 Work Bits (Internal Relays) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-10 Programming Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-11 Program Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12 Special I/O Unit Interface Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12-1 Restarting Special I/O Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12-2 Special I/O Unit Error Processing Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12-3 Changing the Special I/O Unit Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12-4 Special I/O Unit I/O Refreshing Interval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12-5 Reducing the Cycle Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13 Analog Timer Unit Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13-1 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13-2 Bit Allocation and DIP Switch Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13-3 Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
74 74 75 75 76 76 77 80 80 81 88 88 88 91 91 91 92 92 93 96 97 97 99 101 102 104 104 105 108 110 111 112 115 119 120 121 121 121 122 124 126 126 126 127 127 128 129 130 130 131 132
73
Page 92
Section 4-2
Instruction Terminology
4-1
Basic Procedure There are several basic steps involved in writing a program. Sheets that can be copied to aid in programming are provided in Appendix F Word Assignment Recording Sheets and Appendix G Program Coding Sheet. 1, 2, 3...
4-2
1. Obtain a list of all I/O devices and the I/O points that have been assigned to them and prepare a table that shows the I/O bit allocated to each I/O device. 2. If the PC has any Units that are allocated words in data areas other than the IR area or are allocated IR words in which the function of each bit is specified by the Unit, prepare similar tables to show what words are used for which Units and what function is served by each bit within the words. These Units include Special I/O Units and Link Units. 3. Determine what words are available for work bits and prepare a table in which you can allocate these as you use them. 4. Also prepare tables of TC numbers and jump numbers so that you can allocate these as you use them. Remember, the function of a TC number can be defined only once within the program; jump numbers 01 through 99 can be used only once each. (TC numbers are described in 5-14 Timer and Counter Instructions; jump numbers are described later in this section.) 5. Draw the ladder diagram. 6. Input the program into the CPU Unit. When using the Programming Console, this will involve converting the program to mnemonic form. 7. Check the program for syntax errors and correct these. 8. Execute the program to check for execution errors and correct these. 9. After the entire Control System has been installed and is ready for use, execute the program and fine tune it if required. 10. Make a backup copy of the program. The basics of ladder-diagram programming and conversion to mnemonic code are described in 4-4 Basic Ladder Diagrams. Preparing for and inputting the program via the Programming Console are described in 4-5 The Programming Console through 4-7 Inputting, Modifying, and Checking the Program. The rest of Section 4 covers more advanced programming, programming precautions, and program execution. All special application instructions are covered in Section 5 Instruction Set. Debugging is described in Section 7 Program Monitoring and Execution. Section 9 Troubleshooting also provides information required for debugging.
Instruction Terminology There are basically two types of instructions used in ladder-diagram programming: instructions that correspond to the conditions on the ladder diagram and are used in instruction form only when converting a program to mnemonic code and instructions that are used on the right side of the ladder diagram and are executed according to the conditions on the instruction lines leading to them. Most instructions have at least one or more operands associated with them. Operands indicate or provide the data on which an instruction is to be performed. These are sometimes input as the actual numeric values, but are usually the addresses of data area words or bits that contain the data to be used. For instance, a MOVE instruction that has IR 000 designated as the source operand will move the contents of IR 000 to some other location. The other location is also designated as an operand. A bit whose address is designated as an operand is called an operand bit; a word whose address is designated as an operand is called an operand word. If the actual value is entered as a constant, it is preceded by # to indicate that it is not an address. Other terms used in describing instructions are introduced in Section 5 Instruction Set.
74
Page 93
Section 4-4
Basic Ladder Diagrams
4-3
Program Capacity The maximum user program size varies with the amount of UM allocated to expansion DM and the I/O Comment Area. Approximately 10.1 KW are available for the ladder program when 3 KW are allocated to expansion DM and 2 KW are allocated to I/O comments as shown below. Refer to the 3-10 UM Area for further information on UM allocation. DM 6144
DM 6600
DM 6655
PC Setup
DM 7000
Reserved
DM 9999 Expansion DM Area
I/O Comment Area
Ladder program
Variable size Fixed DM Area
4-4
Ladder Program Area (15.1 KW)
Basic Ladder Diagrams A ladder diagram consists of one line running down the left side with lines branching off to the right. The line on the left is called the bus bar; the branching lines, instruction lines or rungs. Along the instruction lines are placed conditions that lead to other instructions on the right side. The logical combinations of these conditions determine when and how the instructions at the right are executed. A ladder diagram is shown below. 00000 06315
25208
HR 0109
LR 2503
24400
24401 Instruction
00001
00100 00002
00501
00003 HR 0050
00502
00007 TIM 001 LR 0515
00503
00504
00403
00405 Instruction
00010
21001
21002
00011
21005
21007
As shown in the diagram above, instruction lines can branch apart and they can join back together. The vertical pairs of lines are called conditions. Conditions without diagonal lines through them are called normally open conditions and correspond to a LOAD, AND, or OR instruction. The conditions with diagonal lines through them are called normally closed conditions and correspond to a LOAD NOT, AND NOT, or OR NOT instruction. The number above each condition indicates the operand bit for the instruction. It is the status of the bit associated with each condition that determines the execution condition for following instructions. The way the operation of each of the instructions corresponds to a condition is described below. Before we consider these, however, there are some basic terms that must be explained. Note When displaying ladder diagrams with SSS, a second bus bar will be shown on the right side of the ladder diagram and will be connected to all instructions on the right side. This does not change the ladder-diagram program in any functional sense. No conditions can be placed between the instructions on the right side and the right bus bar, i.e., all instructions on the right must be connected directly to the right bus bar. Refer to the SSS Operation Manual: C Series for details.
75