Editing PC-Microcontroller Communications

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
 
== Introduction ==
 
== Introduction ==
  
Many times an embedded system or microcontroller needs to be connected to a PC.  This topic discusses the various methods for doing this. This is one of a series of articles on Microcontroller Serial Communications, rooted at this site here: [[Microcontroller Serial Communications Articles]].  This article is for working on the PC side, for information on the microcontroller side see: [[http://www.opencircuits.com/RS232]]
+
Many times an embedded system or microcontroller needs to be connected to a PC.  This topic discusses the various methods for doing this. This is one of a series of articles on Microcontroller Serial Communications, rooted at this site here: [[Microcontroller Serial Communications Articles]]
  
== Serial Communications from a PC to Microcontrollers -- Terminal Emulators ==
+
== Serial Communications from a PC to Microcontrollers ==
  
This is often done using Hyperterminal ( a program bundled with MS Windows ) to communicate with the microcontroller using '''RS232''' or '''virtual RS232 over USB'''.  This program is pretty painful to use, we list some alternatives to it here:
+
This is often done using Hyperterminal ( a program bundled with MS Windows ) to communicate with the microcontroller using RS232 or virtual RS232 over USB.  This program is pretty painful to use, we should list some alternatives to it here.  This is just a start:
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 22: Line 22:
 
|From the site:
 
|From the site:
 
''The I/O Commander is designed to communicate, test and control our line of digital and analog I/O products. However, due to its flexible nature, it can also be used as a general purpose terminal emulator (color coded TXD/RXD, split screen modes, and 32/1024 "hot-keys") and, as a drum sequencer. The terminal emulator now supports COM1 through COMX, and data rates from 300bps to 921.6Kbps. Now with flow control and parity.  Same low cost: Free''
 
''The I/O Commander is designed to communicate, test and control our line of digital and analog I/O products. However, due to its flexible nature, it can also be used as a general purpose terminal emulator (color coded TXD/RXD, split screen modes, and 32/1024 "hot-keys") and, as a drum sequencer. The terminal emulator now supports COM1 through COMX, and data rates from 300bps to 921.6Kbps. Now with flow control and parity.  Same low cost: Free''
<!-------------------------------->
 
|-valign="top"
 
|[http://www.com-port-monitoring.com/datalogger.html RS232 COM Port Logger]
 
|Capture and log RS232 port dataflows Review anyone? Open Source.  For Windows.
 
 
'Claims that it can be used to log the data flowing between two applications, but I found that it grabbed the COM port itself and was only able log incoming data from a single source. The help file added nothing to what was already visible on the screen. I used Eltima's virtual COM ports many years ago and was quite happy with them, but I found this product to be pretty useless. - mickeyf 2013/05/09'
 
 
 
<!-------------------------------->
 
<!-------------------------------->
 
|-valign="top"
 
|-valign="top"
Line 38: Line 31:
 
|From the site:  
 
|From the site:  
 
''last updated: Aug. 9, 1999 Tera Term (Pro) is a free software terminal emulator (communication program) for MS-Windows. It supports VT100 emulation, telnet connection, serial port connection, and so on.''
 
''last updated: Aug. 9, 1999 Tera Term (Pro) is a free software terminal emulator (communication program) for MS-Windows. It supports VT100 emulation, telnet connection, serial port connection, and so on.''
* Cost: Free
 
* Related: [http://www.ayera.com/teraterm/ TeraTerm Pro Web 3.1.3 - Enhanced Telnet/SSH2 Client]
 
 
<!-------------------------------->
 
<!-------------------------------->
 
|-valign="top"
 
|-valign="top"
 
|[http://www.ontrak.net/adrcom.htm Using ADRCOM Terminal Emulation Software]
 
|[http://www.ontrak.net/adrcom.htm Using ADRCOM Terminal Emulation Software]
 
|From the site:  
 
|From the site:  
''ADRCOM is a FREE terminal emulation program available from Ontrak Control Systems that allows simple ASCII commands to be sent and received via a serial port. It can be used to verify hardware connection of an  ADR device and familiarize programmers with the ASCII commands used with the interfaces. In this example an ADR112 is connected to com1.'' Looks nice, how about a review? `
+
''ADRCOM is a FREE terminal emulation program available from Ontrak Control Systems that allows simple ASCII commands to be sent and received via a serial port. It can be used to verify hardware connection of an  ADR device and familiarize programmers with the ASCII commands used with the interfaces. In this example an ADR112 is connected to com1.'' Looks nice, how about a review?
* Cost: Free
 
 
<!-------------------------------->
 
<!-------------------------------->
 
|-valign="top"
 
|-valign="top"
|[http://www.freedownloadmanager.org/downloads/terminal_emulator_software/ Terminal Emulators]
+
|[http://www.freedownloadmanager.org/downloads/terminal_emulator_software/]
 
|A list of terminal emulators, may be a good one in the bunch or several.
 
|A list of terminal emulators, may be a good one in the bunch or several.
<!-------------------------------->
 
|-valign="top"
 
|[www.google.com  BoostC]
 
|BoostC has a termainal window as part of its IDE.  Free version available.
 
* Cost: Free Version
 
<!-------------------------------->
 
|-valign="top"
 
|
 
|Some PIC programmers have terminal windows, this needs more research
 
<!-------------------------------->
 
|-valign="top"
 
|[http://realterm.sourceforge.net/Serial Terminal -- Real Term]
 
|Open Source.  take a look
 
* Cost: Free
 
<!-------------------------------->
 
|-valign="top"
 
|[http://www.com-port-monitoring.com/datalogger.html RS232 COM Port Logger Capture and log RS232 port dataflows]
 
|Review anyone?
 
<!-------------------------------->
 
|-valign="top"
 
|[http://www.etc.ugal.ro/cchiculita/software/picbootloader.htm Tiny PIC bootloader]
 
|16F and 18F chips.  Has a terminal emulator
 
<!-------------------------------->
 
|-valign="top"
 
|[http://www.aggsoft.com/serial-port-monitor/ Serial Port Monitor]
 
|Allows to detect a communication problem with some instrumentation. With this software, you can able to monitor the commands going over the RS232 line and determine a good course of action to solve any problem.
 
 
<!--------------------------------
 
<!--------------------------------
 
|-valign="top"
 
|-valign="top"
Line 94: Line 58:
 
<!-------------------------------->
 
<!-------------------------------->
 
|}
 
|}
 
  
 
( for the search engines: dump HyperTerminal find a better communications program )
 
( for the search engines: dump HyperTerminal find a better communications program )
  
For some notes on how to plan the microcontroller end of the communications see: [[RS232]]  and for a particular implementation take a look at [[BitWacker PIC USB Development Board]] and the specialized PC program for it and similar devices: [[BitWacker Java Communications]]
+
For some notes on how to plan the microcontroller end of the communications see: [[RS232]]  and for a particular implementatation take a look at [[BitWacker PIC USB Development Board]] and the specialized PC program for it and similar devices: [[BitWacker Java Communications]]
  
 
For general information on terminal emulators see: [http://en.wikipedia.org/wiki/Terminal_emulator  Terminal emulator From Wikipedia, the free encyclopedia]
 
For general information on terminal emulators see: [http://en.wikipedia.org/wiki/Terminal_emulator  Terminal emulator From Wikipedia, the free encyclopedia]
Line 110: Line 73:
 
* Slow
 
* Slow
 
* Requires bulky connectors and level translators
 
* Requires bulky connectors and level translators
* Many new computers especially laptops don't have rs232 serial ports
+
* Many new computers especially laptops don't have serial ports
 
 
== Serial Communications from a PC to Microcontrollers -- Writing Programs ==
 
 
 
Writing PC programs to communicate with Microcontrollers can be very challenging, or not so much.  The easiest I have encountered are the libraries for the Arduino which are part of the Processing environment.  Look at the Arduino examples.  You do not have control over all rs232 parameters or the ability to manage all possible errors, but you do have a quick way to program that works.  Under the hood this is based on using Java.  Should run on all major operating systems.  This is free and largely open software.
 
 
 
*insert links here
 
 
 
The USB Bitwacker comes with a Liberty Basic program that seems to work quite well.  Liberty Basic is not free, but I think has a demo version that is enough ability to run reasonable programs.  If you can live with this situation and Basic, this could be for you.
 
 
 
 
 
*insert links here
 
 
 
I have written several programs using Java, there has not been much interest on the net so I have worked on them only for my own use and from time to time.
 
 
 
*insert links here.
 
 
 
 
 
I have heard VB proponents claim that it is pretty easy with VB.  Someone else will have to provide more information.
 
I
 
  
 
== USB Communications from a PC to Microcontrollers ==
 
== USB Communications from a PC to Microcontrollers ==
  
Many modern computers especially laptops do not have serial ports and the serial connector port is big and bulky.  RS232 communication requires the use of level shifters which add parts.  Serial communication can also be slow.  Note that USB often appears as virtual RS232 on the PC which allows you to use RS232 on the microcontroller and rs232 techniques on the PC.
+
Many modern computers especially laptops do not have serial ports and the serial connector port is big and bulky.  RS232 communication requires the use of level shifters which add parts.  Serial communication can also be slow.
  
An alternative is more and more microcontrollers now have native support for USB which has smaller connectors, is faster, and works with the plug and play architecture of modern OSs.  The disadvantage is that the firmware is much more complex and the PC side requires an device driver and corresponding INF file.  Lucky, many generic drivers are available and many microcontroller manufacturers that support USB provide sample firmware.
+
An alternative is more and more microcontrollers now have native support for USB which has smaller connectors, is faster, and works with the plug and play architecture of modern OSs.  The disadvantage is that the firmware is much more complex and the PC side requires an device driver and corresponding INF file.  Lucky, many generic drivers are available and many microcontroller manufacters that support USB provide sample firmware.
  
 
{| class="wikitable"
 
{| class="wikitable"
 
|-valign="top"
 
|-valign="top"
|Category
+
|Catagory
 
|Site
 
|Site
 
|Comments
 
|Comments
Line 165: Line 109:
 
|Device Driver
 
|Device Driver
 
|[http://msdn2.microsoft.com/en-us/library/aa476426.aspx WinUSB]
 
|[http://msdn2.microsoft.com/en-us/library/aa476426.aspx WinUSB]
|Free generic device driver provided by Microsoft for Windows XP and Vista   
+
|Free generic device driver provided by microsoft for Windows XP and Vista   
 
<!-------------------------------->
 
<!-------------------------------->
  
Line 181: Line 125:
 
* No level translators and small connectors
 
* No level translators and small connectors
 
* Works with computers that don't have serial ports
 
* Works with computers that don't have serial ports
* Ability to implement standard devices such a keyboards, mice, memory card readers, and sound cards without writing a device driver.
+
* Ability to implement standard devices such a keyboards, mice, memory card readers, and sound cards without writting a device driver.
  
 
Disadvantages:
 
Disadvantages:
Line 192: Line 136:
 
== Ethernet-TCP/IP Communications from a PC to Microcontrollers ==
 
== Ethernet-TCP/IP Communications from a PC to Microcontrollers ==
  
Ethernet and the Internet is everywhere so many embedded devices now have Ethernet connections.  Network connections can be very long and it's possible to use cheap commodity hardware such as WiFi bridges.  Several microcontroller manufacturers are now providing sample TCP/IP stacks some of them with embedded web servers so that the hardware can be controlled from a PC via a web browser such as IE or Firefox.  PC programming has a mostly OS independent API called sockets that is available on both Windows and Unix.
+
Ethernet and the Internet is everwhere so many embedded devices now have ethernet connections.  Network connections can be very long and it's possible to use cheap commodity hardware such as WiFi bridges.  Several microcontroller manufacters are now providing sample TCP/IP stacks some of them with embedded web servers so that the hardware can be controlled from a PC via a web browser such as IE or Firefox.  PC programming has a mostly OS independent API called sockets that is available on both Windows and Unix.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 212: Line 156:
 
Advantages:
 
Advantages:
 
* Fast
 
* Fast
* Long cable lengths and commodity equipment
+
* Long cable lengths and commodity equiptment
 
* PC API is mostly OS independent
 
* PC API is mostly OS independent
 
* No device drivers required
 
* No device drivers required
Line 224: Line 168:
 
== Bluetooth-SPP Communications from a PC to Microcontrollers ==
 
== Bluetooth-SPP Communications from a PC to Microcontrollers ==
  
Many laptops and even desktops now have bluetooth support or a bluetooth dangle can be purchased for a small amount of money.  This makes bluetooth a good choice for controlling microcontrollers wirelessly.  Several drop inn modules are available that implement the Bluetooth SPPprotocoll which allows direct emulation of a serial cable.  The models usually have an AT command set for configuring the module and establishing connections.  Most Bluetooth stacks on the PC have support for SPP and will expose the device as a COM port.  Detection of the COM port is difficult since Bluetooth doesn't have a standard stack for Windows.   
+
Many laptops and even desktops now have bluetooth support or a bluetooth dangle can be purchased for a small amount of money.  This makes bluetooth a good choice for controlling microcontrollers wirelessly.  Several dropin modules are available that implement the Bluetooth SPP protocal which allows direct emulation of a serial cable.  The models usually have an AT command set for configuring the module and establishing connections.  Most Bluetooth stacks on the PC have support for SPP and will expose the device as a COM port.  Detection of the COM port is difficult since Bluetooth doesn't have a standard stack for Windows.   
  
 
{| class="wikitable"
 
{| class="wikitable"
 
|-valign="top"
 
|-valign="top"
|Category
+
|Catagory
 
|Site
 
|Site
 
|Comments
 
|Comments
Line 236: Line 180:
 
|Hardware
 
|Hardware
 
|[http://www.sparkfun.com/commerce/product_info.php?products_id=8461 Bluetooth DIP Module - SparkFun]
 
|[http://www.sparkfun.com/commerce/product_info.php?products_id=8461 Bluetooth DIP Module - SparkFun]
|Bluetooth drop in serial replacement module from SparkFun
+
|Bluetooth dropin serial replacement module from SparkFun
 
<!-------------------------------->
 
<!-------------------------------->
  
Line 254: Line 198:
 
== RS232 Level Translation ==
 
== RS232 Level Translation ==
  
Many microcontrollers do rs232 but do not output levels that are rs232 standard.  I have often seen statements that they work anyway.  Could be true.  The standard solution is to use a MAX232 chip.  Rather than put one in every project you can use a separate board or cable.   
+
Many microcontrollers do rs232 but do not output levels that are rs232 standard.  I have often seen statements that they work anyway.  Could be true.  The standard solution is to use a MAX232 chip.  Rather than put one in every project you can use a seperate board or cable.  Some links:
 
 
Some links:
 
  
 
* [http://www.makershed.com/ProductDetails.asp?ProductCode=MKMD2  P4 Adapter/Serial Cable]  My favorite, think is comes from next reference
 
* [http://www.makershed.com/ProductDetails.asp?ProductCode=MKMD2  P4 Adapter/Serial Cable]  My favorite, think is comes from next reference
Line 273: Line 215:
  
  
[[category:Serial Communications]][[category:Microcontroller]][[Category: Techniques]]
+
[[category:Serial Communications]][[category:Microcontroller]]

Please note that all contributions to OpenCircuits may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see OpenCircuits:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)