Home
Chapter 9 - AutomationDirect
Contents
1. a 16 point output O O O x x O module 2 bytes 2 CMP Compare a 2 byte BCD reference D F70 or a 4 digit BCD constant to the O O O O O O oo accumulator an D ADD Add a 2 byte BCD reference or a amp F71 4 digit BCD constant to the O O O O O O z accumulator E SUBTRACT Subtract a 2 byte BCD reference or D Math F72 a 4 digit BCD constant from the O O O O O O Q accumulator L MULTIPLY Multiply a 2 byte BCD reference or F73 a 4 digit BCD constant by the value O O O O O O in the accumulator DIVIDE Divide the accumulator by a 2 byte F74 BCD reference or a 4 digit BCD O O O O O O constant Oo Memory Type available for use with the instruction X Not available DL305 User Manual Rev D Programming Basics Memory Areas an 4 digit Shift D t Category Mnemonic escription V0 CRs 3 Data Cunen BCD Register SISS aE Const Coils DAND Performs a bit AND on a 2 byte F75 reference or a 4 digit BCD constant O O O O O O and the bits in the accumulator DOR Performs a bit OR on a 2 byte F76 reference or a 4 digit BCD constant O O O O O O and the bits in the accumulator ae RE SHIFT Shifts the contents of the anipulation RIGHT accumulator to the right a specified F80 number of times 1 15 bits can be 5 x x x x 5 shifted SHIFT LEFT Shifts the contents of the F81 accumulator to the left a specified number of times x x x x x
2. 1 15 bits can be shifted DECODE Decodes the first 4 bits of the F82 accumulator into a decimal number a x x x ENCODE Encodes an accumulator bit into a F83 4 bit code that represents the x x x x x x decimal number 0 15 Data s INV Logically inverts the contents of the Conversion F84 accumulator 1 to 0 0 to 1 x x x x x x BCD BIN Converts the accumulator value F85 from BCD to Binary x ms x x a x BIN BCD Converts the accumulator value F86 from Binary to BCD ms x x s x Fault FAULT Sends a 4 digit BCD number from Den ti F20 a 2 byte reference or a constant to x x x x x x erecHon the programmer display Oo Memory Type available for use with the instruction X Not available v fe Q ml w 3 J Q W ped iy 9 n DL305 User Manual Rev D
3. Programming Basics In This Chapter Introduction Using Boolean Instructions Using Timers Using Counters Using the Accumulator oe Programming Basics i 2 N oO ian e z oO he o gt O o Introduction This chapter describes some basic programming concepts used with the DL305 CPUs It doesn t provide detailed information on each instruction but instead shows how you can use the most basic elements of the instruction set If you have quite a bit of PLC programming experience you may already know some of the information However we suggest you at least read the portion that discusses the accumulator operation The accumulator is used in many different operations This chapter provides an overview of the following programming concepts 1 Boolean Instructions Timer Instructions Counter Instructions Shift Register Instruction Accumulator Instructions I le oa Detailed examples of all categories of instructions are included in Chapters 11 amp 12 The DL305 CPUs can be programmed with the DirectSOFT PC based programming package or by using the DL305 handheld programmer There is a separate manual available for each of these products If your are not familiar with the chosen programming device we recommend you use the appropriate programming device manual along with this manual to program your DL305 system The following examples will help you understand how DL305 instru
4. a in some way also use the accumulator Accumulator Data The result of the change resides in the accumulator The original data that was being changed is cleared from the accumulator In the following example when input 000 is on the value in ROOO and R010 is loaded into the accumulator using the Data Store 5 F55 instruction The bit pattern in the accumulator is shifted to the left 4 bit positions using the Shift Left F80 instruction Notice how the result resides in the accumulator The value in the accumulator is copied to data registers R404 and R405 using the Data Out F60 instruction DirectSOFT Display R010 R 000 000 6 9 3 5 DSTRS F55 R 000 Load the value in registers RO and R10 into the accumulator O Points 100 107 O Points 000 007 765 43 21 0 7 6543210 O 1 1 0 1 0 O 1 0 7 1 0 1 a Shifted out of accumulator 0 1 1 0 15 14 13 12 11109 8 6543210 SHFL F80 K4 Acc 1 0 0 1 0 of 1 1 of 1 of 1 of of of o Shift the value in the accumulator 4 bits to the left 776 will be ON after the shift 777 will be OFF after the shift DOUT F60 9 3 15 0 R 404 R405 R404 Copy the value in the accumulator to registers R404 and R405 776 Shifted a 1 out of Accumula
5. ctions are put together to create a program solution DL305 User Manual Rev D Programming Basics Ea Using Boolean Instructions END Statement Simple Rungs Normally Closed Contact Do you ever wonder why so many PLC manufacturers always quote the scan time for a 1K boolean program Simple Most all programs utilize many boolean instructions These are typically very simple instructions designed to join input and output contacts in various series and parallel combinations Since the DirectSOFT package allows you to use graphic symbols to build the program you don t absolutely have to know the boolean equivalents of the instructions However it may be helpful at some point especially if you ever have to troubleshoot the program with a Handheld Programmer The following paragraphs show how these boolean instructions are used to build simple ladder programs All DL305 programs require an END statement as the last instruction This tells the CPU this is the end of the program Any instructions placed after the END statement will not be executed This can be useful in some cases See Chapter 13 for an example 000 020 Cc OUT All programs must have lt 7 and END statement Oe no You use a contact to start rungs that contain both contacts and coils The boolean instruction that does this is called a Store or STR instruction The output point is represented by the Output or OUT instruction The following examp
6. le shows how to enter a single contact and a single output coil DirectSOFT Example Handheld Mnemonics STR 000 x 000 020 fe ut OUT 020 a END D T 3 a oS END p ep 2 0p Normally closed contacts are also very common This is accomplished with the Store Not or STRN instruction The following example shows a simple rung with a normally closed contact DirectSOFT Example Handheld Mnemonics TRN 099 020 OUT 020 fa our END no DL305 User Manual Rev D Programming Basics Contacts in Series Use the AND instruction to join two or more contacts in series The following example shows two contacts in series and a single output coil DirectSOFT Example Handheld Mnemonics 000 001 020 STR 000 d OUT OUT 020 END eD Midline Outputs Sometimes it is necessary to use midline outputs to get additional outputs that are conditional on other contacts The following example shows how you can use the AND instruction to continue a rung with more conditional outputs DirectSOFT Example Handheld Mnemonics 000 001 020 STR 000 hia 4 OUT QUT 010 AND 002 002 021 OUT 021 o A T AND 003 VOUT OUT 022 END 003 022 our END END Parallel Elements You may also join contacts in parallel The OR instruction allows you to do this The following example shows two contacts in parallel and a single output coil cp O B DirectSOFT Example Ha
7. n to off the timer current value is reset to 0 Timers normally time in tenth of a second intervals but you can turn on Special Relay 770 to change the timers to hundredth of a second intervals There is discrete bit associated with each timer to indicate the current value is equal to or greater than the preset value The timing diagram below shows the relationship between the timer input associated discrete bit current value and timer preset 1 i TMR T600 Input K30 001 Timer preset T600 020 Timer L OUT id T600 L Contact Current 0 10 20 30 40 50 60 0 Value i 2 N oO aa oO he o gt O o DL305 User Manual Rev D Programming Basics Using Counters Counters are used to count events There are two types of counters e Regular Up counters e Stage counters used with the RLL YS instructions The up counter has two inputs a count input and a reset input The maximum count value is 9999 The timing diagram below shows the relationship between the counter input counter reset associated discrete bit current value and counter preset 0 1 2 3 4 5 6 7 8 001 CNT Up K3 C 00 001 002 Reset 002 Counter preset CT600 Current 1 2 3 4 0 Value The stage counter has a count input and is reset by the RST instr
8. ndheld Mnemonics faa 000 Pa STR 000 o our OR 001 OUT 020 001 END gt fe Eno END DL305 User Manual Rev D Joining Series Branches in Parallel Joining Parallel Programming Basics Quite often it is necessary to join several groups of series elements in parallel The Or Store ORSTR instruction allows this operation The following example shows a simple network consisting of series elements joined in parallel DirectSOFT Example Handheld Mnemonics any eee F EA our STR 002 AND 003 002 003 ORSTR OUT 020 END END Quite often it is also necessary to join one or more parallel branches in series The Branches in Series And Store ANDSTR instruction allows this operation The following example Comparative Boolean shows a simple network with contact branches in series with parallel contacts DirectSOFT Example Handheld Mnemonics 000 001 020 STR 000 our STR 001 OR 002 002 ANDSTR OUT 020 6 END Many applications require comparisons of data values This is especially true in applications that use counters Some PLC manufacturers make it really difficult to do a simple comparison of a counter value and a constant or register The DL330 and DL340 CPUs provide Comparative Boolean instructions that allow you to quickly and easily solve this problem Comparative Boolean evaluates two 4 digit values using boolean contacts The valid evaluations a
9. re equal and not equal In the following example when the value C600 K1234 020 in counter C600 is equal to the constant our value 1234 output 020 will energize The DL330P also provides Comparative Boolean instructions but they are greater than and less than instructions instead of equal and not equal DL305 User Manual Rev D 4 a O Ke Q D 3 3 3 Co w D o O 2 i 2 N oO ian e z oO he o gt O o Programming Basics Combination Networks Boolean Stack You can combine the various types of series and parallel branches to solve most any application problem The following example shows a simple combination network 000 002 005 020 our 6E 001 003 004 Gs There are limits to how many elements you can include in a rung This is because the DL305 CPUs use an 8 level boolean stack to evaluate the various logic elements The boolean stack is a temporary storage area that solves the logic for the rung Each time you enter a STR instruction the instruction is placed on the top of the boolean stack Any other instructions on the boolean stack are pushed down a level The AND OR ANDSTR and ORSTR instructions combine levels of the boolean stack when they are encountered Since the boolean stack is only eight levels an error will occur if the CPU encounters a rung that uses more than the eigh
10. t levels of the boolean stack All of you software programmers may be saying use DirectSOFT so don t need to know how the stack works Not quite true Even though you can build the network with the graphic symbols the limits of the CPU are still the same If the stack limit is exceeded when the program is compiled an error will occur DL305 User Manual Rev D 9 7 Programming Basics The following example shows how the boolean stack is used to solve boolean logic 000 001 ORSTR AND 004 020 STR S STR our Output 2 a 002 AND ps ANDSTR 005 OR STR 000 STR 001 STR 002 AND 003 1 STR 000 1 STR 001 1 STR 002 1 002 AND 003 2 2 STR OOO 2 STR 001 2 STR 001 3 3 3 STR 000 3 STR 000 4 4 4 4 5 5 5 5 6 6 6 6 7 7 7 7 8 8 8 8 ORSTR AND 004 OR 005 1 001 OR 002 AND 003 1 004 AND 001 OR 002 AND 003 1 NOT 005 OR 004 AND 001 OR 002 AND 003 2 STR OOO 2 STR OOO 2 STROOO 3 3 3 8 8 8 ANDSTR y 1 000 AND NOT 005 OR 004 AND 001 OR 002 AND 003 2 R 3 3 co JJ fad 8 o e wn DL305 User Manual Rev D Programming Basics Using Timers Timers are used to time an event for a desired length of time The single input timer will time as long as the input is on When the input changes from o
11. t to data registers R404 and R405 using the Data Out F60 instruction DirectSOFT Display R 403 R 402 000 7 5 0 2 DSTR F50 lt 7 R 402 7 5 0 2 Accumulator DOUT F60 R 404 Z 3 7 5 0 2 R405 R404 You probably noticed it took two registers to hold a 4 digit BCD number This is because each BCD digit requires four binary bit positions Since the accumulator is 16 bits and register locations are 8 bits there are variations of the DSTR and DOUT instructions that allow you to copy a single register or even half of a register 4 bits either to or from the accumulator The following example shows how you could use the DSTR3 and DOUT2 instructions to copy the lower 4 bits from register 5 to the upper 4 bits of register 16 These registers correspond to I O points and Control Relays respectively DirectSOFT Display R005 000 DSTR3 F53 Theu pper 4 bits of R5 R 005 are not loaded into the Load the lower 4 bits in accumulator l register 5 into the lower 4 bits O 0 O 8 Accumulator of the accumulator 7 DOUT2 F62 The upper 4 bits of R400 g R016 are not altered R016 Output the lower 4 bits of the accumulator to the upper 4 bits of R16 DL305 User Manual Rev D Programming Basics Changing the Instructions that change or manipulate dat
12. tor 777 Accumulator equals zero after shift J T O co Q D 3 3 3 Co w D o O a DL305 User Manual Rev D Programming Basics Accumulator The following table lists several instructions that utilize the accumulator Not all Operations instructions allow you to use all the different memory types Chapters 11 amp 12 provide details on these instructions Memory Areas inti 4 digit Shift D Category Mnemonic escription vo CRs 3 site Curent BCD Register eas anes Const Coils DSTR Load a 4 digit constant or a 2 bytes F50 of register data into the O O O O O O accumulator DSTR 1 Load 1 byte of register data into the F51 accumulator Oo O O x O DSTR 2 Load the upper 4 bits of a register F52 into the lower 4 bits of the O O O x x O Data Load accumulator DSTR 3 Load the lower 4 bits of a register F53 into the upper 4 bits of the O O O x x O accumulator DSTR 5 Load the digital values of 16 I O F55 points 2 bytes into the O x x x x x accumulator DOUT Write the accumulator to 2 p F60 sequential registers Q 2 O O 2 O DOUT 1 Write the lower byte of the F61 accumulator to a register Q 2 OQ x im O DOUT 2 Write the lower 4 bits of the F62 accumulator to the upper 4 bits of a O O O x x O Data Out register DOUT 3 Write the lower 4 bits of the F63 accumulator to the lower 4 bits of a O O O x x O register DOUT 5 Write the contents of the F65 accumulator to
13. uction This instruction is used with the RLLP US instructions The maximum count value is 9999 The timing diagram below shows the relationship between the counter input associated discrete bit current value counter preset and reset instruction 0 1 2 3 4 5 6 7 8 mi SGCNT C600 K3 001 Up Counter preset CT600 Lo Current 1 2 3 4 0 Value RST CT v je Q ml w 3 Q W ped iy 9 n DL305 User Manual Rev D i 2 N oO aa oO he o gt O o Programming Basics Using the Accumulator Copying Data to and from the Accumulator The accumulator in the DL305 series CPUs is a 16 bit register which is used as a temporary storage location for data being copied or manipulated in some manor For example you have to use the accumulator to perform math operations such as add subtract multiply etc Since there are 16 bits you can use up to a 4 digit BCD number The accumulator is reset to 0 at the end of every CPU scan The Data Store DSTR and Data Out DOUT instructions and their variations are used to copy data from a register location to the accumulator or to copy data from the accumulator to a register location In the following example when input 000 is on the value 7502 in R402 and R403 is loaded into the accumulator using the Data Store F50 instruction The value in the accumulator is outpu
Download Pdf Manuals
Related Search
Related Contents
Nokia 3595 Cell Phone User Manual Notice - Castorama ECS A990FXM-A DELUXE (V1.0) motherboard Copyright © All rights reserved.
Failed to retrieve file