background image

1

4

RLL Programming for
Communications

In This Chapter. . . .

— PLC-to-PLC Communications
— How RLL is Used for Communications
— Network Instructions
— Addressing the Different Memory Types
— Special Relays for Communications
— Example Program with One Read Instruction
— Example Program with One Write Instruction
— Integrating Multiple Read and Write Instructions

Summary of Contents for D0-DCM

Page 1: ...D0 DCM Data Communications Module Manual Number D0 DCM M...

Page 2: ...nt in hazardous environments requiring fail safe performance such as in the operation of nuclear facilities aircraft navigation or communication systems air traffic control direct life support machine...

Page 3: ...ereux n cessitant une s curit absolue par exemple l exploitation d installations nucl aires les syst mes de navigation a rienne ou de communication le contr le de la circulation a rienne les quipement...

Page 4: ...If you contact us in reference to this manual please remember to include the revision number Title DL05 06 Data Communications Module Manual Number D0 DCM M Issue Date Description of Changes Original...

Page 5: ...matics 2 4 Consideration 4 Cable Specifications 2 5 Consideration 5 Installation Guidelines 2 5 Wiring Diagrams 2 6 D0 DCM Port 1 RS 232 Network 2 6 D0 DCM Port 2 RS 232 Network 2 6 D0 DCM Port 2 RS 4...

Page 6: ...X Instruction 4 5 Addressing the Different Memory Types 4 6 Bit Memory 4 6 Word Memory and Aliases 4 6 DL05 CPU 4 7 DirectSOFT32 is Flexible 4 7 DL06 CPU 4 7 Special Relays for Communications 4 8 Prog...

Page 7: ...Y 5 6 Example 1 V2100 5 8 Example 2 Y20 5 8 Example 3 C54 5 8 Network Master Operation 5 9 MODBUS Function Codes Supported 5 9 PLC Memory Supported for Master Operation 5 10 Example 1 Calculating Word...

Page 8: ......

Page 9: ...1 1 Introduction In This Chapter Manual Overview D0 DCM Hardware Features D0 DCM Applications...

Page 10: ...2 Programming Software part number PC DSOFT32 M If you plan to use your D0 DCM to communicate with another PLC you will need the appropriate user manual for the other PLC If you plan to use your D0 DC...

Page 11: ...note pad icon in the left hand margin indicates a special note The exclamation mark icon in the left hand margin indicates a warning or caution These are very important because the information may hel...

Page 12: ...rt 2 RS232 422 485 Communication Port TX1 Port 1 Transmitting Data Green RX1 Port 1 Receiving Data Green Error Red Status Indicators TX1 TX2 DAT A COMM PORT2 RX1 ERR RX2 ERR TX2 Port 2 Transmitting da...

Page 13: ...your RLL program to initiate the data exchange The D0 DCM takes communication requests issued by the PLC program instructions and automatically converts these requests into network commands that read...

Page 14: ...erve as a MODBUS RTU slave Port 2 can serve as a MODBUS RTU master or slave This manual does not describe the MODBUS protocol We recommend that you reference the Gould MODBUS Protocol Reference Guide...

Page 15: ...1 2 Installation Network Cabling and Module Specifications In This Chapter Inserting the D0 DCM into the PLC Building the Communication Cable Wiring Diagrams Module Specifications...

Page 16: ...CPU TX1 RX1 TX2 RX2 D0 06DR PORT2 TERM DL05 Front View DL06 Front View DL06 Top View Remove top slot cover with small flat head screwdriver Insert the module into the open slot in the DL05 or into any...

Page 17: ...to point connection only has two stations a master and a slave Use the point to point configuration to connect a personal computer an operator interface or an intelligent device to a single D0 DCM You...

Page 18: ...the network configuration and electrical specification are important the type of devices being connected to the D0 DCM are just as important The exact cable schematic needed really depends on a combin...

Page 19: ...se noise problems Route the cable through an approved cable housing to minimize the risk of accidental cable damage Check local and national codes to choose the correct method for your application Con...

Page 20: ...1 0V 0V 1 TXD 4 RXD 3 RXD TXD Signal GND RXD 1 5 6 10 11 15 TXD 7 2 3 4 TXD RXD GND RTS CTS RTS CTS RTS OR Loop Back D0 DCM Port 2 RS 232 Network TXD RXD TXD RXD Termination Resistor Signal GND Connec...

Page 21: ...ing data transmission You must select resistors that match the cable impedance For example a typical 22 AWG solid conductor cable with 4 5 twists per foot has a typical impedance of about 120 ohm Ther...

Page 22: ...Method 516 2 Voltage Isolation 1000 VAC 1 minute duration Insulation Resistance 10M ohms at 500 VDC Noise Immunity NEMA ICS3 304 UL CE FCC Class A Class 1 Division 2 C1D2 Weight 1 75 oz 50g Connector...

Page 23: ...Maximum Distance RS232 15 m RS422 485 1000m 1 5 11 15 10 6 Port 2 Port 2 Pin Descriptions 1 5V 5 VDC 2 TXD2 Transmit Data RS 232 3 RXD2 Receive Data RS 232 4 RTS2 Ready to Send RS 232 5 CTS2 Clear to...

Page 24: ......

Page 25: ...D0 DCM Module Configuration Registers 3 In This Chapter DCM Port Configuration Registers DL05 Ladder Logic Port Setup Examples DL06 Ladder Logic Port Setup Examples...

Page 26: ...485 Mode Select 0002 V7702 V702 V712 V722 V732 D Port 2 Station Address Baud Rate Data Bit Stop Bit Parity 0003 V7703 V703 V713 V723 V733 E Port 2 Character Time out 0006 V7706 V706 V716 V726 V736 F P...

Page 27: ...there s more data it takes longer to transfer If you have a device on the network that requires ASCII mode then configure the DCM for ASCII mode otherwise use HEX mode Baud Rate There are several bau...

Page 28: ...protocol or auto detect for all three protocols HEX or ASCII transmit mode MSB LSB 0 7 6 5 4 3 2 1 Transmit Mode Protocol word 0000 1 5 Set all unused bits to zero Port 1 Transmit Mode Mode Bit 3 HEX...

Page 29: ...3 2 1 Baud Rate Station Address 1 5 1 4 1 3 1 2 Parity word 0001 Set all unused bits to zero Port 1 Station Address Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 00 0 0 0 0 0 0 0 0 01 0 0 0...

Page 30: ...ation Time out Echo Suppression MSB LSB 0 1 1 1 0 9 8 7 6 5 4 3 2 1 Protocol RTS off delay 1 5 1 4 1 3 1 2 word 0002 Transmit Mode Comm Time out Echo Suppression RTS on delay Set all unused bits to ze...

Page 31: ...E 1 1 1 0 Port 2 Communication Time out ms K Seq D Net MODBUS RTU Non Sequence Protocol Bit 10 Bit 9 Bit 8 Base Time x 1 0 0 0 0 Base Time x 1 2 2 0 0 1 Base Time x 1 5 5 0 1 0 Base Time x 2 10 0 1 1...

Page 32: ...d Rate Station Address 1 5 1 4 1 3 1 2 Parity word 0003 Data Bit Stop Bit Set all unused bits to zero Port 2 Station Address Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 00 0 0 0 0 0 0 0 0...

Page 33: ...Bit 0 2 Bit 1 Port 2 Parity Parity Bit 15 Bit 14 No Parity 0 0 Odd Parity 0 1 Even Parity 1 0 Use word 0006 to set Port 2 Character Time out BCD This parameter is used when the DCM is used as a MODBU...

Page 34: ...nfiguration registers If the requested changes are valid a 00AA hex will then be written to word 0007 If the desired or new communications are invalid or out of range an error code 00E Hex will be wri...

Page 35: ...on code that must be used to request that the CPU recognizes the new desired port parameters LD KE0 LD K4601 OUT V7703 LD K55 SP0 Selects auto detect protocol mode K seq D Net and MODBUS HEX transmit...

Page 36: ...de that must be used to request that the CPU recognizes the new desired port parameters LD K20 LD K4601 OUT V7703 LD K0 SP0 Selects MODBUS protocol HEX transmit mode RTS On Off delay times are set to...

Page 37: ...t location K55 is the port setup completion code that must be used to request that the CPU recognizes the new desired port parameters LD KE0 LD K4601 OUT V703 LD K55 SP0 Selects auto detect protocol m...

Page 38: ...e used to request that the CPU recognizes the new desired port parameters LD K20 LD K4601 OUT V703 LD K0 SP0 Selects MODBUS protocol HEX transmit mode RTS On Off delay times are set to zero and RS 422...

Page 39: ...nications How RLL is Used for Communications Network Instructions Addressing the Different Memory Types Special Relays for Communications Example Program with One Read Instruction Example Program with...

Page 40: ...r the PC software you are using How RLL is Used for Communications DirectSOFT32 Programming Software provides Read and Write instructions RX WX for PLC to PLC communication over a network The Read and...

Page 41: ...al for your PLC For network communications you build the Read RX or Write WX instructions into a routine which requires the four instructions you see to the right The function of each of these instruc...

Page 42: ...information about addressing Word and Bit Memory see page 4 6 LD K8 LD K114 PLC Memory 4 words 8 bytes LD K8 LD K114 LDA O40600 The Load Address LDA instruction specifies the V memory address of the b...

Page 43: ...ng at C177 in the slave PLC is read copied into the master PLC s memory beginning at V40600 LDA O40600 LD K8 LD K114 RX C100 C100 C177 bit bit The Write WX instruction specifies the memory location to...

Page 44: ...een bits from C0 through C17 Aliases are a convenient substitute for V memory designations and can be used interchangeably in Read and Write instructions VC0 is the alias for V40600 Either nomenclatur...

Page 45: ...t Points Y0 Y377 V40500 V40517 VY0 VY360 Control Relays C0 C777 V40600 V40677 VC0 VC760 Special Relays SP0 SP777 V41200 V41237 VSP0 VSP760 Timer Status Bits T0 T177 V41100 V41107 VT0 VT160 Counter Sta...

Page 46: ...ror automatically clears the bit resets to zero when another RX or WX instruction executes Y50 SP125 SP124 LD LD LDA RX For example Special Relays SP124 and SP125 correspond to an DCM module in slot 3...

Page 47: ...n the input X0 to the slave PLC is turned on transitions from 0 to 1 the C0 bit in the master PLC also transitions from 0 to 1 The program in the master PLC causes Y0 to turn on in response to the C0...

Page 48: ...2 LDA O40600 RX VC100 SP122 The Special Relay labeled SP122 is on when slot 2 is busy transmitting or receiving The Read instruction may take longer than one PLC scan to complete Use this Special Rela...

Page 49: ...PLC also transitions from 0 to 1 The program in the slave PLC causes Y0 to turn on in response to the C100 bit NOTE The slave PLC logic is a basic example only If the master slave communication fails...

Page 50: ...LD K214 LD K2 LDA O40600 WX VC100 SP122 The Special Relay labeled SP122 is on when slot 2 is busy transmitting or receiving The Write instruction may take longer than one PLC scan to complete Use thi...

Page 51: ...derstand the Example Programs on pages 4 9 and 4 11 as well as the material in the Network Instructions section beginning on page 4 3 The following program segment sequences through three RX WX instru...

Page 52: ...this rung to permit power flow to the first WX instruction Both bits are off corresponding to the first row of the truth table After the WX instruction is executed C50 is SET turned on which opens the...

Page 53: ...A O40602 RX VC20 SP122 RST C51 C51 C50 RST C50 In this last rung C50 is normally closed and C51 is normally open For this rung to be executed the C50 bit must be off and the C51 bit must be on corresp...

Page 54: ...s executes the Shift Register moves the set bit over one place C63 is used in this example to reset the Shift Register to all zeros C60 C77 SP122 C63 Shift Register after first RX WX C74 C73 C72 C71 C...

Page 55: ...cking contact It is turned on by the sequencing steps of the Shift Register in a preceding rung LD K214 LD K2 LDA O40602 RX VC20 SP122 C62 C62 is the interlocking contact It is turned on by the sequen...

Page 56: ......

Page 57: ...1 5 D0 DCM Using MODBUSr RTU In This Chapter Network Slave Operation Network Master Operation...

Page 58: ...nction DL05 06 Data Types Available 01 Read Output Table Y C T CT 02 Read Input Table X SP 03 Read Holding Registers when addressing mode is 584 984 this function is used to ac cess analog output regi...

Page 59: ...utomated MODBUS Koyo address conversion utility download the file modbus_conversion xls from the www automationdirect com technical support website Technical and Application notes PLC hardware Coummun...

Page 60: ...il Control Relays C 1024 C0 C1777 3072 4095 Coil Timer Contacts T 256 T0 T377 6144 6399 Coil Counter Contacts CT 128 CT0 CT177 6400 6527 Coil Stage Status Bits S 1024 S0 S1777 5120 6143 Coil Global In...

Page 61: ...mal 16 3 Add the starting address for the range 2049 4 Use the MODBUS data type from the table PLC Addr Dec Start Addr Data Type Y20 16 decimal 16 2049 Coil Coil 2065 Find the MODBUS address to obtain...

Page 62: ...les show the exact range used for each group of data For an automated MODBUS Koyo address conversion utility download the file modbus_conversion xls from the www automationdirect com technical support...

Page 63: ...e Outputs Y 512 Y0 Y777 2049 2560 Write Control Relays C 1024 C0 C1777 3073 4096 Timer Contacts T 256 T0 T377 6145 6400 Counter Contacts CT 128 CT0 CT177 6401 6528 Stage Status Bits S 1024 S0 S1777 51...

Page 64: ...MODBUS address for output Y20 1 Find Y outputs in the table 2 Convert Y20 into decimal 16 3 Add the starting address for the range 2048 4 Add the MODBUS address for the mode 1 PLC Addr Dec Start Addre...

Page 65: ...ommands we need to load data related to the read or write operation onto the CPU s accumulator stack When the WX or RX instruction executes it uses the information on the stack combined with data in t...

Page 66: ...ication notes PLC hardware Coummunications app note AN MISC 010 DL06 Discrete Data Types PLC Memory Type QTY Dec PLC Range Octal MODBUS Address Range Access Global Inputs GX 2048 GX0 GX1746 10001 1099...

Page 67: ...ired MODBUS address to target 2 Convert decimal result into octal 3 Add octal result to begining PLC range Input Output or Word 2 1024 decimal 2000 octal 1 41025 40001 1024 decimal 3 V0 octal 2000 oct...

Page 68: ...Load LD instruction accepts either a constant or a variable Use a K to designate the number as a constant Use a V if you are entering the address of a register The contents of that register perform t...

Page 69: ...struction the DL05 06 CPU reads the number of bytes previously specified from the server placing the received data into its memory area beginning at the LDA address specified 6 0 0 0 octal LDA O40600...

Page 70: ...se of this bit is optional When used it should be ahead of any network instruction boxes since the error bit is reset when an RX or WX instruction is executed If you are using multiple reads and write...

Reviews: