.. _computer-programming: Operation: Computer Programming =============================== Every |product_type_full| has the following communication connections available: .. list-table:: :header-rows: 1 :widths: 25 25 20 10 10 * - Interface - Location - Connector - Standard/Optional - Priority * - USB (Host) - Front - JR1 - Standard - 1 * - USB (Host) - Rear - JR2 - Standard - 2 * - RS485 - Rear - JR3 - Standard - 5 * - LXI TCP/IP Ethernet - Rear - JR6 - Optional - 3 * - IEEE-488 GPIB - Rear - JR6 - Optional - 3 All of the communication connections share the same internal communications bus; only one communication interface can be used at a time. The front panel menu display will always show what communication interface is active. The |product_type| The front panel USB takes the highest computer interface priority. When a front or rear USB connection is physically made the |product_type| will automatically switch to computer control from RS485 to the newly connected USB port. Conversely, when a command is sent via the optional LXI TCP/IP Ethernet or IEEE-488 GPIB interface, the |product_type| will automatically switch to computer control from the Ethernet or GPIB port with the new communication. Switching back to USB requires disconnecting and reconnecting the USB plug or power cycling the |product_type|. RS485 is the lowest priority interface and only has control when the USB ports are disconnected and the there is no communication over LXI TCP/IP Ethernet or IEEE-488 GPIB interfaces. .. _programming-validation: Communications Validation ------------------------- It is import to establish and validate basic communications functions before starting a sophisticated computer interface project. The following instructions are intended to help customers isolate problems with computer settings, wiring, and electrical noise. The validation instructions also provide a common environment for which Magna-Power can reproduce issues in support cases and better serve the customer. If not already installed, |company| recommends using the terminal emulation programs called `PuTTY `_ for creating serial connections. .. _programming-validation-usb: USB Communications Validation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ USB uses serial communications. To test, make a physical connection between the USB Type B connector on the |product_type| and the USB Type A on the computer. Pin outs for these connectors are described in :ref:`installation-usb`. Connect using the standard USB cable included with the product. The front panel shows the active state of the communications interface. If the front USB was connected, the display should transition from RS485 to USB2. If the rear USB was connected, the display should transition from RS485 to USB1. After a physically connection is made a session connection is made with the |product_type|. Open *Device Manager* and under ports make note of the COM port number, as shown in :numref:`fig-programming-devmanager`. .. _fig-programming-devmanager: .. figure:: _common-magnaload/_images/programming-devmanager.* :align: center Window Device Manager Open *PuTTY* and select the *Session* menu. Enter the COM port that was found in *Device Manger* and enter 115200 for the *Speed*. Set the *Connection type* to *Serial*, as shown in :numref:`fig-programming-putty-comm`. .. _fig-programming-putty-comm: .. figure:: _common-magnaload/_images/programming-putty-comm.* :align: center PuTTY Session Settings Select the *Terminal* menu and set *Force on* for all options. Press the *Open* button to start the communications session with the |product_type|, as shown in :numref:`fig-programming-putty-echo`. .. _fig-programming-putty-echo: .. figure:: _common-magnaload/_images/programming-putty-echo.* :align: center PuTTY Terminal Settings Session should open a new blank window. Type the command:: *IDN? If settings match and wiring connections are correct, the session window should look like :numref:`fig-programming-putty-scpi`. .. _fig-programming-putty-scpi: .. figure:: _common-magnaload/_images/programming-putty-scpi.* :align: center PuTTY Terminal Session Output .. _programming-validation-rs485: RS485 Communications Validation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RS485 also uses serial communications. Most customers will need a USB-to-RS485 adapter (not included) to allow the computer to connect to RS485. Any RS485 adapter should work provided it supports half-duplex communication and 115200 baud. |company| recommends USB-COM485-PLUS1 and USB-COM485-PLUS4 adapters from FTDI. The adapter will serial port(s) in Windows *Device Manager*. Customers will also need to create their own cable. The |product_type| interfaces to RS485 through a RJ45 connector located in the rear. RJ45 mates readily with Category 5 Ethernet cables. When crimping wires to the connector make sure to follow the pins outs described in :ref:`installation-rs485`. By default, the RS485 interface is active when no other communication interface cables are connected. The front display will always show the RS485 state even when the wire is disconnect. Once the computer and |product_type| are physically connected, open PuTTY, and follow the instructions described in :ref:`programming-validation-usb` to make a serial connection and test it.