This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
resources:eval:user-guides:eval-adicup3029:reference_designs:demo_plc_modbus [17 May 2019 12:18] – [MinimalModbus basic examples] Mihai Ionut Suciu | resources:eval:user-guides:eval-adicup3029:reference_designs:demo_plc_modbus [08 Mar 2021 06:12] (current) – [Obtaining the Source Code] adding in .Hex files Zuedmar Arceo | ||
---|---|---|---|
Line 3: | Line 3: | ||
===== General Description/ | ===== General Description/ | ||
- | The distributed control system demo is a demo that uses a **EVAL-ADICUP3029** connected with an **EVAL-CN0416-ARDZ** | + | The Distributed Control System reference design |
+ | | ||
+ | * **EVAL-CN0416-ARDZ** | ||
+ | * **EVAL-CN0414-ARDZ** | ||
+ | | ||
- | MODBUS is the most popular | + | The reference design provides software connectivity using the MODBUS |
- | ^ Coil/ | + | Several options for communicating with the hardware are provided or demonstrated: |
- | | 1 - 9999 | 0 to 270E | Read-Write | Discreet Output Coils | | + | * A command-line interface, requiring only a terminal program on the host PC and no additional software, useful |
- | | 10001 - 19999 | 0 to 270E | Read-Only | Discreet Input Contacts | | + | * An open-source Modbus debug tool |
- | | 30001 - 39999 | 0 to 270E | Read-Only | Analog Input Registers | | + | |
- | | 40001 - 49999 | 0 to 270E | Read-Write | Output Holding Registers | | + | * Example applications in Python, using an open-source Modbus library |
- | + | ||
- | Each of these registers have a 16-bit address and a 16-bit value. | + | |
- | + | ||
- | The **Discreet Output Coils** are registers that control a single output wire that has a binary value (high or low). Reading this register returns | + | |
- | The **Discreet Input Contacts** are registers that represent the value of a single input logic wire. The register can be only read and it is 0 if the wire is logic low and 0XFFFF if the wire is logic high. | + | |
- | The **Analog Input Registers** represent an analogical value, usually from an analog wire. This register can be only read and returns a 16-bit value. | + | |
- | The **Output Holding Registers** are registers that control an analogical output or a state of the slave. Reading this register returns the state of a process or an output and writing to it may change them or start a process. | + | |
- | + | ||
- | Each register can be accessed using a function code: | + | |
- | + | ||
- | ^ Function code ^ Action ^ Table name ^ | + | |
- | | 1 (0x01) | Read | Discreet Output Coils | | + | |
- | | 5 (0x05) | Write Single | Discreet Output Coils | | + | |
- | | 15 (0x0F) | Write Multiple | Discreet Output Coils | | + | |
- | | 2 (0x02) | Read | Discreet Input Contacts | | + | |
- | | 4 (0x04) | Read | Analog Input Registers | | + | |
- | | 3 (0x03) | Read | Output Holding Registers | | + | |
- | | 6 (0x06) | Write Single | Output Holding Registers | | + | |
- | | 16 (0x10) | Write Multiple | Output Holding Registers | | + | |
===== Demo Requirements ===== | ===== Demo Requirements ===== | ||
- | |||
- | FIXME! | ||
The following is a list of items needed in order to replicate this demo. | The following is a list of items needed in order to replicate this demo. | ||
Line 40: | Line 23: | ||
* EVAL-ADICUP3029 | * EVAL-ADICUP3029 | ||
* EVAL-CN0414-ARDZ and/or EVAL-CN0418-ARDZ, | * EVAL-CN0414-ARDZ and/or EVAL-CN0418-ARDZ, | ||
- | * EVAL-CN0416-ARDZ (not needed | + | * EVAL-CN0416-ARDZ (not needed |
+ | * Additional EVAL-CN0416-ARDZ, | ||
+ | * other RS485 host adapter | ||
* Mirco USB to USB cable | * Mirco USB to USB cable | ||
* PC or Laptop with a USB port | * PC or Laptop with a USB port | ||
* Software | * Software | ||
- | * [[https://gitlab.analog.com/Platformation/ | + | * [[https://github.com/analogdevicesinc/ |
* CrossCore Embedded Studio (2.8.0 or higher) | * CrossCore Embedded Studio (2.8.0 or higher) | ||
* ADuCM302x DFP (3.2.0 or higher) | * ADuCM302x DFP (3.2.0 or higher) | ||
Line 50: | Line 35: | ||
* Serial Terminal Program (Required for running in CLI mode only) | * Serial Terminal Program (Required for running in CLI mode only) | ||
* Such as Putty or Tera Term | * Such as Putty or Tera Term | ||
+ | * Python 3.6 (only required for modifying example applications) | ||
===== Setting up the Hardware ===== | ===== Setting up the Hardware ===== | ||
<WRAP center round important 80%> | <WRAP center round important 80%> | ||
- | Depending on the PLC/DCS Node configuration the power needs to be provided as follow: | + | Depending on the PLC/DCS Node configuration the power needs to be provided as follows: |
* If the PLC/DCS Node contain at least a CN0418 board, then the power will be provided through any CN0418 board (the jumper for P17 **MUST** to be placed for each board). | * If the PLC/DCS Node contain at least a CN0418 board, then the power will be provided through any CN0418 board (the jumper for P17 **MUST** to be placed for each board). | ||
* If the PLC/DCS Node contain only CN0414 boards, then the power can be provided through any CN0414 board. | * If the PLC/DCS Node contain only CN0414 boards, then the power can be provided through any CN0414 board. | ||
+ | Refer to the [[/ | ||
</ | </ | ||
- | ==== PLC System block diagram ==== | + | |
+ | |||
+ | \\ | ||
+ | ==== PLC / Single or multi-node DCS System Setup Configuration ==== | ||
+ | Block diagrams for PLC / single-node DCS and multi-node DCS systems are shown below. These systems differ slightly in their allowable configurations: | ||
+ | * A Single-node system can operate with either half-duplex or full-duplex RS-485. Termination must be enabled at both ends of the RS-485 line(s). | ||
+ | * Modbus address conflict is not a concern in a single-node system (but the address must be known to the host.) | ||
+ | * A Multi-node system can only operate in half-duplex mode. | ||
+ | * In a Multi-node system, termination must be enabled at the ends of the RS-485 line, which is most often the host RS485 adapter and most distant node. | ||
+ | * Each node in a multi-node system must be set to a different address. | ||
+ | |||
+ | ==== PLC / Single-node DCS System block diagram ==== | ||
{{ : | {{ : | ||
\\ | \\ | ||
- | ==== PLC System Setup Configuration ==== | ||
- | FIXME - Verify the setup configuration when possible | + | ==== DCS System block diagram ==== |
+ | {{ : | ||
+ | \\ | ||
- | ^ \\ MODBUS Master Interface | + | ==== RS485 Adapter |
+ | An ADALM-UARTJTAG board and a spare CN0416 can function as a convenient USB Virtual COM port to RS-485 adapter. Any RS485 adapter should work, if another is available. Isolated / Non-Isolated depends on the application and difference in ground potential between the host and nodes. Full-duplex operation is only supported in the PLC/ | ||
^ ADALM-UARTJTAG Setup ^^^^^ | ^ ADALM-UARTJTAG Setup ^^^^^ | ||
+ | The CP2103 device must be programmed as follows to control the DE signal on the CN0416. Configure Silicon Labs Xpress Configurator as follows to program the device: | ||
| IO2 configuration | | IO2 configuration | ||
+ | Once the CP2103 is programmed, unplug from the host computer and connect P1 on the ADALM-UARTJTAG to P11 on the CN0416 with a 2x5-socket, 100mil cable such as [[digikey> | ||
^ CN0416 Setup ^^^^^ | ^ CN0416 Setup ^^^^^ | ||
^ ^ Isolated Full Duplex | ^ ^ Isolated Full Duplex | ||
| S1 position | | S1 position | ||
- | | S2 position | + | | S2 position |
| S4 position | | S4 position | ||
| S5 position | | S5 position | ||
| S6 position | | S6 position | ||
| S7 position | | S7 position | ||
- | ^ EVAL-ADICUP3029 | + | |
- | | S2 position | + | \\ |
- | | S5 position | + | |
- | ^ \\ PLC System | + | |
+ | ==== Node Configuration | ||
+ | Configuration | ||
^ CN0416 Setup ^^^^^ | ^ CN0416 Setup ^^^^^ | ||
+ | (Full-duplex only valid in a single-node system.) | ||
+ | |||
^ ^ Isolated Full Duplex | ^ ^ Isolated Full Duplex | ||
- | | S1 position | + | | S1 position |
- | | S2 position | + | | S2 position |
| S4 position | | S4 position | ||
| S5 position | | S5 position | ||
Line 91: | Line 97: | ||
| S7 position | | S7 position | ||
^ CN0414 Setup (if available) | ^ CN0414 Setup (if available) | ||
- | | P1 position | + | | P1 position |
| P2 position | | P2 position | ||
- | | P10 position | + | | P10 position |
| P11 position | | P11 position | ||
| P12 position | | P12 position | ||
- | | JP1 position | + | | JP1 position |
^ CN0418 Setup (if available) | ^ CN0418 Setup (if available) | ||
- | | P10 position | + | | P10 position |
| P9 position | | P9 position | ||
- | | JP2 position | + | | JP2 position |
| JP3 position | | JP3 position | ||
| JP4 position | | JP4 position | ||
- | | JP1 position | + | | JP1 position |
| P17 position | | P17 position | ||
^ EVAL-ADICUP3029 | ^ EVAL-ADICUP3029 | ||
- | | S2 position | + | | S2 position |
- | | S5 position | + | | S5 position |
- | \\ | ||
- | ==== DCS System block diagram ==== | + | ==== Direct |
- | {{ : | + | |
- | + | ||
- | \\ | + | |
- | + | ||
- | ==== DCS System Setup Configuration ==== | + | |
- | + | ||
- | FIXME - Verify the setup configuration when possible | + | |
- | + | ||
- | + | ||
- | ^ \\ MODBUS Master Interface Configuration | + | |
- | ^ ADALM-UARTJTAG Setup ^^^^^ | + | |
- | | IO2 configuration | + | |
- | ^ CN0416 Setup ^^^^^ | + | |
- | ^ | + | |
- | | S1 position | + | |
- | | S2 position | + | |
- | | S4 position | + | |
- | | S5 position | + | |
- | | S6 position | + | |
- | | S7 position | + | |
- | ^ EVAL-ADICUP3029 | + | |
- | | S2 position | + | |
- | | S5 position | + | |
- | ^ \\ DCS First Node System Configuration | + | |
- | ^ CN0416 Setup ^^^^^ | + | |
- | ^ ^ Isolated Half Duplex | + | |
- | | S1 position | + | |
- | | S2 position | + | |
- | | S4 position | + | |
- | | S5 position | + | |
- | | S6 position | + | |
- | | S7 position | + | |
- | ^ CN0414 Setup (if available) | + | |
- | | P1 position | + | |
- | | P2 position | + | |
- | | P10 position | + | |
- | | P11 position | + | |
- | | P12 position | + | |
- | | JP1 position | + | |
- | ^ CN0418 Setup (if available) | + | |
- | | P10 position | + | |
- | | P9 position | + | |
- | | JP2 position | + | |
- | | JP3 position | + | |
- | | JP4 position | + | |
- | | JP1 position | + | |
- | | P17 position | + | |
- | ^ EVAL-ADICUP3029 | + | |
- | | S2 position | + | |
- | | S5 position | + | |
- | ^ \\ DCS Middle Node(s) System Configuration (up to 14 nodes) | + | |
- | ^ CN0416 Setup ^^^^^ | + | |
- | ^ ^ Isolated Half Duplex | + | |
- | | S1 position | + | |
- | | S2 position | + | |
- | | S4 position | + | |
- | | S5 position | + | |
- | | S6 position | + | |
- | | S7 position | + | |
- | ^ CN0414 Setup (if available) | + | |
- | | P1 position | + | |
- | | P2 position | + | |
- | | P10 position | + | |
- | | P11 position | + | |
- | | P12 position | + | |
- | | JP1 position | + | |
- | ^ CN0418 Setup (if available) | + | |
- | | P10 position | + | |
- | | P9 position | + | |
- | | JP2 position | + | |
- | | JP3 position | + | |
- | | JP4 position | + | |
- | | JP1 position | + | |
- | | P17 position | + | |
- | ^ EVAL-ADICUP3029 | + | |
- | | S2 position | + | |
- | | S5 position | + | |
- | ^ \\ DCS End Node System Configuration | + | |
- | ^ CN0416 Setup ^^^^^ | + | |
- | ^ ^ Isolated Half Duplex | + | |
- | | S1 position | + | |
- | | S2 position | + | |
- | | S4 position | + | |
- | | S5 position | + | |
- | | S6 position | + | |
- | | S7 position | + | |
- | ^ CN0414 Setup (if available) | + | |
- | | P1 position | + | |
- | | P2 position | + | |
- | | P10 position | + | |
- | | P11 position | + | |
- | | P12 position | + | |
- | | JP1 position | + | |
- | ^ CN0418 Setup (if available) | + | |
- | | P10 position | + | |
- | | P9 position | + | |
- | | JP2 position | + | |
- | | JP3 position | + | |
- | | JP4 position | + | |
- | | JP1 position | + | |
- | | P17 position | + | |
- | ^ EVAL-ADICUP3029 | + | |
- | | S2 position | + | |
- | | S5 position | + | |
- | + | ||
- | ==== CLI Setup block diagram | + | |
{{ : | {{ : | ||
- | ==== CLI Setup Configuration ==== | + | ==== Direct USB Configuration ==== |
- | The CLI system | + | The CLI program |
^ EVAL-ADICUP3029 | ^ EVAL-ADICUP3029 | ||
- | | S2 position | + | | S2 position |
- | | S5 position | + | | S5 position |
\\ | \\ | ||
- | ===== Configuring the Software ===== | ||
- | The software can be set up to work in CLI debug mode or in MODBUS mode. To set this make sure the relevant define in the **config.h** file is uncommented and the other one is commented: | ||
- | < | + | ===== MODBUS Implementation ===== |
- | //#define CLI_INTEFACE | + | |
- | //#define MODBUS_INTERFACE | + | |
- | </ | + | |
- | ===== Outputting Data ===== | + | There are four types of standard registers in the MODBUS slave: |
- | There are two interfaces available for this application: | + | ^ Coil/Register Number ^ Data addresses ^ Types ^ Names ^ |
+ | | 1 - 9999 | 0 to 270E | Read-Write | Discreet Output Coils | | ||
+ | | 10001 - 19999 | 0 to 270E | Read-Only | Discreet Input Contacts | | ||
+ | | 30001 - 39999 | 0 to 270E | Read-Only | Analog Input Registers | | ||
+ | | 40001 - 49999 | 0 to 270E | Read-Write | Output Holding Registers | | ||
- | The **CLI** is implemented through **UART** and must be connected to a computer via **USB cable**. A serial terminal program must run on the **host PC** to display data and control the application. | + | Each of these registers have a 16-bit address |
- | The **MODBUS** is connected through | + | The **Discreet Output Coils** are registers that control a single output wire that has a binary value (high or low). Reading this register returns |
+ | The **Discreet Input Contacts** are registers that represent the value of a single input logic wire. The register can be only read and it is 0 if the wire is logic low and 0XFFFF if the wire is logic high. | ||
+ | The DCS reference design does not have any functions that would map to **Discreet Output Coils** or **Discreet Input Contacts**. | ||
+ | The **Analog Input Registers** represent an analog value, usually from an analog wire. This register can be only read and returns a 16-bit value. | ||
+ | The **Output Holding Registers** are registers that control an analog output or a state of the slave. Reading this register returns the state of a process or an output and writing to it may change them or start a process. | ||
- | ==== Command Line Interface ==== | + | Each register can be accessed using a function code: |
- | === Serial Terminal | + | ^ Function code ^ Action ^ Table name ^ |
+ | | 1 (0x01) | Read | Discreet | ||
+ | | 5 (0x05) | Write Single | Discreet Output Coils | | ||
+ | | 15 (0x0F) | Write Multiple | Discreet Output Coils | | ||
+ | | 2 (0x02) | Read | Discreet Input Contacts | | ||
+ | | 4 (0x04) | Read | Analog Input Registers | | ||
+ | | 3 (0x03) | Read | Output Holding Registers | | ||
+ | | 6 (0x06) | Write Single | Output Holding Registers | | ||
+ | | 16 (0x10) | Write Multiple | Output Holding Registers | | ||
- | {{page>/ | ||
- | |||
- | === Available Commands === | ||
- | |||
- | Typing **help** or **h** after initial calibration sequence will display the list of commands and their short versions. The **CLI mode** has a board command menu which is only used to select the board. Each board present in the system has it's own command set based on the type. | ||
- | |||
- | Bellow is the short command list for the board menu: | ||
- | |||
- | ^ Command | ||
- | | //h// | Display available commands. | | ||
- | | // | ||
- | |||
- | {{ : | ||
- | |||
- | The specific commands for each of the types of boards is described in they respective wiki pages: | ||
- | * [[https:// | ||
- | * [[https:// | ||
- | ==== MODBUS | + | ==== DCS reference design |
- | Because the system | + | Because the DCS reference design |
The common registers are 5 read-only registers and 2 read-write registers. In standard **MODBUS terminology** that translates to 5 analog input registers and 2 holding registers: | The common registers are 5 read-only registers and 2 read-write registers. In standard **MODBUS terminology** that translates to 5 analog input registers and 2 holding registers: | ||
Line 300: | Line 193: | ||
</ | </ | ||
- | Adding a board to the system adds a number of board specific registers: 50 analog input registers and 7 output holding registers for adding an **EVAL-CN0414-ARDZ**, | + | The register map is configured dynamically after power-up. |
As stated before, adding an **EVAL-CN0414-ARDZ** adds 57 registers to the device: 50 analog input registers and 7 output holding registers. The analog input registers are: 16 for ADC input values, 4 for ADC input open wire detection flags and 50 for HART receive buffer. The output holding registers are: 1 for ADC output coding, 1 for ADC filter options, 1 for ADC postfilter options, 1 for ADC output data rate options, 1 for ADC open wire detection enable, 1 for HART command zero and 1 for HART channel select. The output holding registers are: 16 for the channel registers, 4 for Open Wire Detection and 30 for the HART input buffer. | As stated before, adding an **EVAL-CN0414-ARDZ** adds 57 registers to the device: 50 analog input registers and 7 output holding registers. The analog input registers are: 16 for ADC input values, 4 for ADC input open wire detection flags and 50 for HART receive buffer. The output holding registers are: 1 for ADC output coding, 1 for ADC filter options, 1 for ADC postfilter options, 1 for ADC output data rate options, 1 for ADC open wire detection enable, 1 for HART command zero and 1 for HART channel select. The output holding registers are: 16 for the channel registers, 4 for Open Wire Detection and 30 for the HART input buffer. | ||
Line 352: | Line 245: | ||
| HART CH select | 0x09 | Output Holding Register | Select enable a current channel for HART communication: | | HART CH select | 0x09 | Output Holding Register | Select enable a current channel for HART communication: | ||
- | === qModMaster Example === | ||
+ | |||
+ | ===== Configuring the Software ===== | ||
+ | |||
+ | The software can be set up to work in CLI debug mode or in MODBUS mode. To set this make sure the relevant define in the **config.h** file is uncommented and the other one is commented: | ||
+ | |||
+ | < | ||
+ | //#define CLI_INTEFACE | ||
+ | //#define MODBUS_INTERFACE | ||
+ | </ | ||
+ | |||
+ | ===== Communicating with the DCS reference design ===== | ||
+ | |||
+ | There are two interfaces available for this application: | ||
+ | |||
+ | The **CLI** is implemented through **UART** and must be connected to a computer via **USB cable**. A serial terminal program must run on the **host PC** to display data and control the application. | ||
+ | |||
+ | The **MODBUS** is connected through the **EVAL-CN0416-ARDZ** **UART** to **RS485** adapter and must communicate with a **MODBUS master** on the **RS485 line**. | ||
+ | |||
+ | ==== Command Line Interface ==== | ||
+ | |||
+ | === Serial Terminal Output === | ||
+ | |||
+ | {{page>/ | ||
+ | |||
+ | === Available Commands === | ||
+ | |||
+ | Typing **help** or **h** after initial calibration sequence will display the list of commands and their short versions. The **CLI mode** has a board command menu which is only used to select the board. Each board present in the system has it's own command set based on the type. | ||
+ | |||
+ | Bellow is the short command list for the board menu: | ||
+ | |||
+ | ^ Command | ||
+ | | //h// | Display available commands. | | ||
+ | | // | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | The specific commands for each of the types of boards is described in they respective wiki pages: | ||
+ | * [[/ | ||
+ | * [[/ | ||
+ | |||
+ | ==== Modbus Interface ==== | ||
+ | The Modbus protocol is not human-readable; | ||
+ | |||
+ | QModMaster is used to demonstrate several basic register operations below. | ||
| Common analog input registers read || | | Common analog input registers read || | ||
Line 369: | Line 305: | ||
\\ | \\ | ||
- | ==== MinimalModbus basic examples | + | ===== Obtaining the Software ===== |
- | In this application, | + | There are two basic ways to program the ADICUP3029 with the software for the CN0435. |
+ | - Dragging and Dropping the .Hex to the Daplink drive | ||
+ | - Building, Compiling, and Debugging using CCES | ||
- | \\ | + | Using the drag and drop method, the software is going to be a version that Analog Devices creates for testing and evaluation purposes. |
+ | |||
+ | Importing the project into CrossCore is going to allow you to change parameters and customize the software to fit your needs, but will be a bit more advanced and will require you to download the CrossCore toolchain. | ||
+ | |||
+ | The software for the **ADuCM3029_demo_cn0435** can be found here: | ||
+ | |||
+ | <WRAP round 80% download> | ||
+ | Prebuilt CN0435 Hex File | ||
+ | * [[https:// | ||
+ | Complete CN0435 Source Files | ||
+ | * [[https:// | ||
+ | |||
+ | </ | ||
+ | |||
+ | ===== How to use the Tools ===== | ||
+ | |||
+ | The official tool we promote for use with the EVAL-ADICUP3029 is CrossCore Embedded Studio. | ||
+ | |||
+ | ==== Importing ==== | ||
+ | |||
+ | For more detailed instructions on importing this application/ | ||
+ | |||
+ | ==== Debugging ==== | ||
+ | |||
+ | For more detailed instructions on importing this application/ | ||
+ | |||
+ | ==== Project Structure ==== | ||
+ | |||
+ | The application controls a dynamic system that can be physically different every time it is run. to do this it has two parts: | ||
+ | - The system initialization. | ||
+ | - The system main process. | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | After getting parameters of the system supplied by the user in code the program initializes the software modules common to all the boards: I2C, UART, SPI, microcontroller power, software UART and the AD5700 HART modem. If the MODBUS interface is used, the update timer for the input boards is also initialized in this stage as a common module. If, by comparison, the CLI is used, each input board present initializes its own version of the update timer driver. | ||
+ | |||
+ | After these initializations the system runs a board discovery routine. By using the presence of I2C EEPROM memory and testing the SPI configuration, | ||
+ | |||
+ | After board discovery, if the CLI is used, no board is set as active and the system manager loads the main menu process. If the MODBUS is used, the system activates the first board it discovers. | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | === CLI Process === | ||
+ | |||
+ | If the CLI is used, no board is active after the initialization and the system stands by to receive commands. If the user sets one of the boards to be active, the program loads the commands and process specific to that board and starts sunning them until the application is stopped or the " | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | === MODBUS Interface Process === | ||
+ | |||
+ | If the MODBUS interface is used the first board discovered is the active board. If it is a CN0414 the program runs its process until all channels are updated. If it is a CN0418 the program runs its process only once. After this the system deactivates the board and activates the next board discovered until all the boards have been active and updated. The system than cycles back from the beginning. | ||
+ | |||
+ | Meanwhile the system scans the MODBUS channel for commands and if one is found that is addressed to this node it executes it and sends back a response. | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | === Board Specific Processes === | ||
+ | |||
+ | The process and commands for each type of boards is described in the appropriate application page: | ||
+ | * [[/ | ||
+ | * [[/ | ||
+ | |||
+ | ===== Example Applications and Utilities ===== | ||
+ | User DCS programs running on the host will be highly application-specific, | ||
+ | |||
+ | ==== Utility functions in Python ==== | ||
+ | |||
+ | The following utility functions are demonstrated using the single-node configuration described above. It may be connected to the host either directly via USB (no RS485 interface) or over a USB to RS485 bridge. Minimalmodbus is an open-source (Apache license) Modbus RTU and Modbus ASCII implementation for Python, and is used in these examples. Similar libraries exist for other languages. | ||
+ | |||
+ | === Read common analog input registers basic example === | ||
For example, consider an instrument (slave) with Modbus RTU and address number 1 to which we are to communicate via a serial port with the name '' | For example, consider an instrument (slave) with Modbus RTU and address number 1 to which we are to communicate via a serial port with the name '' | ||
Line 401: | Line 408: | ||
The **EVAL-CN0414-ARDZ** boards have address 0b10 and 0b11 while **EVAL-CN0418-ARDZ** boards have address 0b00 and 0b01. | The **EVAL-CN0414-ARDZ** boards have address 0b10 and 0b11 while **EVAL-CN0418-ARDZ** boards have address 0b00 and 0b01. | ||
- | \\ | + | === Read analog input registers basic example === |
Next, if we want to read all analog input channels from one **EVAL-CN0414-ARDZ** we can use the following: | Next, if we want to read all analog input channels from one **EVAL-CN0414-ARDZ** we can use the following: | ||
Line 427: | Line 434: | ||
In this example, after we run the above piece of code it results a list of 16 elements in decimal format. First 8 values corespond to voltage channels and last to current channels. | In this example, after we run the above piece of code it results a list of 16 elements in decimal format. First 8 values corespond to voltage channels and last to current channels. | ||
- | \\ | + | === Read and write one output holding register for EVAL-CN0414-ARDZ example === |
Next, if we want to change the output code of one **EVAL-CN0414-ARDZ** ADC to be unipolar instead of bipolar we can use the following: | Next, if we want to change the output code of one **EVAL-CN0414-ARDZ** ADC to be unipolar instead of bipolar we can use the following: | ||
Line 464: | Line 471: | ||
In this example, after we run the above piece of code it results an integer which coresponds to ADC coding format. The default value 0, indicate that the ADC is set to bipolar coding format, while a value of 1 will indicate an unipolar coding format. | In this example, after we run the above piece of code it results an integer which coresponds to ADC coding format. The default value 0, indicate that the ADC is set to bipolar coding format, while a value of 1 will indicate an unipolar coding format. | ||
- | \\ | + | === Read and write one output holding register for EVAL-CN0418-ARDZ example === |
Next, if we want to change the output code of one **EVAL-CN0418-ARDZ** DAC channel we can use the following: | Next, if we want to change the output code of one **EVAL-CN0418-ARDZ** DAC channel we can use the following: | ||
Line 501: | Line 508: | ||
In this example, after we run the above piece of code it results an integer which coresponds to DAC channel 1 output code. Depending on channel configuration this output code will corespond to a voltage or a current value. In this example the DAC channel output code is by default 0V because the default channel range is set to 0V to 5V. The 65535 value will corespond in this case to a 5V output. | In this example, after we run the above piece of code it results an integer which coresponds to DAC channel 1 output code. Depending on channel configuration this output code will corespond to a voltage or a current value. In this example the DAC channel output code is by default 0V because the default channel range is set to 0V to 5V. The 65535 value will corespond in this case to a 5V output. | ||
- | \\ | + | === Detect system configuration example === |
Next, if we want to determine the system configuration we can run the following script from the attached archive. | Next, if we want to determine the system configuration we can run the following script from the attached archive. | ||
+ | |||
{{ : | {{ : | ||
Line 509: | Line 517: | ||
< | < | ||
- | Available devices: | + | Welcome! Use ' |
- | 1 -> Silicon Labs CP210x USB to UART Bridge (COM12) | + | |
+ | Available devices: | ||
+ | 1 -> Silicon Labs CP210x USB to UART Bridge (COM12) | ||
2 -> Intel(R) Active Management Technology - SOL (COM3) | 2 -> Intel(R) Active Management Technology - SOL (COM3) | ||
- | Enter detected device index: Boards found at MODBUS address: | + | |
+ | Enter detected device index, or press ENTER to use COM12: | ||
+ | No boards at MODBUS address: 1 No communication with the instrument (no answer) | ||
+ | |||
+ | Boards found at MODBUS address: | ||
Address | Address | ||
------------- | ------------- | ||
- | 0000 (0x0000) | + | 0000 (0x0000) |
+ | 0001 (0x0001) | ||
+ | 0002 (0x0002) | ||
+ | 0003 (0x0003) | ||
+ | 0004 (0x0004) | ||
+ | Analog input board at address: 10 | ||
+ | Analog input board at address: 11 | ||
+ | No boards at MODBUS address: 3 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 4 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 5 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 6 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 7 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 8 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 9 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 10 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 11 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 12 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 13 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 14 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 15 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 16 No communication with the instrument (no answer) | ||
+ | </ | ||
+ | |||
+ | For a DCS configuration the script output will look similarly like this: | ||
+ | < | ||
+ | Welcome! Use ' | ||
+ | |||
+ | Available devices: | ||
+ | 1 -> Silicon Labs CP210x USB to UART Bridge (COM12) | ||
+ | 2 -> Intel(R) Active Management Technology - SOL (COM3) | ||
+ | |||
+ | Enter detected device index, or press ENTER to use COM12: | ||
+ | |||
+ | Boards found at MODBUS address: 1 | ||
+ | Address | ||
+ | ------------- | ||
+ | 0000 (0x0000) | ||
0001 (0x0001) | 0001 (0x0001) | ||
0002 (0x0002) | 0002 (0x0002) | ||
- | 0003 (0x0003) | + | 0003 (0x0003) |
- | 0004 (0x0004) | + | 0004 (0x0004) |
Analog output board at address: 00 | Analog output board at address: 00 | ||
Analog output board at address: 01 | Analog output board at address: 01 | ||
+ | |||
+ | Boards found at MODBUS address: 2 | ||
+ | Address | ||
+ | ------------- | ||
+ | 0000 (0x0000) | ||
+ | 0001 (0x0001) | ||
+ | 0002 (0x0002) | ||
+ | 0003 (0x0003) | ||
+ | 0004 (0x0004) | ||
Analog input board at address: 10 | Analog input board at address: 10 | ||
Analog input board at address: 11 | Analog input board at address: 11 | ||
- | No boards at MODBUS address: 2 No communication with the instrument (no answer) | ||
No boards at MODBUS address: 3 No communication with the instrument (no answer) | No boards at MODBUS address: 3 No communication with the instrument (no answer) | ||
No boards at MODBUS address: 4 No communication with the instrument (no answer) | No boards at MODBUS address: 4 No communication with the instrument (no answer) | ||
Line 540: | Line 598: | ||
No boards at MODBUS address: 16 No communication with the instrument (no answer) | No boards at MODBUS address: 16 No communication with the instrument (no answer) | ||
</ | </ | ||
- | ===== Obtaining the Source Code ===== | ||
- | We recommend not opening | + | === Change or check the system registers example === |
- | The source code and include files of the **ADuCM3029_demo_cn0435** | + | Next, if we want to check or change |
- | <WRAP round 80% download> | + | {{ : |
- | FIXME! | + | Depending on the system configuration, |
+ | After the user selects a valid DCS node, a menu will appear which contain all available system options. | ||
+ | Now, depending on the node configuration, | ||
+ | For example, if a DCS node doesn' | ||
- | [[https:// | + | <xterm> |
- | + | Welcome! Use ' | |
- | </WRAP> | + | |
- | ===== How to use the Tools ===== | + | Available devices: |
+ | 1 -> Silicon Labs CP210x USB to UART Bridge (COM12) | ||
+ | 2 -> Intel(R) Active Management Technology - SOL (COM3) | ||
- | The official tool we promote for use with the EVAL-ADICUP3029 is CrossCore Embedded Studio. For more information on downloading the tools and a quick start guide on how to use the tool basics, please check out the [[resources: | + | Enter detected device index, or press ENTER to use COM12: |
+ | Enter MODBUS timeout (0.05[s] to inf), or press ENTER to use 0.1[s] timeout: | ||
- | ==== Importing ==== | + | Boards found at MODBUS address: 1 |
+ | Address | ||
+ | ------------- | ||
+ | 0000 (0x0000) | ||
+ | 0001 (0x0001) | ||
+ | 0002 (0x0002) | ||
+ | 0003 (0x0003) | ||
+ | 0004 (0x0004) | ||
+ | analog output board at address: 00 | ||
+ | analog output board at address: 01 | ||
- | For more detailed instructions on importing this application/ | + | Boards found at MODBUS address: 2 |
+ | Address | ||
+ | ------------- | ||
+ | 0000 (0x0000) | ||
+ | 0001 (0x0001) | ||
+ | 0002 (0x0002) | ||
+ | 0003 (0x0003) | ||
+ | 0004 (0x0004) | ||
+ | analog input board at address: 10 | ||
+ | analog input board at address: 11 | ||
+ | No boards at MODBUS address: 3 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 4 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 5 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 6 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 7 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 8 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 9 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 10 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 11 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 12 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 13 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 14 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 15 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 16 No communication with the instrument (no answer) | ||
- | ==== Debugging ==== | + | Enter MODBUS address from this list [1, 2], or press ENTER to use MODBUS address 1: |
+ | Enter commands delay (0[s] to inf), or press ENTER to use 0.1[s] delay: | ||
- | For more detailed instructions on importing this application/ | + | Test options: |
+ | 1 - Read common analog input registers. | ||
+ | 2 - Read common output holding registers. | ||
+ | 3 - Read analog input registers. | ||
+ | 4 - Read output holding registers. | ||
+ | 5 - Write output holding register. | ||
+ | q - Quit. | ||
- | ==== Project Structure ==== | + | Enter test option: |
+ | </ | ||
- | The application controls a dynamic system that can be physically different every time it is run. to do this it has two parts: | ||
- | - The system initialization. | ||
- | - The system main process. | ||
- | {{ : | + | \\ |
- | After getting parameters of the system supplied by the user in code the program initializes the software modules common to all the boards: I2C, UART, SPI, microcontroller power, software UART and the AD5700 HART modem. If the MODBUS interface is used, the update timer for the input boards is also initialized in this stage as a common module. If, by comparison, the CLI is used, each input board present initializes its own version of the update timer driver. | + | ==== Example Applications |
+ | The following section presents several example top-level DCS applications. Like the utilities, these are based on Minimalmodbus. | ||
- | After these initializations the system runs a board discovery routine. By using the presence of I2C EEPROM memory and testing the SPI configuration, | + | === Simple DCS control === |
+ | This application provides | ||
- | After board discovery, if the CLI is used, no board is set as active and the system manager loads the main menu process. If the MODBUS | + | The HART protocol |
+ | This reference design provides a basic implementation of " | ||
+ | This application allows to: | ||
+ | * detect sistem configuration; | ||
+ | * configure and read ADC channels; | ||
+ | * configure and write DAC channels; | ||
+ | * configure HART modems and send HART command zero. | ||
- | {{ : | + | {{ : |
- | === CLI Process === | + | < |
- | If the CLI is used, no board is active after the initialization and the system stands by to receive commands. If the user sets one of the boards to be active, the program loads the commands and process specific to that board and starts sunning them until the application is stopped | + | Welcome! Use ' |
- | {{ :resources: | + | Available devices: |
+ | 1 -> Silicon Labs CP210x USB to UART Bridge (COM12) | ||
+ | 2 -> Intel(R) Active Management Technology - SOL (COM3) | ||
- | === MODBUS | + | Enter detected device index, or press ENTER to use COM12: |
+ | Enter MODBUS | ||
- | If the MODBUS | + | Boards found at MODBUS |
+ | Address | ||
+ | ------------- | ||
+ | 0000 (0x0000) | ||
+ | 0001 (0x0001) | ||
+ | 0002 (0x0002) | ||
+ | 0003 (0x0003) | ||
+ | 0004 (0x0004) | ||
+ | analog output board at address: 00 | ||
+ | analog output board at address: 01 | ||
- | Meanwhile | + | Boards found at MODBUS address: 2 |
+ | Address | ||
+ | ------------- | ||
+ | 0000 (0x0000) | ||
+ | 0001 (0x0001) | ||
+ | 0002 (0x0002) | ||
+ | 0003 (0x0003) | ||
+ | 0004 (0x0004) | ||
+ | analog input board at address: 10 | ||
+ | analog input board at address: 11 | ||
+ | No boards at MODBUS address: 3 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 4 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS | ||
+ | No boards at MODBUS address: 6 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 7 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 8 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 9 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 10 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 11 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 12 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 13 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 14 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 15 No communication with the instrument (no answer) | ||
+ | No boards at MODBUS address: 16 No communication with the instrument (no answer) | ||
- | {{ :resources:eval: | + | Enter MODBUS address from this list [1, 2], or press ENTER to use MODBUS address 1: |
+ | Enter commands delay (0[s] to inf), or press ENTER to use 0.1[s] delay: | ||
- | === Board Specific Processes === | + | Use CTRL+C to end a process or switch between nodes. |
+ | CN0414 | ||
+ | ------------------------------------- | ||
+ | 1 - Read device voltage channel | ||
+ | 2 - Read device current channel | ||
+ | 3 - Read board voltage channels | ||
+ | 4 - Read board current channels | ||
+ | 5 - Read instrument voltage channels | ||
+ | 6 - Read instrument current channels | ||
+ | 7 - Set ADC output code k - Set DAC channel 3 range | ||
+ | 8 - Set ADC filter | ||
+ | 9 - Set ADC postfilter | ||
+ | a - Set ADC output data rate n - Select HART channel | ||
+ | b - Set ADC open wire detection state | ||
+ | c - Send HART command zero | ||
+ | d - Select HART channel | ||
- | The process and commands for each type of boards is described in the appropriate application page: | + | Enter Option: |
- | * [[https:// | + | </xterm> |
- | * [[https:// | + | |
// End of Document // | // End of Document // | ||