ThinkCore DA-660-8/16-CE User’s Manual Second Edition, May 2006 www.moxa.com/product Moxa Systems Co., Ltd. Tel: +886-2-8919-1711 Fax: +886-2-8919-1722 Web: www.moxa.com MOXA Technical Support Worldwide: support@moxa.com The Americas support@usa.moxa.
ThinkCore DA-660-8/16-CE User’s Manual The software described in this manual is furnished under a license agreement and may be used only in accordance with the terms of that agreement. Copyright Notice Copyright © 2006 Moxa Systems Co., Ltd. All rights reserved. Reproduction without permission is prohibited. Trademarks MOXA is a registered trademark of The Moxa Group. All other trademarks or registered marks in this manual belong to their respective manufacturers.
Table of Contents Chapter 1 Introduction ..................................................................................................1-1 Overview.................................................................................................................................. 1-2 Package Checklist....................................................................................................... 1-2 Model Descriptions and Features ....................................................................
Chapter 5 Programming Examples ..............................................................................5-1 Embedded Visual C++4 Examples........................................................................................... 5-1 Example #1—MOXA UART Supporting RS-232/422/485 ....................................... 5-2 Example #2—Buzzer.................................................................................................. 5-5 Visual Studio 2005 C# Examples................................
1 Chapter 1 Introduction Microsoft® Windows® CE 5.0 is an open, scalable, 32-bit operating system (OS) that allows you to build a wide range of innovative, small footprint devices. A typical Windows® CE-based device is designed for a specific use, and often runs disconnected from other computers, or distributed as a front-end to a centralized host.
ThinkCore DA-660 WinCE User’s Manual Introduction Overview The ThinkCore DA-660 WinCE embedded computer is ideal for reliable, small-footprint, programmable, communication-centric applications. DA-660 uses an Intel XScale IXP-422 RISC-based CPU running at a clock rate of 266 MHz. Unlike the CISC architecture under an X86 CPU, the RISC design supports compact instruction sets. A RISC-based CPU generates less heat and consequently enhances reliability.
ThinkCore DA-660 WinCE User’s Manual Model CPU RAM Flash LAN Serial Port Serial Protection Data Bits Stop Bits Parity Flow Control Speed Serial Console LCM Keypad Real Time Clock Buzzer Reset Button Power Input Power Consumption Dimensions (W × D × H) Operating temperature Storage temperature Regulatory Approvals Warranty Introduction DA-660-8-CE DA-660-16-CE Intel XScale IXP-422 266 MHz 128 MB 32 MB Auto-sensing 10/100 Mbps × 2 with built-in 1.
ThinkCore DA-660 WinCE User’s Manual y y y y y Introduction Microsoft® Foundation Classes (MFC)—MFC is a comprehensive class library and complete object-oriented application framework designed to help build applications, COM components, and controls. SOAP Toolkit—SOAP is an XML-based protocol for object exchange and remote procedure calls. Microsoft® Windows® CE 5.0 provides functionality similar to the SOAP Toolkit version 2 on the desktop.
ThinkCore DA-660 WinCE User’s Manual Introduction Obtaining the Firmware Build Version There are three ways to obtain the firmware version of the DA-660 embedded computer. This information is particularly important for feature identification. y y y Examine the welcome message after you log on to the computer. Log on to the Web-based management system (described in a later chapter) to view the system information. Check the firmware version on the LCM display.
2 Chapter 2 Getting Started In this chapter, we explain how to use a PC to operate a DA-660 computer. For clarity, the PC is referred to as a development workstation and the DA-660 computer is called a target computer. In addition, manual steps are described to facilitate operations such as system time adjustment, troubleshooting network connectivity, etc.
ThinkCore DA-660 WinCE User’s Manual Getting Started Starting Your DA-660 Computer Connect the power cord that is shipped with the package to the AC/DC power connector (located on the right side of the rear panel) of the target computer. It takes about 30 to 60 seconds for the system to boot up. Once the system is ready, the Ready LED lights up and glows steadily till the computer is shutdown and the computer displays its model name and firmware version on the LCM.
ThinkCore DA-660 WinCE User’s Manual Getting Started Server (DNS) is at 192.168.2.6. Execute the following command. \> netconfig –n LAN1 –i 192.168.1.5 –m 255.255.255.0 –g 192.168.1.254 –d 192.168.2.6 Use command netconfig to view the new settings. \> netconfig LAN1 Interface Configuration: IP Address: 192.168.1.5 SubNet Mask: 255.255.255.0 Gateway: DNS: 192.168.1.254 192.168.2.6 LAN2 Interface Configuration: IP Address: 192.168.4.127 SubNet Mask: 255.255.255.
ThinkCore DA-660 WinCE User’s Manual Getting Started Deleting a Group: To remove a group, use the command userdel –g . \> userdel –g yyyy group yyyy has been removed. Adding a User: Use the command useradd to add a user for accessing the system. The user’s password, by default, is the same as the user name. \> useradd xxxx user xxxx has been added. In addition, you can permit this user to access a particular service by typing -g followed by the user group name of the service, i.e.
ThinkCore DA-660 WinCE User’s Manual Getting Started \> time The current time is: 5:27:17 PM Enter the new time (hh:mm:ss): 16:02:00 \> time /T 4:02:04 PM Adjusting RTC Time: Use the command hwclock -w to convert the system time to the RTC time. \> hwclock -w Use the command hwclock –w YYYY-MM-DD hh:mm:ss to manually update the RTC time. \> hwclock –w 2005-12-23 15:00:00 Use the command hwclock to query the updated RTC time.
ThinkCore DA-660 WinCE User’s Manual Getting Started Adapter Index: 3 Address: 78 56 34 91 cc dd DHCP Enabled: NO Host name: DA660CE Domain Name: DNS Servers: 192.168.1.6 NODETYPE: 8 Routing Enabled: NO Proxy Enabled: NO To troubleshoot network connectivity, reachability, and name resolution, use the ping command. This command verifies IP-level connectivity to another TCP/IP computer by sending Internet Control Message Protocol (ICMP) Echo Request messages.
ThinkCore DA-660 WinCE User’s Manual Getting Started SNMP Manager An SNMP manager is an SNMP application that generates queries to SNMP-agent applications and receives traps from SNMP-agent applications. The DA-660 computer installs an SNMP agent to serve as an SNMP device. You should install the SNMP manager on the workstation computer (for example, a Linux system) that monitors the network. After installing the nodes, you need to configure the SNMP manager and agent.
3 Chapter 3 Web-based Management System Note: Internet Explorer 5.5 or above is required to use the web based management system. DA-660 ready-to-run embedded computers are network-centric platforms designed to be used as front-end computers for data acquisition and industrial control. Due to the distributed characteristics of the devices that these computers control, they often reside in harsh areas as the devices themselves and are away from system administrators.
ThinkCore DA-660 WinCE User’s Manual Web-based Management System System Information After you logon successfully, the main page displays the system information of the target computer, including the firmware version of the computer, the CPU system time, and system resources including main memory and file system usage (RAM and Flash). Networking/Server Configuration The target computer has two network interfaces. To view or change their settings, click the Networking item on the menu bar.
ThinkCore DA-660 WinCE User’s Manual Web-based Management System Serial Port Configuration The target computer consists of multiple high-performance serial ports, each with 3-in-1 (RS232, RS422 or RS485) operation mode switch capability, with the default at RS232. You can specify each of these ports to operate at a specific mode. The updated settings take effect after the system is rebooted and remain in force until another update is made.
ThinkCore DA-660 WinCE User’s Manual Web-based Management System Launching Processes Automatically To have your application start on boot, do the following: Step 1: Click the Processes item on the main menu bar. At the lower part of the page, there is an area marked as “Automatic Launching”. Step 2: Fill in the full path of the application in the first text field and its arguments in a separate text field if there are any. Step 3: Click Add.
ThinkCore DA-660 WinCE User’s Manual Web-based Management System Binary/Text File Management On a PC, it is certainly convenient to have a friendly window-based file manager to browse, delete, and organize files and directories. On the target computer, such a convenient feature is simulated by the web-based management system. Click File Manager to view the directory tree of your target computer.
4 Chapter 4 Application Development Application development on the DA-660 computer can be accomplished with a number of well-known tools that are provided by the Windows® environments on programmers’ workstations. These tools are easy for Windows® programmers to use. This chapter presents the development tools for Windows® Embedded Application Development. The following topics are covered in this chapter: Installing Development Tools (IDEs) ¾ VB.
ThinkCore DA-660 WinCE User’s Manual Application Development Installing Development Tools (IDEs) Building applications can be done with a number of friendly Integrated Development Environment (IDE) tools. Choose the tools based on the application language you plan to use and install them on your development workstation. VB.NET/C# Applications: Using Visual Studio 2005 Microsoft® Visual Studio 2005 is a complete set of development tools for building ASP.
ThinkCore DA-660 WinCE User’s Manual Application Development Installing MOXA Windows® CE 5.0 C/C++ SDKs After installing eVC 4.0 on the development workstation, you need to install an SDK from MOXA. The SDK file, e.g., DA660CESDK1_0.msi, is available on the package CD. 1. Double click on the MSI file. A Setup Wizard pops up to start the installation process. Choose Next. If an error message appears, click Close to continue the installation process. 2.
ThinkCore DA-660 WinCE User’s Manual Application Development 3. Type your name for User Name, the name of your company for Organization, and then click Next. 4. To install all functionality provided with the SDK, click Complete and then click Next.
ThinkCore DA-660 WinCE User’s Manual Application Development 5. If you have a folder preference where you want the SDK to reside, click Change and browse to the folder. Otherwise, place it in the default folder and then click Next. 6. Click Install to install the SDK.
ThinkCore DA-660 WinCE User’s Manual Application Development 7. Wait for the installation to be completed. 8. Once the installation is complete, click Finish to close the installer. Developing Applications with IDEs Windows® CE 5.0 with the MOXA SDK you have just installed offers application developers the familiar Windows® IDE and application programming interface (API) with the versatility of scripting languages. We use eVC 4.0 and Visual Studio .
ThinkCore DA-660 WinCE User’s Manual Application Development Developing eMbedded Visual C++ 4.0 applications with an imported SDK 1. Start Microsoft® eMbedded Visual C++ 4.0. 2. From the File menu, choose New. 3. Choose the Projects tab and then select the type of application that you want to build. 4. Fill in the project name and click OK. 5. Choose the type of application that you want to create and then click Finish. 6.
ThinkCore DA-660 WinCE User’s Manual Application Development 7. Develop your application. 8. From the Build menu, choose Rebuild All to compile your application. 9. Ignore the following dialog if it pops up. This is generated by ActiveSync while developing a mobile application. The DA-660 computer is not a mobile device. 10. After you finish developing your application, use the web-based management system to upload it to the target computer. 11.
ThinkCore DA-660 WinCE User’s Manual Application Development 7. Develop your application. 8. From the Device toolbar, choose Windows CE.Net Device. 9. From the Build menu, choose Build Project or Rebuild Project. 10. When you complete your application, use the web-based management system to upload it to the target computer. 11. Log on to the target computer. At the console prompt, execute your application directly, if it is written in C#.
ThinkCore DA-660 WinCE User’s Manual Application Development 4. From the File menu, choose New Æ Project. 5.
ThinkCore DA-660 WinCE User’s Manual Application Development 6. Add Windows CE 5.0 .Net Class DLL to the References from C:\Program Files\Microsoft.NET\SDK\CompactFramework\v2.0\WindowsCE. 7. Set up the Windows CE environment variable from Project Æ Project Properties. 8. From now on, you can start developing your programs. Note that Visual Studio 2005 Express does not support on-line debugging.
ThinkCore DA-660 WinCE User’s Manual Application Development 2. Click Device Option. 3. Click Properties… from the Options pop-up window.
ThinkCore DA-660 WinCE User’s Manual Application Development 4. Click Configure… from the Windows CE 5.0 Device Properties pop-up window. 5. Select the Use specific IP Address option and enter the IP address of the target computer. 6. Click OK to go back to the main screen.
ThinkCore DA-660 WinCE User’s Manual Application Development 7. Click Connect to Device. 8. Wait for the connection to be made. 9. Start the debugging process.
ThinkCore DA-660 WinCE User’s Manual Application Development Remote Tool #2: Remote File Explorer Assume that you have configured a remote connection to the target computer by following the steps described above. 1. Launch the Remote File Viewer. 2. Click the Windows CE 5.0 Device and then click OK.
ThinkCore DA-660 WinCE User’s Manual 3. Application Development Start using the tool to navigate files and directories.
5 Chapter 5 Programming Examples Embedded Visual C++4 Examples The following examples are designed to ease application development. Find and copy useful code segments to your C/C++ programs. In addition, to simplify application development with the eVC4.0 tool, we provide you with a device library (da660.lib). To link the library with your eVC4.0 compilation environment, perform the following steps from your eVC4.0 environment: y From the main tool bar, choose Project Æ Settings.
ThinkCore DA-660 WinCE User’s Manual Programming Examples Example #1—MOXA UART Supporting RS-232/422/485 The following C/C++ code shows a sample application transmitting data from port “COM3” to port “COM4” using the RS-232 operation mode. After these ports have been opened, the application generates a thread to receive data from port “COM3” and then the application itself executes as a main thread to transmit data to port “COM4”. #include "stdafx.h" #include #include
ThinkCore DA-660 WinCE User’s Manual Programming Examples CloseHandle(hCom); return NULL; } return hCom; } //================================================================= static DWORD comReadThread(LPVOID param) { HANDLE hCom = (HANDLE)param ; DWORD rtn; unsigned char buffer[MAX_DATA_LEN+1]; while(1) { if (ReadFile(hCom, buffer, MAX_DATA_LEN, &rtn, NULL)==0) { printf("read data fail\n"); return 0; } buffer[rtn] = '\0'; printf("Data = %s\n", buffer); } CloseHandle(hCom); } int comPair(WCHAR *wComPort,
ThinkCore DA-660 WinCE User’s Manual Programming Examples if (rCom == NULL) { printf("Fail to create read port\n"); CloseHandle(wCom); return 2; } /* for a thread to handle receiving */ if (CreateThread( NULL, 0, comReadThread, (LPDWORD) rCom, NULL, 0 )==NULL) { printf("Fail to create a receiving thread\n"); CloseHandle(wCom); CloseHandle(rCom); return 3; } for (i=0; i< MAX_DATA_LEN;i++) buffer[i] = (unsigned char) ('a'+i%26); PurgeComm(wCom,PURGE_TXCLEAR | PURGE_TXABORT); while(loop++ < 100) { if (WriteF
ThinkCore DA-660 WinCE User’s Manual Programming Examples Depending on the serial port to which a device connects, the target computer supports serial communication in four operation modes: RS-232, RS-422, 2-wire RS-485, and 4-wire RS-485; RS-232 is the default. To change the operation mode, your program should include the following macro definitions; also insert the following DeviceIoControl function on the open handle before the program performs read/write operations.
ThinkCore DA-660 WinCE User’s Manual y y Programming Examples In the Solution Explorer View, add mxdevice.dll to the reference section. Click OK Example #1—MOXA UART Supports RS-232/422/485 The following C# code shows a sample application on operating a serial port. It provides methods to switch the operation mode of the port among RS-232, RS-422 and RS-485 modes. In addition, it uses an event based method to handle data reception. using System; using System.Collections.Generic; using System.
ThinkCore DA-660 WinCE User’s Manual Programming Examples ref byte lpInBuffer, int nInBufferSize, ref byte lpOutBuffer, int nOutBufferSize, ref int lpBytesReturned, IntPtr lpOverlapped ); const uint MOXA_SET_OP_MODE = (0x400 + 66); const uint MOXA_GET_OP_MODE = (0x400 + 67); const uint RS232_MODE = 0; const uint RS485_2WIRE_MODE = 1; const uint RS422_MODE = 2; const uint RS485_4WIRE_MODE = 3; private readonly static IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1); private const UInt32 OPEN_EXISTING = 3; priv
ThinkCore DA-660 WinCE User’s Manual Programming Examples { return SetComPortInterface(RS422_MODE); } public bool SetRS485TwoWire() { return SetComPortInterface(RS485_2WIRE_MODE); } public bool SetRS485FourWire() { return SetComPortInterface(RS485_4WIRE_MODE); } } class MxComPortEx { private SerialPort port; private MxComPortEx(string sPortName, int baudrate) { // create a SerialPort instance with basic settings port = new SerialPort(sPortName, baudrate, Parity.None, 8, StopBits.One); port.
ThinkCore DA-660 WinCE User’s Manual Programming Examples private void ErrorEvent(object sender, SerialErrorReceivedEventArgs e) { Console.WriteLine("error"); } private void DataReceived(object sender, SerialDataReceivedEventArgs e) { while (port.BytesToRead > 0) { Console.WriteLine("Receiving Data: " + port.ReadByte()); } } private bool IsOpen() { return port.IsOpen; } static void Main(string[] args) { MxComPortEx comPort = new MxComPortEx("COM3:", 115200); comPort.Open(); if (comPort.
ThinkCore DA-660 WinCE User’s Manual Programming Examples class Program { static void Main(string[] args) { moxa.uc7400.Buzzer.Beep(2200, 50); } } } Example #3—Real Time Clock The following code shows you how to get the RTC Clock in system time structure format. using System; using System.Collections.Generic; using System.Text; using moxa; namespace test { class Program { static void Main(string[] args) { // get the RTC time moxa.mxdevice.SYSTEMTIME systime = moxa.uc7400.RTC.getRTC(); System.Console.
ThinkCore DA-660 WinCE User’s Manual Programming Examples 4. Add a DWORD value named Port. (The default value must be zero). 5. Modify the value to 51 (the HEX value of 81). 6. Browse to HKEY_LOCAL_MACHINE\Service s\HTTPD\Accept\TCP-80. 7. Modify the value of SockAddr to “02 00 00 51 00 00 00 00 00 00 00 00 00 00 00 00”. 8. Logon the computer via a telnet client and restart the web server. /> services stop HTP0: /> services start HTP0: 9. Try the server with the new URL http://192.168.3.
ThinkCore DA-660 WinCE User’s Manual I have a program under .NET Compact Framework 1.0 (CF1.0). Can I run it on your computer? I have a Windows Visual C++ program. Can I run it on your computer? I have a pure C program. Can I run it on your computer? Programming Examples The target computer pre-installs an engine of version 2.0. It is compatible with version 1.0. Try to execute your program on the computer directly. If it does not work, open the project (CF1.0) with Visual Studio 2005 (CF2.0).
A Appendix A Using the LCM Keypad Da-660 has an LCM and keypad that provide users with on-site parameter readings, and the ability to modify the configuration. Parameters that can be modified include model name, firmware version, network settings, etc. We use the DA-660-16-CE as an example to demonstrate the steps you should follow to configure these parameters.
ThinkCore DA-660 WinCE User’s Manual Frequently Asked Questions Main Menu Network Serial Port ↑ ↓ Press “﹀"or use “SEL” to select an item. Serial Port Console Port ↑ ↓ Press “﹀"or use “SEL” to select an item. Console Port Return ↑ ↓ Press “^"or use “SEL” to select an item. Network Settings ( Port eth0 for example) Network Serial Port ↑ ↓ Press “SEL". eth0 eth1 ↑ ↓ Press “SEL". eth0: IP 192.168.3.127 ↑ ↓ Press “﹀". eth0: Broadcast 255.255.255.255 ↑ ↓ Press “﹀". eth0: Netmask 255.255.255.
B Appendix B Firmware Upgrade Procedure MOXA’s engineering division continuously develops software features to improve the quality and functionality of MOXA’s embedded products. The latest firmware is posted on the MOXA download center. To replace your product’s firmware, perform the following steps: 1. 2. 3. 4. Navigate to the MOXA download center to download a program utility named upfirm and the firmware file (e.g., da660.bin) that you use to replace the current one.
ThinkCore DA-660 WinCE User’s Manual Frequently Asked Questions 5. Input the full path of the firmware file and press Enter. The upgrade process takes about 5 minutes. The system should not be interrupted during this process. 6. After the process is completed, enter “Y” to restore the current network settings or enter “N” to roll back to the factory default values.
ThinkCore DA-660 WinCE User’s Manual 7. Frequently Asked Questions Enter “Y” to reboot the target computer.
C Appendix C Service Information This appendix shows you how to contact MOXA for information about this and other products, and how to report problems. The following topics are covered in this appendix.
ThinkCore DA-660 WinCE User’s Manual Service Information MOXA Internet Services Customer satisfaction is our primary concern. To ensure that customers receive the full benefit of our products, MOXA Internet Services has been set up to provide technical support, driver updates, product information, and user’s manual updates. The following services are provided E-mail for technical support...….............................support@moxa.com World Wide Web (WWW) Site for product information: ..................
ThinkCore DA-660 WinCE User’s Manual Service Information Problem Report Form MOXA DA-660 Series Customer name: Company: Tel: Fax: Email: Date: 1. Moxa Product: DA-660-8-CE 2. Serial Number: DA-660-16-CE _________________ Problem Description: Please describe the symptoms of the problem as clearly as possible, including any error messages you see. A clearly written description of the problem will allow us to reproduce the symptoms, and expedite the repair of your product.
ThinkCore DA-660 WinCE User’s Manual Service Information Product Return Procedure For product repair, exchange, or refund, the customer must: Provide evidence of original purchase. Obtain a Product Return Agreement (PRA) from the sales representative or dealer. Fill out the Problem Report Form (PRF). Include as much detail as possible for a shorter product repair time. Carefully pack the product in an anti-static package, and send it, pre-paid, to the dealer.