The text of a manual · part 3 of 8
DN120 DeviceNet Gateway User's Manual, pages 19 to 27
Pages 19 to 27 of 71
The original document is the PDF (1.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 Microscan DN-120
Page 19
DN120 DeviceNet Gateway User’s Manual Serial Channel Baud Rate / Option Switch The DN120 gateway has a rotary switch for the serial channel. This switch has different functions for the DN120 models. The DN120 model uses the rotary switch to select the RS232 channel baud rate. Valid settings are 300, 600, 1200, 2400, 4800, 9600, 19200 bits per second, and PRG (table below). When PRG is selected, the DN120 uses the Baud Rate attribute in the Serial Stream Object. A valid baud rate must be written over DeviceNet to this attribute. POSITION 0 1 2 3 4
SETTING 9600 bps 4800 bps 2400 bps 1200 bps 600 bps
POSITION 5 6 7 8 9
SETTING 300 bps 19200 bps invalid invalid PRG
Power Up Gateway Connect the gateway to a DeviceNet network to power up the gateway. DeviceNet Status LEDs The DN120 gateway has two bi-color status LEDs (NET and MOD) that indicate operational status. During power-up, the LEDs cycle through a sequence of alternating red and green. After power-up, the NET LED should be flashing green (or solid green if allocated to a DeviceNet master) and the MOD LED should be solid green. If this does not occur, disconnect from DeviceNet and verify all the switch settings. See Chapter 8 for additional troubleshooting topics. State Off Flashing Red Solid Red Flashing Green Solid Green
DeviceNet Status LED (NET) No power. Configuration error. Check DeviceNet switch settings. Unrecoverable error. Device not allocated to a DeviceNet master. Normal runtime, device allocated as a slave.
State Off Flashing Red Solid Red Flashing Green Solid Green
Module Status LED (MOD) No power. Configuration error. Check object attribute settings. Unrecoverable error. Not defined. Normal Operation.
Microscan Systems, Inc.
19
Page 20
DN120 DeviceNet Gateway User’s Manual
Serial Channel Status LEDs The gateway has two bi-color LEDs to indicate serial channel activity. The TX LED flashes green when a packet is being transmitted. The RX LED flashes green when a packet is being received. A fault is indicated by solid red. After power-up, both LEDs should be off. State Off Flashing Red Solid Red Flashing Green Solid Green
Transmit Status LED (TX) No data being transmitted Not defined Transmit error (parity or overrun error) Data being transmitted Not defined
State Off Flashing Red Solid Red Flashing Green Solid Green
Receive Status LED (RX) No data being received Not defined Receive error (parity or overrun error) Data being received Not defined
Register EDS File If using a DeviceNet configuration tool that supports Electronic Data Sheet (EDS) files, you should now register the gateway’s EDS file with the software. The latest EDS file versions can be downloaded from www.mksinst.com. Select the EDS file that matches your gateway’s part number and firmware version. Follow your configuration tool instructions to register EDS file.
Microscan Systems, Inc.
20
Page 21
DN120 DeviceNet Gateway User’s Manual
Configure Serial Channel The Serial Stream Object attributes control the DN120 serial channel. These settings apply to all serial transmit and receive operations. Before you can set or change any gateway configuration settings, make sure the gateway is not in the DeviceNet master scanlist. Serial Stream Object Instance Attributes (Class Code 64) Data Type Value Short_String Received message data. Returned in Poll Response Message. or Byte Array Transmit Data Short_String Message data to transmit. Received in Poll Command Message. or Byte Array Status USINT Bit 0 – Transmit Channel Blocked Bit 1 – Transmit Buffer Empty Bit 2 – Receive Parity Error (set = 0 to clear) Bit 3 – Receive Buffer Empty Bit 4 – Receive Buffer Overflow Error (set = 0 to clear) Bit 5 – Framing Error (set = 0 to clear) Bit 6 – Transmit Buffer Overflow Error (set = 0 to clear) Bit 7 – CTS Signal State (1 = asserted) Baud Rate USINT 0 = 9600 bps 4 = 600 bps 1 = 4800 bps 5 = 300 bps 2 = 2400 bps 6 = 19200 bps 3 = 1200 bps Parity USINT 0 = no parity 5 = mark (force to 1) 1 = even parity 6 = space (force to 0) 2 = odd parity Data Size USINT Read-only. 7 bits if parity enabled, 8 bits if no parity. Stop Bits USINT Read-only. Fixed at 1 bit. Flow Control USINT 0 = none 2 = CTS / RTS 1 = XON / XOFF 4 = CTS Detect Mode Receive Count USINT Number of bytes in Receive Buffer. Any write clears buffer. Transmit Count USINT Number of bytes in Transmit Buffer. Any write clears buffer. Maximum Receive Size USINT Defines the maximum #bytes returned by RX Message read. Data Format USINT Bit 0 – String Format (0 = Short_String, 1 = Byte Array) Bit 1 – Strip Parity Bits (0 = retain, 1 = strip) Bit 2 – Pad Justification (0 = left justify, 1 = right justify) Bit 3 – Pad Received Message (0 = no, 1 = yes) Block Mode USINT Bit 0 – Pre/Post Delimiter (0 = pre-delimiter, 1 = post-delimiter) Bit 1 – Strip Delimiter (0 = keep delimiter, 1 = strip delimiter) Bit 2 – Delimiter Enable (0 = no, 1 = yes) Bit 3 – Enable Receive Sequence Number (0 = no, 1 = yes) Bit 4 – Enable Transmit Sequence Number (0 = no, 1 = yes) Bit 5 – Re-send (0 = no, 1 = yes) Bit 6 – Synchronization (0 = no, 1 = handshake protocol) Delimiter USINT Delimiter byte value Pad Character CHAR Pad byte value Maximum Transmit Size USINT Defines the maximum # bytes that can be transmitted. Idle String Short_String 1-16 byte string transmitted when gateway receives a null Poll (no input bytes). Short_String length = 0 for no Idle String.
Number Name 3 Receive Data
4
5
6
7
8 9 10 11 12 13 14
15
16 17 18 19
Microscan Systems, Inc.
21
Page 22
DN120 DeviceNet Gateway User’s Manual 20
Fault String
21 22 23 24
Status Enable Status Clear Enable Four Wire Option Switch
Short_String 1-16 byte string transmitted when gateway’s Polled I/O connection times out. Short_String length = 0 for no Fault String. USINT Set to any nonzero value to enable Status input byte. USINT Set to any nonzero value to enable Status Clear output byte. USINT NA USINT NA
Receive Data – Data from the last valid message packet. Receive Data includes the Status and Receive Sequence Number bytes if enabled, and the RX Message bytes. The RX Message format is either Short_String or Byte Array, defined by Data Format attribute. If no message data is available, the RX Message will be a null packet or Short_String with length = 0. Receive Data is returned in the DeviceNet Poll Response Message. Receive Data Status
Receive Sequence Number
RX Message
Data Format = xxxxxxx0 Length
Data Format = xxxxxxx1
Short_String data bytes
Byte Array data bytes
Transmit Data – Data to transmit out the serial channel by the gateway. Transmit Data includes the Status Clear and Transmit Sequence Number bytes if enabled, and the TX Message bytes. Format is either Short_String or Byte Array, defined by Data Format attribute. Transmit Data is typically received in the DeviceNet Poll Command Message. Reading Transmit Data returns the last byte in the Transmit Buffer. Transmit Data Status Clear
Transmit Sequence Number
Data Format = xxxxxxx0 Length
Short_String data bytes
TX Message
Data Format = xxxxxxx1 Byte Array data bytes
Status – Contains bit-mapped serial channel status and error bits for transmit and receive operations. Clearing the bits indicated will clear the error condition. Baud Rate – Sets the serial channel’s data or baud rate. Enter number from 1-6 to select corresponding baud rate value. For DN120, the RS232 Baud Rate switch must be set to PRG before this attribute can be used to set the baud rate.
Microscan Systems, Inc.
22
Page 23
DN120 DeviceNet Gateway User’s Manual Parity – Selects the parity type used in the serial byte. Data Size – Read-only attribute indicates number of data bits in one serial byte. This number does not include start, parity, or stop bits. If parity is enabled, 7 data bits are used. If no parity, 8 data bits are used. Stop Bits – Read-only attribute indicates number of stop bits in one serial byte. Fixed at 1. Flow Control – Selects the method of flow control used across the serial interface. NONE means there is no flow control over the serial data exchange. The transmitting device can overflow the receiving device’s buffer. XON/XOFF is a software flow control option. Receiving device sends an XOFF character to the transmitting device when its buffer is full, stopping further transmission. It sends an XON character when it can again receive data. The XOFF and XON characters are not saved as message data. CTS/RTS is an RS232 hardware flow control option, available only on the DN120 gateway. The RTS is an output and CTS is an input signal. The gateway keeps RTS active (low) when it can receive data. It only transmits data when CTS is active (low). CTS Detect Mode is an RS232 hardware flow control option, available only on the DN120 gateway. When CTS is asserted, the DN120 serial channel can transmit and receive. When CTS is not asserted, the DN120 serial channel is disabled and Receive Buffer cleared. Receive Count – Number of bytes currently available in the Receive Buffer. Writing any value to this attribute will clear the Receive Buffer. Transmit Count – Number of bytes currently in the Transmit Buffer. Writing any value to this attribute will clear the Transmit Buffer. Maximum Receive Size – Defines the maximum number of data bytes to be returned when the Receive Buffer is read using either an Explicit Message or a Poll Response Message. Data Format – Control byte that defines the format of the TX Message and RX Message bytes transferred across DeviceNet. Bit 3 selects whether the RX Message bytes are padded with the Pad bytes. Set this bit = 1 to enable. If there are not enough message bytes in the Receive Buffer to fill up the RX Message input bytes, then Pad characters are added at either the beginning or end of the message bytes. Bit 2 selects whether Pad bytes are added at the beginning of the message (0 = left justify) or at the end of the message (1 = right justify). This bit is used only if the Pad option is enabled.
Microscan Systems, Inc.
23
Page 24
DN120 DeviceNet Gateway User’s Manual Bit 1 defines whether the gateway saves the parity bit in received message bytes (set = 0), or if the gateway forces the parity bit to 0 in received message bytes (set = 1). This is typically used when receiving 7-bit ASCII data. Bit 0 defines String Format for TX Message and RX Message byte strings. Set to 0 for Short_String format, and 1 for Byte Array format. Short_String defines the first byte as an explicit length byte, containing the number of bytes that follow. Byte Array has an implied length, derived from the Maximum Receive Size attribute. Block Mode – Control byte that defines the serial receive mode, synchronization mode, and resend message option. Bit 6 enables the Handshake Protocol synchronization option. When enabled, the Receive Sequence Number byte is added to Receive Data input bytes, and the Transmit Sequence Number byte is added to the Transmit Data output bytes. Bit 5 enables the re-send message option. When enabled, the gateway continuously returns RX Message data in the Poll Response message. If no new data has been received, then the last data bytes are returned. Bit 4 enables the Transmit Sequence Number synchronization option. When enabled, the Transmit Sequence Number byte is added to the Transmit Data output bytes. Bit 3 enables the Receive Sequence Number synchronization option. When enabled, the Receive Sequence Number byte is added to the Receive Data output bytes. Bit 2 selects the serial receive mode. Set = 0 for Stream Mode, and set = 1 for Block Mode. Bit 1 selects whether the Delimiter is saved in the Receive Buffer (set = 0), or it is discarded (set = 1). This bit is only used when Block Mode is enabled. Bit 0 selects Pre-Delimiter Mode (set = 0) or Post-Delimiter Mode (set = 1). This bit is only used when Block Mode is enabled. Delimiter – Byte value used to indicate the start of a new message (Pre-Delimiter Mode), or the end of a received message (Post-Delimiter Mode). This attribute is only used in Block Mode. Pad Character – Byte value used to pad the RX Message bytes. Maximum Transmit Size – Defines the maximum size of TX Message output bytes, or the maximum number of data bytes to be transmitted across the RS232 channel from one Poll Command message. Idle String – Defines the byte string that is transmitted when the gateway receives a null Poll (no input bytes, or a Short_String value with length = 0). Enter the byte string in Short_String data
Microscan Systems, Inc.
24
Page 25
DN120 DeviceNet Gateway User’s Manual format, with 1st byte = string length. Set the length byte to 0 if you don’t want to transmit an Idle String. The Idle String can be from 0 to 16 bytes long, not counting Short_String length byte. Example Idle String is [ 0x01 0x41 ], where string length is 1 and data byte is 0x41 (‘A’). You must use the RSNetworx Class Instance Editor (Set Attribute Single command) to write a Short_String attribute value. Fault String – Defines the byte string that is transmitted when the gateway’s connection to the DeviceNet master times out. Enter the byte string in Short_String data format, with 1st byte = string length. Set the length byte to 0 if you don’t want to transmit a Fault String. The Fault String can be from 0 to 16 bytes long, not counting Short_String length byte. Example Fault String is [ 0x02 0x42 0x43 ], where string length is 2 and data bytes are 0x42 (‘B’) and 0x43 (‘C’). You must use the RSNetworx Class Instance Editor (Set Attribute Single command) to write a Short_String attribute value. Status Enable – Write any nonzero value to include the Status byte in Receive Data input bytes. Status Clear Enable – Write any nonzero value to include the Status Clear byte in Transmit Data output bytes.
Microscan Systems, Inc.
25
Page 26
DN120 DeviceNet Gateway User’s Manual
Configure DeviceNet Master Scan List You must calculate the number of input and output bytes required by your DN120 configuration before you can add the gateway to the DeviceNet master scanlist. You need to configure the DeviceNet master to send the specific number of output bytes in its Poll Command Message, and receive the specific number of input bytes in the gateway’s Poll Response Message. Once the input and output bytes are mapped in the DeviceNet master, the user application program will be able to read and write data values to the input and output bytes. Poll Consume Size The Poll Consume Size is the size (in bytes) of the Poll Command Message data field that is sent by the DeviceNet master to the DN120. Poll Command data: [Status Clear byte][Transmit Sequence Number byte][Short_String length byte][TX data bytes (0-64)]
The first 3 bytes are present if enabled. The following equation is used to calculate the DN120 Poll Consume Size. Only include the overhead bytes that are enabled.
+
Status Clear byte Transmit Sequence Number byte Short_String length byte Maximum Transmit Size
1 1 1 ____
Poll Consume Size
____
Poll Produce Size The Poll Produce Size is the size (in bytes) of the Poll Response Message data field that is sent from the DN120 to the DeviceNet master. Poll Response data: [Status byte][Receive Sequence Number byte][Short_String length byte][RX data bytes (0-64)]
The first 3 bytes are present if enabled. The following equation is used to calculate the DN120 Poll Produce Size. Only include the overhead bytes that are enabled.
+
Status byte Receive Sequence Number byte Short_String length byte Maximum Receive Size
1 1 1 ____
Poll Produce Size
____
Microscan Systems, Inc.
26
Page 27
DN120 DeviceNet Gateway User’s Manual
Chapter 5 – DeviceNet Specifications This chapter describes the DN120 gateway DeviceNet specifications. DeviceNet Message Types The DN120 is a Group 2 Slave Device that supports the following message types. CAN IDENTIFIER GROUP 2 MESSAGE TYPE 10xxxxxx111 Duplicate MAC ID Check Message 10xxxxxx110 Unconnected Explicit Request Message 10xxxxxx101 Master I/O Poll Command Message 10xxxxxx100 Master Explicit Request Message xxxxxx = DN120 MAC ID
DeviceNet Class Services The DN120 is a Group 2 Slave Device that supports the following class services and instance services. SERVICE CODE 05 (0x05) 14 (0x0E) 16 (0x10) 75 (0x4B) 76 (0x4C)
SERVICE NAME Reset Get Attribute Single Set Attribute Single Allocate Group 2 Identifier Set Release Group 2 Identifier Set
DeviceNet Object Classes The DN120 device supports the following DeviceNet object classes. CLASS CODE 01 (0x01) 02 (0x02) 03 (0x03) 04 (0x04) 05 (0x05) 64 (0x40)
OBJECT TYPE Identity Router DeviceNet Assembly Connection Serial Stream Object
Microscan Systems, Inc.
27