Programming the Pocket PC OS for Embedded IR Applications

Programming the Pocket PC OS for Embedded IR Applications

AN926 Programming the Pocket PC OS for Embedded IR Applications Appendix A: “Example Irda Standard System Author: Joseph Snyder, Microchip Technology Inc. Description” describes the system and documents the Frank Ableson, Unwired Tools, LLC tool used to create this Pocket PC application program, while Appendix B: “PPC Source Code - IrDA INTRODUCTION DEMO.CPP” through Appendix C: “PPC Source Code - IrDA DemoDlg.cpp” is the PPC Application This application note details the tools, supporting Program source code. technologies and procedures for the development of infrared applications on Windows Mobile™ based Figure 1 shows an IrDA standard system, where a devices. Pocket PC PDA device is communicating with an embedded system. In this system, the Pocket PC A Pocket PC (PPC) application that interfaces with an (PPC) PDA operates as the Primary Device (Client) embedded system via IrCOMM is included in the and the embedded system operates as the Secondary Appendices of this application note. This source code Device (Server). The terms Client and Server are used ® demonstrates the use of the Windows Application in reference to Windows (PC and PPC) programming, ® Programming Interface (API) required for IrDA while Primary Device and Secondary Device are terms standard IR communication on Windows Mobile based used by the IrDA Standard. platforms. FIGURE 1: POCKET PC PDA - EMBEDDED SYSTEM BLOCK DIAGRAM Embedded System with IrDA® Port (Secondary Device/Server) Host Controller MCP215X Optical and Embedded or Transceiver Circuitry MCP2140 Circuitry Pocket PC Handheld Device with IrDA® Standard Port (Primary Device/Client) © 2007 Microchip Technology Inc. DS00926A-page 1 AN926 Terminology • Primary Device: The IrDA standard device that queries for other devices. Below is a list of useful terms and their definitions: • Secondary Device: The IrDA standard device • Pocket PC: A Windows Mobile based handheld that waits to detect IR communication before device. performing any IR communication. • Windows CE™: Microsoft® operating system for • Host Controller: The controller in the embedded handheld devices. system that communicates to the MCP215X or • Microsoft ActiveSync®: Application enabling the MCP2140. creation of a partnership between a desktop • MCP215X: An IrCOMM protocol handler IC that computer and a mobile device. This application supports IR communication from 9600 baud to allows desktop debugging of Windows Mobile 115,200 baud. based applications. • MCP2140: A low-cost IrCOMM protocol handler • Host System: The computer with which a PPC IC that supports IR communication at 9600 baud. OS device performs an ActiveSync. The host • Protocol Stack: A set of network protocol layers system is also where development takes place. that work together. Figure 2 shows the IrDA Host systems are typically based on Windows, standard protocol stack. Macintosh® or Linux® operating systems. • IrCOMM (9-wire “cooked” service class): IrDA • Microsoft Foundation Class (MFC): Class standard specification for the protocol to replace library and framework for application development the serial cable (using flow control). on Windows based platforms. ® • Microsoft eMbedded Visual C++ : FIGURE 2: IrDA® STANDARD DATA - Development environment for the development of PROTOCOL STACKS Windows Mobile based applications using C++. Available for free download from Microsoft’s web IrTran-P IrObex IrLan IrComm (1) IrMC site at www.microsoft.com. • Microsoft eMbedded Visual Basic®: LM-IAS Tiny Transport Protocol (Tiny TP) Development environment for the development of Windows Mobile based applications using Visual IR Link Management - Mux (IrLMP) Basic. Available for free download from Microsoft’s web site at www.microsoft.com. IR Link Access Protocol (IrLAP) • Microsoft Visual Studio® .NET: Development environment for the development of Windows Asynchronous Synchronous Synchronous desktop and Mobile based applications using Serial IR (2, 3) Serial IR 4 PPM C++, Visual Basic, Visual C#® and the .NET (9600 -115200 b/s) (1.152 Mb/s) (4 Mb/s) framework. Available for purchase from Microsoft’s web site at www.microsoft.com. • Microsoft Software Development Kit (SDK): Documentation, samples, header files, libraries Supported by Optional IrDA® standard and tools needed to develop applications that run the MCP215X data protocols not on the Windows operating system. All Microsoft and MCP2140. supported by the MCP215X tools require the correct platform SDK to target and MCP2140. Windows Mobile based devices. • Microsoft eMbedded Visual Tools 3.0: Note 1: The MCP215X and MCP2140 Development environment for the development of implement the 9-wire “cooked” service Windows Mobile based applications, includes class serial replicator. Microsoft eMbedded Visual C++ 3.0, eMbedded 2: An optical transceiver is required. Visual Basic 3.0 and the required SDK for Pocket PC 2002. 3: The MCP2140 support 9600 baud IR communication only. INFRARED COMMUNICATIONS The application built and discussed in this application note uses a high-level, infrared protocol called IrCOMM. This protocol is designed to be a wire- DS00926A-page 2 © 2007 Microchip Technology Inc. AN926 replacement technology. Infrared technology is an Note 1: The project files have been converted to excellent choice for data collection for many reasons, embedded Visual C version 4.0. including: 2: The sample application created in this • Availability: Virtually every late-model PDA and Application Note is a Microsoft laptop contains an IrDA standard port. Foundation Class (MFC) C++ application • Cost: IrDA standard communications may be which relies heavily on the characteristics added to a custom design very economically, as of object oriented programming. demonstrated in this application note. Therefore, to get the most out of this • Convenience and Compatibility: Working without application note’s examples requires an wires means no cables, gender-changers or any understanding of C++ programming. other gadgets to allow two devices to communi- However, it is possible to employ “C#” to cate. This is vital to the frequent traveler or perform IrDA programming under the technician in the field. Windows environment. An example of C# For more information regarding the IrComm protocol, IrDA programming under Pocket PC visit the IrDA organization’s web site at: www.irda.org. 2003 is available on the web site within this application note’s zipped source code files. WINDOWS POCKET PC DEVELOPMENT POCKET PC 2002 The Windows Mobile based Pocket PC is a handheld The eMbedded Visual Tools 3.0 package, available for device utilizing the Windows Pocket PC 2000/2002/ free from Microsoft (www.microsoft.com), includes 2003 platforms. The Pocket PC software platforms are eMbedded Visual C++ 3.0, eMbedded Visual Basic 3.0 built on the Windows CE 3.0/4.0 operating systems (see and the required software development kit (SDK). This Table 1). Pocket PC allows development of applications version supports the Pocket PC 2002 platform. using the familiar Windows development tools and POCKET PC 2003 APIs. These APIs include support for the development of applications that can communicate with other devices Development of Pocket PC 2003 applications requires utilizing wireless transmission, such as Wi-Fi®, eMbedded Visual C++ 4.0 or .NET tools. eMbedded Bluetooth™ and infrared. Visual C++ 4.0 is also available as a free download from Microsoft’s web site at www.microsoft.com. Pocket PC Tools TABLE 1: PLATFORM OPERATING Microsoft offers a wide range of development choices, SYSTEMS including the eMbedded Visual C++, eMbedded Visual Basic and Visual C# programming languages. There Pocket PC Platform Window CE Version are currently three development environments avail- 2000 2.0, 2.1, 2.11, 3.0 able for Pocket PC development: eMbedded Visual 2002 3.0 and later C++, eMbedded Visual Basic and Visual Studio .NET. The platform and chosen API (Win32®, MFC, ATL, 2003 4.0 and later .NET Compact Framework) determines the application tools and languages available for development (see Table 2). Both platforms, Pocket PC 2002 and Pocket PC 2003, can be targeted with one code base using eMbedded Visual C++ 3.0 if the application being developed uses the documented Microsoft APIs. This application note focuses on development of Pocket PC 2002 and 2003 applications using Microsoft’s eMbedded Visual C++ and the Microsoft Foundation Library (MFC). © 2007 Microchip Technology Inc. DS00926A-page 3 AN926 TABLE 2: PLATFORM DEVELOPMENT TOOLS Development Tools eMbedded Visual Tools 3.0 eMbedded Visual eMbedded Visual eMbedded Visual Visual Studio .NET C++ 3.0 Basic 3.0 C++ 4.0 (C#, Visual Basic) Pocket PC 2002 X X — — Pocket PC 2003 — — X X API • MFC • eMbedded Visual •MFC • .NET Compact •ATL Basic •ATL Framework •Win32® •Win32® TOOL INSTALLATION WINDOWS PROGRAMMING To insure inter operability between the development The Windows programming model is based on an tools and the ability to target multiple platforms, the event-driven architecture. Events can be generated development tools and SDKs should be installed on the through user interaction or some other event. Each development system in the recommended order. time the user interacts with the interface, an event is 1. Uninstall all existing tools and SDKs. generated and a message is placed in the operating 2. Install Microsoft ActiveSync 3.7. system's message queue to be dispatched to the 3. Install the eMbedded Visual Tools - 2002 application. A message handler in the application Edition, Pocket PC 2002 SDK and Smartphone handles

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    72 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us