<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>unsaturated.com &#187; microcontroller</title>
	<atom:link href="http://www.unsaturated.com/tag/microcontroller/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.unsaturated.com</link>
	<description>The personal and professional website of Matthew Crumley</description>
	<lastBuildDate>Mon, 19 Apr 2010 03:51:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Microcontroller/PDA IrDA Communication</title>
		<link>http://www.unsaturated.com/essays/microcontroller-pda-irda-communication/</link>
		<comments>http://www.unsaturated.com/essays/microcontroller-pda-irda-communication/#comments</comments>
		<pubDate>Mon, 16 Jul 2007 02:07:24 +0000</pubDate>
		<dc:creator>Matthew Crumley</dc:creator>
				<category><![CDATA[Essays]]></category>
		<category><![CDATA[essay]]></category>
		<category><![CDATA[microcontroller]]></category>

		<guid isPermaLink="false">http://www.unsaturated.com/essays/microcontrollerpda-irda-communication/</guid>
		<description><![CDATA[My undergraduate class Computer System Design I focused on the Motorola MC68HC11 microcontroller family.  In addition to learning the chip architecture and assembly code, I wrote a short paper that examines the viability of interfacing a cheap microcontroller with a common PDA.]]></description>
			<content:encoded><![CDATA[<h3>INTRODUCTION</h3>
<p>Many of us have watched an employee from the power company come to read our power meter. He is collecting information in the field and storing it in a portable device. The trend is similar in the consumer market where people demand information anytime and anywhere. The pervasiveness of portable digital assistants (PDAs) combined with their wireless abilities can open new possibilities for microcontroller applications.</p>
<p>An interface all but few PDAs have in common is an infrared port. This enables wireless, two-way communication with any other device using the Infrared Data Association (IrDA) standard. Combining a microcontroller using the IrDA interface and almost any PDA—which already has the interface built-in—can speed the process of data acquisition and even simplify it.</p>
<p>This paper will discuss and examine possible hardware and software issues specific to such a microcontroller/PDA (mC/PDA) interface. The most notable challenge said interface will create is cross-platform compatibility. Microcontrollers (mCs) use assembly language specific to their manufacturer and the family of mC. Further, there is no standard PDA operating system (OS), which could create additional compatibility issues. By establishing hardware and software objectives, a strong focus on this new arena of mC/PDA applications can succeed.</p>
<h3>RESEARCH OBJECTIVES</h3>
<p>The serial computer interface (SCI) is a logical place to start examining the mC/PDA hardware interface. Starting here will establish a bit pattern for data transfer on, for example, the Motorola MC68HC11. For an external interface, the 68HC11 can support the RS-232 standard. Combined with a MAXIM MAX232, the voltage levels of the SCI signals can be augmented to the corresponding RS-232 signals.</p>
<p>The second logical step in hardware design is interfacing the microcontroller&#8217;s RS-232 port with an IrDA device. There are two options for accomplishing this level of integration and design resolution.</p>
<p>The retail version of an RS-232 to IrDA converter is available from Actisys, Inc. The Actisys IR2000L retails for approximately $175 USD. It has eight pins (IRTX, ITRX1, GND, Vcc, IRRX2, SEL1/ID1, SEL2/ID2, and ID3). This is a costly solution, but not prohibitive for smaller scale projects. The IR2000L accepts the standard serial port connectors and easily converts to and from the wireless IrDA standard.</p>
<p>The second option would be to create an IrDA device from the component level. The receiving components available for this are the IS1U60L or GP1U52X. Both of these are IR receivers but the transmission would require another chipset. To achieve a standard method of IrDA Tx/Rx necessitates further electrical design factors. This option has the advantage of cost. These are relatively inexpensive chips compared to the Actisys solution—a very important factor for large-scale production of an mC/PDA interface.</p>
<p>The hardware issues on the PDA side are moot. The IrDA Tx/Rx circuitry is already integrated into the PDA. Thus, half of the hardware design for this interface is complete. The greater issue at hand is the &#8220;code,&#8221; or communication standard these two devices should use to communicate bi-directionally. The 68HC11 is used as an example in this paper, but the ultimate goal is to create a standard state and/or process most microcontrollers could achieve to communicate with a PDA.</p>
<h3>ANALYSIS</h3>
<p>For an mC to perform operations (measurements, sensing, etc.) it must be autonomous until an IrDA signal is detected. This requires intuitive use of an interrupt. The PDA sends a &#8220;wake-up&#8221; signal to the mC, requesting communications. The 68HC11 has such a feature in the SCI receiver.</p>
<p>The wake-up feature would be one of several interrupts in a common code spoken by the PDA and mC. The other interrupts would be related to the TASK (see Figure 1) the mC is being used to execute. If the mC requires multiple interrupts (including the PDA), only one external interrupt is inadequate. In the 68HC11, the IRQ pin is available for an external interrupt. For any practical application, more than one interrupt would be useful. To remedy this, Abel Raymus, has recently published one possible solution in EDN magazine. He offers an inexpensive alternative to buying an mC that supports multiple external interrupts. The states of some interrupts are shown in Figure 1.</p>
<p>The state diagram is similar to that used by Mukaro and Carelse. For their Data Acquisition System the state is dictated by two major events: the RS-232 PC interface is connected and a data sensor is sending data to the microcontroller.</p>
<p>The mC/PDA design has a similar state, but the focus is on Tx/Rx between the microcontroller and PDA. This design assumes data will be sent from the mC to the PDA and instructions/data sent from the PDA to the mC. If instructions—in addition to data—can be sent to the mC, then TASK processes can have a much greater range of utility.</p>
<p><img src="/wordpress/wp-content/data/mcpda.png" alt="Figure 1" /></p>
<h3>SIMULATION / PROGRAMMING</h3>
<p>The standard used to ensure correct data transmission between the PDA and mC should be the same as Huang has outlined:</p>
<ol>
<li>Data must be transferred character by character.</li>
<li>A character must consist of one start bit, seven or eight data bits, an optional parity bit, and one or two stop bits.</li>
<li>The start bit must be low.</li>
<li>The least significant bit must be transferred first, and the most significant bit must be transferred last.</li>
<li>The stop bit must be high.</li>
<li>A clock with frequency equal to sixteen times the data bit rate must be used to detect the arrival of the start bit and determine the value of each data bit.</li>
</ol>
<p>These guidelines are intended to eliminate any ambiguity a programmer might encounter when deciding on a standard the PDA should use when transferring a bit stream. This also allows a receiver to synchronize a local clock to each new character.</p>
<p>A bit rate of 9600 baud should allow for ample bandwidth considering the limited storage space addressable by most mCs. For example, the 68HC11 is only expandable to 64 Kbytes. A complete transfer of memory would take very little time at 9600 baud. Even at a slower speed (by IrDA standards), an error correction scheme should be established—correcting for framing, receiver overrun, and parity errors.</p>
<p>Another example of serial-infrared conversion is provided by Wettroth. He notes that the 8051 microcontroller uses a UART that is not compatible with IrDA. Using a high quality IrDA module such as the HP- 1000 combined with the MAX3100 chip, driver code can be written to convert from RS-232 to IrDA and vice versa.</p>
<p>Indeed, if the mC/PDA design calls for instructions to be sent to the mC, then there must be some way of storing them. The EEPROM supports about 100,000 write-erase cycles for doing this. Assuming a program is uploaded to the EEPROM, the RxD and TxD pins must be tied together after reset—making the program run automatically.</p>
<p>The alternative to storing instructions is placing them into RAM. This is a volatile means of storing a program, and should only be done if a reliable, dependable power supply is available to the mC. After reset (in bootstrap mode only) the mC waits for data from the IrDA port. When the program is stored into RAM, the program begins execution. The instruction space is very limited by available RAM. The 68HC11 has 512 bytes of RAM. Other mCs will vary in storage space and the programmer should take this into consideration when coding assembly for the mC.</p>
<h3>EXPECTED RESULTS</h3>
<p>The final component of mC/PDA communication would be placed on the PDA itself. Once the protocol logistics have been establish, implementing them on the PDA would be the next logical step. There are several factors to consider when coding for a PDA.</p>
<p>The most distinctive feature separating various brands of PDA is the OS. The PDA OS should be selected based on the application best suited for it—not the opposite. The two most prominent OSes available today are Palm OS, by Palm Computing and Pocket PC, by Microsoft. The majority of PDA users have chosen the Palm OS based on simplicity. It is also fast and efficient. Pocket PC devices have a greater range of features and memory but this might be overkill for simple data collection or mC programming in the field. Most PDAs support IrDA speeds up to 115 kbaud, and have FLASH memory expandable to 128MB. This is ample transfer speed and storage space for an mC that can transfer at 9600 baud and store up to 64KB, as in the 68HC11.</p>
<h3>FUTURE RESEARCH / APPLICATIONS</h3>
<p>Additional research can be done to investigate the specifics of coding for each PDA OS. The viability of such an mC/PDA interface could be evaluated for a series of microcontrollers across manufacturers or isolating a specific family of microcontrollers within one manufacturer.</p>
<p>An mC/PDA interface doesn&#8217;t have to be restricted to corporate or private use. According to Walley and Amin, the future of automation in customer environments can offer an array of new applications for improved service. A customer could simply request information pertaining to a certain product or service and have that information downloaded to the PDA. The newest trend is in mobile commerce (m-commerce). Its objective is a wireless method for checkout and/or purchasing in retail stores. Rightly equipped, this is a very practical solution for automation and customer service.</p>
<h3>CONCLUSION</h3>
<p>The mC/PDA interface is a viable solution that can be applied to many applications. Considering the hardware and software available today, both platforms—Pocket PC and Palm OS—provide software development kits to program either OS. Off-the-shelf products such as the Actisys IR2000L can provide an immediate solution if hardware production time is the greatest factor to consider (and price is a lesser issue). On a larger scale of development, the individual IR components should be realized into a functioning circuit. Regardless of the IrDA implementation, the use of multiple interrupts is strongly recommended.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.unsaturated.com/essays/microcontroller-pda-irda-communication/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
