How to Use Serial Port to Read Chip

Contributors: Joel_E_B, jimblom, maettu_this

Favorited Favorite 39

Serial Concluding Overview

COM ports. Baud charge per unit. Menstruation command. Tx. Rx. These are all words that get thrown around a lot when working with electronics, peculiarly microcontrollers. For someone who isn't familiar with these terms and the context in which they are used, they can exist confusing at times. This tutorial is here to assistance you empathize what these terms mean and how they grade the larger picture that is serial communication over a terminal.

In short, series terminal programs make working with microcontrollers that much simpler. They allow you lot to see data sent to and from your microcontroller, and that data can be used for a number of reasons including troubleshooting/debugging, advice testing, calibrating sensors, configuring modules, and data monitoring. Once y'all take learned the ins and outs of a terminal application, it can be a very powerful tool in your electronics and programming arsenal.

Covered in this Tutorial

There are lots of dissimilar last programs out there, and they all have their pros and cons. In this tutorial we volition talk over what a terminal is, which final programs are best suited for certain situations and operating systems, and how to configure and utilise each plan.

Suggested Reading

Y'all should be familiar with these topics earlier diving into this tutorial. If you lot need a refresher, feel complimentary to popular on over to these links. We'll be right hither waiting.

  • Serial Communication
  • Analog vs Digital
  • Binary
  • Hexadecimal
  • ASCII
  • Installing FTDI Drivers
  • RS-232 vs TTL Series Communication
  • Logic Levels
  • Connector Basics specially the USB department

What is a Terminal?

Terminal emulators go by many names, and, due to the varied use of the word terminal, at that place can often be some confusion about what someone means when they say concluding. Allow's clear that up.

Brief History

To empathize the use of the discussion terminal, we must visit the not so afar past. Back when computers where big, bulky, and took up entire rooms, there were just a handful of ways to interface with them. Punch cards and paper tape reels where 1 such interface, but there was also what was known as a terminal that was used for inbound and retrieving data. These terminals came in many form factors, merely they soon began to resemble what would become their personal computer descendants. Many consisted of a keyboard and a screen. Terminals that could display text only were referred to as text terminals, and afterward came graphical terminals. When discussing terminal emulators, it's these terminal of days past that are being referenced.

alt text

An OG concluding

Modernistic Terminals

Today, concluding programs are "emulating" the experience that was working on one of these terminals. They are known every bit emulators, applications, programs, terms, TTYs, and then on. For the purposes of this tutorial, just the word terminal will be used. Many terminals use to emulate specific types of computer terminals, but today, most terminals are more generic in their interface.

When working on a modern operating system, the word terminal window will frequently be used to describe working within 1 of these applications. And, often, when reading other tutorials and hookup guides, you will be requested to open a terminal window. Just know that means to open whichever 1 of these terminals programs strikes your fancy.

Information technology is also worth noting that many terminal programs are capable of much more than than just series communication. Many take network communication capabilities such as telnet and SSH. Yet, this tutorial will not cover these features.

Last vs Command Line

A terminal is not a control prompt, though the two are somewhat like. In Mac OS, the control prompt is fifty-fifty called Terminal. Hence the confusion when using that word. Regardless, you can perform some of the aforementioned tasks in a command prompt that you could also perform within a terminal window, but it doesn't work the other way around; y'all cannot event command line statements within a terminal window. Nosotros will go over how to create a serial terminal connection within a command line interface afterward in this tutorial. For at present, just know how to distinguish betwixt the two.

Basic Terminology

Here are some terms you should be familiar with when working within a series last window. Many of these terms are covered in a lot more detail in our Serial Communication tutorial. It highly recommended that you read that page likewise to get the full film.

ASCII - Short for the American Standard Code for Information Interchange'due south character encoding scheme, ASCII encodes special characters from our keyboards and converts them to 7-bit binary integers that can be recognized by a number of programs and devices. ASCII charts are very helpful when working with serial terminals.

Baud Rate - In short, baud charge per unit is how fast your information is being transmitted and received. 9600 is the standard rate, but other speeds are typical amongst sure devices. Just recollect that all the links in your concatenation of communication take to be "speaking" at the aforementioned speed, otherwise data will be misinterpreted on one end or the other.

Transmit (TX) - Also known every bit Data Out or TXO. The TX line on whatsoever device is there to transmit data. This should be hooked up to the RX line of the device with which you would like to communicate.

Receive (RX) - Also known as Information In or RXI. The RX line on any device is there to receive data. This should exist hooked up to the TX line of the device with which y'all would like to communicate.

COM Port (Series Port) - Each device yous connect to your computer will be assigned a specific port number. This helps to place each device connected. Once a device has a port assigned to information technology, that port will be used every time that device is plugged into the reckoner.

Your device will show up on your computer every bit either COM# (if y'all're on a Windows automobile) or /dev/tty.usbserial-######## (if you're on a Mac/Linux figurer), where the #'due south are unique numbers or alphabetic characters.

TTY - TTY stands for teletypewriter or teletype. Much like final is synonymous with the terminals of old, so too is teletype. These were the electromechanical typewriters used to enter information to the last and, thus, to the mainframe. When working with terminals on Mac and Linux, you volition often see tty used to represent a communication port rather than 'COM port'.

Data, Stop, and Parity Bits - Each packet of information sent to and from the final has a specific format. These formats can vary, and the settings of your terminal tin can be adjusted accordingly to piece of work with different packet configurations. One of the most common configurations yous'll see is 8-Northward-1, which translates to viii data bits, no parity scrap, and one cease bit.

Flow Command - Flow control is controlling the rate at which data is sent between devices to ensure that the sender is not sending data faster than the receiver can receive the data. In well-nigh applications used throughout these tutorials, you volition non demand to employ flow control. The flow control may also be present in the autograph notation: viii-N-one-None, which stands for no flow control.

Wagon Return & Line Feed - Wagon return and line feed are the ASCII characters sent when yous press the enter key on your keyboard. These terms have roots from the days of typewriters. Carriage return meant the railroad vehicle holding the paper would return to the starting point of that particular line. Line feed (aka new line) meant the railroad vehicle should motility to the side by side line to preclude typing over the previous line.

When typing on a modern keyboard, these terms still utilise. Every time you printing enter (or return) you are telling your cursor to move downward to the next line and move to the beginning of that new line.

Consulting our handy-keen ASCII table, we can see that the grapheme for line feed is 10 (0x0A in hex) and carriage return is xiii (0x0D in hex). The importance of these two characters cannot be stressed enough. When working in a terminal window you'll often need to exist aware of which of these two characters, if not both, are beingness used to emulate the enter primal. Some devices just need ane character or the other to know that a command has been sent. More importantly, when working with microcontrollers, exist aware of how you are sending information. If a string of 5 characters needs to be sent to the micro, you may demand a string that can actually concur 7 characters on account of the ten and 13 sent afterward every command.

Local Repeat - Local echo is a setting that can be changed in either the serial terminal or the device to which you are talking, and sometimes both. This setting simply tells the terminal to print everything you type. The do good from this is existence able to see if you are in fact typing the correct commands should you encounter errors. Be aware, though, that sometimes local echo can come dorsum to bite you. Some devices will translate local echo equally double type. For example, if you type hello with local echo on, the receiving device might meet hheelllloo, which is likely not the correct control. Nigh devices can handle commands with or without local echo. Just be aware that this can exist an issue.

Serial Port Profile (SPP) - The Series Port Contour is a Bluetooth contour that allows for serial communication between a Bluetooth device and a host/slave device. With this profile enabled, you can connect to a Bluetooth module through a serial terminal. This can be used for configuration purposes or for communication purposes. While non exactly pertinent to this tutorial, information technology'south all the same skilful to know nearly this profile if you want to use Bluetooth in a project.

Connecting to Your Device

At present that you know what a final is and the lingo that comes with the territory, it'southward fourth dimension to claw upwardly a device and communicate with it. This page will show you how to connect a device, how to discover which port it has been assigned, and how to communicate over that port.

What You'll Demand

For this example you'll need

  • An FTDI Basic - 5V or 3.3V will work fine. You tin as well apply an FTDI Cable if that's all you have.
  • A USB Mini-B Cable - (Not necessary if yous have an FTDI Cablevision.)
  • A jumper wire - Virtually FTDI products have female person headers, and then a male person-to-male jumper cablevision should suffice. Or, y'all could just apply a piece of wire that is stripped on both ends.

Discovering Your Device

Once you have all your supplies ready, attach the FTDI Bones to the USB cable, and attach the cablevision to your estimator. If this is the first fourth dimension y'all've plugged in a device of this nature into your computer, you lot may need to install the drivers. If this is the example, visit our FTDI Driver Installation Guide. If the drivers are all upwardly to engagement, carry on.

Depending on which operating system yous're using, in that location are a few unlike ways to discover which port your device has been assigned.

Device Manger (Windows)

No thing which version of Windows yous have, you have a programme chosen Device Manager. To open up device manger, open the start menu, and type

            devmgmt.msc                      

into the search bar. Press enter, and it'll open correct upwards. Or, you can correct-click on MyComputer, select Properties, and open the Device Manger from there (Windows 7). If you intend on using your figurer to communicate with several serial devices, information technology may exist worth creating a desktop shortcut to Device Manger.

Once you lot've got Device Manger open, expand the Ports tab. Here is where the data nosotros need lives.

alt text

In this image, nosotros take just a few COM Ports showing up. The offset thing to know is that COM1 is E'er reserved for the true Series Port, not USB. You know those grey, bulky cables, which have a DB9 connexion on each end. Yep, that serial port. Many computers (especially laptops) no longer take series ports, and they are condign obsolete in commutation for more USB ports. Nevertheless, the Bone nevertheless reserves COM1 for that port for people who all the same have an true series port on their estimator.

Another port that is likely to show up on most computers is LPT1. This is reserved for the parallel port. Parallel ports and cables are condign fifty-fifty more obsolete than serial cables, merely, once more, many computers still have these ports (they're often used to connect to printers) and have to accommodate for that in the Bone.

With those out of the manner, we can focus on the ports that we do need to employ. Now with your FTDI plugged in, you should see a new COM port get added to the list.

alt text

Typically, your computer will enumerate your devices. For case, if this is the commencement serial communication device yous've plugged into your estimator, information technology should enumerate as COM2. On my computer this is the not the first device I've plugged in, only rather the eighth, so it has enumerated as COM9 (don't forget about COM1).

What's of import to know is that once a device has been associated with your computer and has had a port assigned to it, the calculator will think that device every time information technology's attached. So, if yous have an Arduino board that has been assigned COM4 for example, information technology is non necessary to open up Device Manger and check which COM port it is on every time, considering that device will now always be on COM4. This tin be skilful and bad. Most people will never plug more than than a couple dozen series devices into their computers. Still, some people will plug in lots of devices, and your figurer can but assign so many ports (256 if I remember correctly). Thus, information technology may be necessary to delete some COM ports. Nosotros will talk over that in the tips and tricks section.

If you practise have multiple devices and are not certain which device is the one you lot just plugged in, unplug it, watch for whichever COM port disappears, and then plug it dorsum in. The COM port should reappear letting y'all know that's the device you're looking for.

1 final affair to mention is that all series devices, even if they crave dissimilar drivers, will show up equally COM ports in Windows. For example, an Arduino Uno and the FTDI Basic both accept unlike drivers and are technically two dissimilar types of devices. Windows doesn't discriminate. It will treat both devices the same, and all you take to worry about is with which COM port information technology'southward associated. Mac OS and Linux treat this slightly differently. Read on to find out.

Command Line (Mac, Linux)

Like to Windows, Mac OS and Linux assign a specific port to every device attached to the figurer. Yet, unlike Windows, there is no specific program yous can open to view all the devices currently fastened. Have no fear. There is still a simple solution to find you lot device.

The default command line interface for Mac Os X is Terminal. To open it, go to your Utilities folder. There yous should see the icon for Last. I'yard going to assume that if you lot're using Linux, you already know how to open a command line window.

alt text

In one case open, you should see the typical terminal screen.

alt text

To run into a list of all the bachelor Serial ports on both Mac and Linux, blazon this control:

            ls /dev/tty.*                      

You should now run into a listing of all serial ports on your reckoner.

alt text

Yous'll detect a few Bluetooth ports on there. I take several Bluetooth devices paired with my computer, then yous may have more or less devices that show up depending on what devices take been paired with your computer. (Notice the SPP portion of these names. That indicates that Bluetooth device can talk to the serial concluding also.)

The important devices to annotation are the tty.usbserial and the tty.usbmodem. For this example I have both an FTDI Basic and an Arduino Uno plugged into my computer. This is just to show you lot the central difference between the two. Every bit mentioned earlier, some devices are treated differently depending on how they communicate with the figurer. The FT232 IC on the FDTI basic is a true serial device, and, thus, it shows upwardly as usbserial. The Uno on the other hand, is an HID device and shows upward as a usbmodem device. The HID (Man Interface Device) profile is used for keyboards, mice, joysticks, etc., and, every bit an HID device, the computer treats it slightly different despite the fact that is tin can still send serial data. In either case, these tty.usb______ ports are what we're after when connecting to a series terminal.

Echo Test

With that out of the way, it's time to really communicate with the FTDI. The specifics of each terminal plan volition exist discussed in the post-obit sections. This example will be shown in CoolTerm, but be aware that this can exist done with any terminal.

Open up a terminal with the correct settings: 9600, 8-Due north-1-None.

alt text

Brand sure local echo is turned off for this test.

alt text

Take your jumper wire and connect it to the TX and RX lines of the FTDI Basic.

alt text

Now blazon!

alt text

Everything you type should be displayed in the last window. Information technology's aught fancy, but you are now communicating with the terminal. Data is beingness sent from your keyboard, to the figurer, through the USB cable to the FTDI, out the FTDI's TX pivot, into the RX pin, dorsum through the USB cable, into the calculator, and is finally displayed in the terminal window. Don't believe me? Unplug the jumper and type some more than. Pending you did plough local repeat off, you should not meet anything being typed. This is the repeat exam.

Actress Credit

If y'all have two FTDI boards or other similar series devices, try hooking up both of them. Connect the TX line of one to the RX line of the other and vise versa. Then, open two serial terminal windows (aye, you tin can have multiple last windows open at once), each continued to a unlike device. Brand certain they are both set to the same baud rate and settings. And then connect, and offset typing. What you blazon in one terminal should show upwards in the reverse last and vise versa. You've just created a very simplistic conversation client!


Now let's explore the different last programs.

Arduino Serial Monitor (Windows, Mac, Linux)

The Arduino Integrated Development Environment (IDE) is the software side of the Arduino platform. And, because using a concluding is such a big function of working with Arduinos and other microcontrollers, they decided to included a series terminal with the software. Within the Arduino surround, this is called the Serial Monitor.

Making a Connexion

Serial monitor comes with any and all version of the Arduino IDE. To open it, just click the Serial Monitor icon.

alt text

The icon is located to the right of the other icons in Arduino 0023 and below.

alt text

The icon is located to the far right in Arduino 1.0 and beyond.

Selecting which port to open in the Serial Monitor is the aforementioned every bit selecting a port for uploading Arduino lawmaking. Go to Tools -> Series Port, and select the right port.

alt text

Once open, you should run into something like this:

alt text

Settings

The Serial Monitor has limited settings, only enough to handle most of your serial communication needs. The start setting you can alter is the baud rate. Click on the baud charge per unit driblet-down menu to select the the right baud rate.

alt text

You can also change the enter key emulation to carriage return, line feed, both, or neither.

alt text

Concluding, you tin can the the terminal to autoscroll or not by checking the box in the bottom left corner.

Pros

  • The Serial Monitor is a great quick and piece of cake fashion to institute a serial connection with your Arduino. If you're already working in the Arduino IDE, there's really no need to open up a separate concluding to display information.

Cons

  • The lack of settings leaves much to be desired in the Series Monitor, and, for advanced serial communications, it may non do the trick.

Hyperterminal (Windows)

HyperTerminal is the defacto terminal program for whatever Windows OS upwards to XP -- Windows Vista, vii, and 8 don't include it. If you're on Windows Vista, 7, or eight, and really just have to have HyperTerminal, a trivial scouring of the Internet should turn upward some workarounds. Improve alternatives are more easily bachelor however- we'll become to those shortly.

If you're on a pre-Vista machine, and only have HyperTerminal to work with, hither are some tips and tricks for using it:

Initiating a Connection

When initially opening up HyperTerminal, it will present yous with a "Connexion Description" dialog. Enter whatsoever name you please, and, if y'all really desire to become fancy, select your favorite icon. Then hit "OK". (If this window didn't pop up go to File > New Connexion to open up it.)

alt text

None of the settings in this first window accept whatever effect on the serial communication.

On the next window, ignore the showtime three text boxes -- we're not working with a dial-up modem hither. Do select your COM port next to the "Connect using" box. And then striking "OK".

alt text

The settings on the adjacent box should expect pretty familiar. Make sure the "Bits per 2d" dropdown is set to the right baud rate. And verify that all of the other settings are correct. Hit "OK" one time everything looks right there.

alt text

It doesn't look similar much, only you at present have an open terminal! Blazon in the blank white area to send data, and anything that is received by the terminal will prove up in that location likewise.

alt text

Adjusting Settings

There are some limited adjustments we can make to the HyperTerminal UI. To discover them, go to File > Properties. Nether the "Settings" tab you'll see most of the options.

If yous want to see what you're typing in the terminal, you can plough on local echo. To flip this switch, striking the "ASCII Setup" button, then check "Echo typed characters locally".

alt text

The other settings are very specific to formatting how characters are sent or received. For most cases they should be allow exist.


Those who take used HyperTerminal have either come up to have it for what information technology is, or sought out another -- whatsoever other(!) -- terminal plan. It's not great for serial communication, only it does piece of work. Permit's explore some of the improve alternatives!

Tera Term (Windows)

Tera Term is ane of the more than popular Windows terminal programs. Information technology'south been around for years, information technology's open source, and it's elementary to use. For Windows users, it's one of the best options out in that location.

You tin download a copy from here. One time you accept Tera Term installed, open upwards it upward, and permit'due south poke around.

Making a Connection

You should initially be presented with a "TeraTerm: New connectedness" popular-up within the program. Here, you tin can select which serial port y'all'd like to open up. Select the "Serial" radio button. Then select your port from the driblet-down menu. (If this window doesn't open up when you first TeraTerm, you can get here by going to ****File > New connection..."**.)

alt text

That'll open up up the port. TeraTerm defaults to setting the baud rate at 9600 bps (8-N-1). If you lot need to accommodate the serial settings, go upwardly to Setup > Serial Port. You'll meet a window pop up with a lot of familiar looking series port settings. Suit what y'all need to and hit "OK".

alt text

The championship of your TeraTerm window should alter to something like "COM##:9600baud" -- good sign.

alt text

That'due south most all there is to information technology. The blank window with the blinking cursor is where data is both sent (past typing it in) and received.

TeraTerm Tips and Tricks

Local Echo

It tin can be weird to type stuff in the window and not run into information technology show up in the terminal. It's undoubtedly still flowing through the serial terminal to your device, but it can be difficult to type when y'all don't take any visual feedback for exactly what you're typing. You lot tin can turn on local echo by going to the Setup carte du jour and selecting Terminal.

alt text

Check the Local echo box if you'd like to turn the feature on.

In that location are other settings to exist fabricated in this window likewise. Yous can arrange the size of the terminal (the values are in terms of characters per row/cavalcade), or arrange how new-lines are displayed (either a railroad vehicle return, line feed, or both).

Clear Buffer and Articulate Screen

If you lot want to clear your terminal screen you tin use either the "Clear buffer" or "Clear screen" commands. Both are located under the Edit menu.

Clear screen will do just that, blank out the terminal screen, merely any data received volition still be preserved in the buffer. Scroll up in the window to have another look at it. Clear buffer deletes the unabridged buffer of received data -- no more than information to ringlet upward to.

Shortcut Keys

Menus are a hurting! If you desire to get actually fast with TeraTerm, remember some of these shortcuts:

  • ALT+North: Connects to a new serial port.
  • ALT+I: Disconnects from the current port.
  • ALT+V: Pastes text from clipboard to the serial port (not CTRL+5).
  • ALT+C: Copy selected text into clipboard (non CTRL+C).
  • CTRL+TAB: Switch betwixt ii TeraTerm windows.

Real-Term (Windows)

TeraTerm is crawly for simple ASCII-only serial terminal stuff, but what if yous need to ship a cord of binary values ranging from 0-255? For that, nosotros like to utilize RealTerm. RealTerm is designed specifically for sending binary and other hard-to-type streams of data.

RealTerm is available to download on their SourceForge folio.

Setting Up the Series Port

When you open up up RealTerm, you'll be presented with a blank window similar below. The peak half is where y'all'll type data to send, and it'll too display data received. The lesser half is split into a number of tabs where nosotros conform all of the settings.

Let's become connected! To brainstorm, navigate to the "Port" tab. On the "Port" dropdown here, select the number of your COM port. Then, make certain the baud rate and other settings are correct. Yous tin select the baud rate from the dropdown, or type information technology in manually.

alt text

With all of those settings adjusted, you'll have to click "Open" twice to shut and re-open up the port (clicking "Change" doesn't work until after y'all've established a connection on a COM port).

That's all at that place is to that! Blazon stuff in the black ether to a higher place to send data, and anything received by the terminal will pop up there besides.

Sending Sequences of Values

The power to send long sequences of binary, hexadecimal, or decimal values is what really sets RealTerm apart from the other terminal programs nosotros've discussed.

To access this function, caput over to the "Send" tab. Then click into either of the two text boxes side by side to "Ship Numbers". This is where you enter your number sequence, each value separated by a space. The numbers can be a decimal value from 0 to 255, or a hexadecimal value, which are prefixed with either a "0x" or a '$'. Once yous take your string typed out, striking "Transport Numbers" and away they go!

alt text

Why would y'all demand this y'all ask? Well, let's say you had a Serial 7 Segment Brandish hooked upwards to an FTDI Basic, which is connected to your computer. This is a pretty cool setup -- you can control a 7-segment brandish by merely typing in your terminal. Only what if you wanted to dim the display? You'd need to send two sequential bytes of value 123 and 0. How would you do that with the handful of keys on a keyboard? Consulting an ASCII table to match binary values to characters, you'd take to press DEL for 127 and CTRL+SHIFT+2 (^@) for 0...or just use the "Send" tab in RealTerm!

Adjusting the Display

Just as y'all can utilise RealTerm to send literal binary values, you tin also utilise information technology to display them. On the "Display" tab, under the "Display As" section are a broad array of terminal brandish choices. You can have data coming in displayed equally standard ASCII characters, or you tin have them prove up as hex values, or any number of other display types.

alt text

Incoming bytes are displayed as hexadecimal values. Can you decode the secret message?!


RealTerm is preferred for more avant-garde final usage. We'll use it when we need to send specific bytes, but for more bones terminal applications, TeraTerm is our get-to emulator.

YAT - Still Another Final (Windows)

YAT is a user-friendly and feature-rich serial final. It features text likewise equally binary advice, predefined commands, a multiple-document user interface and lots of extras.

YAT is bachelor to download at SourceForge.

YAT

Advent

YAT features a multiple-document user interface (MDI) that consists of a single workspace with one or more than terminals.

workspace

Workspace

Each terminal can exist configured according to the device it shall exist communicating with. These extra features make a terminal especially like shooting fish in a barrel to utilise:

  • Text command console
  • File command list
  • Unlimited number of predefined commands
  • Driblet-down of recent commands

Each terminal has its own monitor to brandish outgoing and incoming data. The view tin be configured as desired:

  • Time stamp
  • Line number
  • End-of-line sequence
  • Line length
  • Line and bytes manual rate
  • Chronometer

Most of these features can exist enabled and configured, or hidden for a cleaner and simpler user interface.

Detailed Monitor

Detailed Monitor

Monitor Status

Monitor Condition

Terminal Settings

  • Text or binary communication
  • Communication port type:
    • Serial Port (COM)
    • TCP/IP Client, Server or AutoSocket
    • UDP/IP Socket
    • USB serial HID
  • Specifc settings depending on port type

Serial COM Port Settings

Series COM Port Settings

TCP and UDP Settings

TCP and UDP Settings

USB Serial HID Settings

USB Serial HID Settings

Text Last Settings

  • Total support of any known ASCII and Unicode encoding
  • End-of-line configuration
    • Predefined and costless-text sequences
    • Possibility to define separate EOL for Tx and Rx
  • Transport and receive timing options
  • Character substituion
  • Comment exclusion

Text Terminal Settings

Text Terminal Settings

Binary Terminal Settings

  • Configuration of protocol and line representation
  • Possibility to define carve up settings for Tx and Rx

Binary Terminal Settings

Binary Final Settings

Advanced Settings

  • Various display options
  • Various advanced communication options
  • Specialized communication options for serial ports (COM)

Advanced Settings

Advanced Settings

Extras

  • Escapes for bin/oct/dec/hex like \h(4F 4B)
  • Escapes for ASCII controls like <CR><LF> likewise as C-fashion \r\n
  • Special commands such equally \!(Delay), \!(LineDelay) and \!(LineRepeat)
  • Versatile monitoring and logging of sent and received data
  • Formatting options for excellent readability
  • Powerful keyboard operation including shortcuts for the most important features
  • Versatile beat out/PowerShell command line
  • x86 (32-bit) and x64 (64-bit) distribution

Predefined Commands

Predefined Commands

Log Settings

Log Settings

Monitor Format

Monitor Format

Alter Direction and Support

YAT is fully hosted on SourceForge. Feature Requests and Issues Reports tin can exist entered into the according tracker. Both trackers tin can be filtered and sorted, either using the predefined searches or the list view. Back up is provided by a few uncomplicated helps integrated into the application, some screenshots on the SourceForge page, and the projection'due south email if none of the above can help.

Development

YAT is implemented in C#.NET using Windows.Forms. The source code is implemented in a very modular way. Utilities and I/O sub-systems can also be used contained on YAT, e.g. for whatsoever other .NET based awarding that needs series advice, command line handling or merely a couple of convenient utilities. Testing is done using an NUnit based exam suite. Projection documentation is done in OpenOffice. For more than details and contributions to YAT, refer to Help > Well-nigh.

CoolTerm (Windows, Mac, Linux)

CoolTerm is useful no matter which operating system you're using. Withal, information technology is especially useful in Mac OS where in that location aren't equally many terminal options as there are in Windows.

Y'all can download the latest version of CoolTerm here.

Making a Connectedness

Download and open a CoolTerm window.

To change the settings, click the Options icon with the petty gear and wrench. You'll exist presented with this menu:

alt text

Here, you can select your port, baud rate, bit options, and flow command.

Now click on the Last tab on the left.

alt text

Hither, you lot can alter the enter key emulation (railroad vehicle return/line feed), turn local repeat off or on, and you can switch between line mode and raw mode. Line mode doesn't send data until enter has been pressed. Raw manner sends characters straight to the screen.

Once all your setting are correct, the Connect and Disconnect buttons volition open up and close the connection. The settings and status of your connection will be displayed in the bottom left corner.

If you need to clear the data in the terminal screen, click the Clear Data icon with the large ruddy 10 on it.

If you're getting annoyed with non being able to employ the backspace, turn on 'Handle Backspace Graphic symbol' nether the Last tab nether Options.

alt text

Extended Features

I awesome characteristic of CoolTerm is Hex View. If yous want to come across the actual hex values of the data you lot are sending rather than the ASCII values, Hex View is a tremendous help. Click the View Hex icon. The terminal's appearance volition modify slightly. Now whatsoever yous type will show upwardly as hex and ASCII. The outset column is just keeping rail of line numbers. The 2nd cavalcade is the hex values, and the last column is the actual ASCII characters yous type.

alt text

Here I've typed hello and \. Notice the 0D and 0A that appear for carriage return and line feed.

To go back to ACSII manner, click the View ASCII icon.

Yous can also use the Send String option to send entire strings of text. In the connection menu, select Send String.

alt text

You lot should now accept a dialog box with which to send your string in hex or ASCII mode.

alt text

ZTerm (Mac)

You tin download the latest version of ZTerm hither

ZTerm is another concluding option for Mac users. Compared to CoolTerm, it seems a lot less user friendly, withal, one time you find your style effectually, it'due south but as useful.

Making a Connection

When you first open ZTerm, you be greeted with this prompt:

alt text

Cull the correct port, and click OK.

alt text

You should now have a blank terminal window.

*Note: In one case you lot've made a connection, ZTerm will open up the nearly recent connexion every fourth dimension you run information technology. This can exist annoying if you have multiple connections bachelor. To get effectually this auto connect, hold down the SHIFT key as you start ZTerm. This will bypass the auto connect and ask you to which port yous'd like to connect.

Once you're connected, you tin modify the terminal settings by going to Settings -> Connectedness.

alt text

Here y'all can change the baud rate (data rate); parity, data, and finish bits; flow control; and plow local echo on or off.

alt text

If you need to change your port after establishing a connexion, go to Settings -> Modem Preferences.

alt text

Cull the correct port under the Serial Port dropdown menu.

alt text

Other Features

ZTerm has lots of other uses for network communication, but that is beyond the scope of this tutorial.

Ane nice feature that can be used is the macros. Get to Macros -> Edit Macros.

alt text

Here you can create macros that send any strings/commands you'd like. Accept a command that you're typing constantly? Brand a macro for it!

alt text

Control Line (Windows, Mac, Linux)

As mentioned earlier, you lot can use command line interfaces to create serial connections. The major limiting gene is the lack of connection options. Most of the programs we've discussed so far have a slew of options that you can tweak for your specific connection, whereas the command line method is more of a quick and dirty mode of connecting to your device in a pinch. Hither'due south how to achieve this on the three major operating systems.

Final and Screen (Mac, Linux)

Mac

Open Terminal. Encounter the Connecting to Your Device section for directions.

Now type ls /dev/tty.* to run into all bachelor ports.

Y'all can at present utilise the screen command to to institute a simple series connection.

Type screen <port_name> <baud_rate> to create a connection.

alt text

The last will go blank with only a cursor. You are now connected to that port!

To disconnect, type command-a followed by control-\. The screen volition then ask if yous are certain you desire to disconnect.

There are other options y'all tin can command from screen, withal it is recommended that you only utilize this method if yous are comfortable with the control line. Blazon human screen for a full listing of options and commands.

Linux

The screen command can also be used in Linux. There are only a few variations from the Mac instructions.

If yous do not accept screen installed, go it with sudo apt-get install screen.

Making a connection is the aforementioned as Mac.

To disconnect, blazon control-a then shift-grand.

That's all in that location is to information technology.

MS-DOS Prompt (Windows)

The fastest way to get to the control line in Windows is to click on the start menu, type cmd into the search field, and printing Enter.

alt text

This will open up a blank MS-DOS command line prompt.

alt text

To be able to issue Serial commands, you lot must offset enter PowerShell. Type powershell to get into PowerShell control mode.

alt text

To see a list of all the available COM ports, type

            [Arrangement.IO.Ports.SerialPort]::getportnames()                      

Yous should now encounter something like this..

alt text

Now create an instance of the port you want with this command

            $port= new-Object Arrangement.IO.Ports.SerialPort COM#,Baudrate,None,8,1                      

With that, you can now connect to and send data to or from that COM port.

            $port.open() $port.WriteLine("some string") $port.ReadLine() $port.Close()                      

Once again, this method of serial communication is only recommended for avant-garde command line users.

Tips and Tricks

Changing/Deleting COM Ports (Windows)

There may come a time when you need a device to exist on a specific COM port. An case of this is, in older versions of TeraTerm, you could only connect to COM ports sixteen and below. Thus, if your device was on COM 17, you'd have to alter it to connect to it. This problem has been addressed in newer versions of TeraTerm, simply there are many other programs out there that only allow a sure number of COM ports.

To become around this, we'll have to dive into Device Manger.

Open up Device Manger, and expand the ports tab.

alt text

Now right-click on the port you want to modify. Select Backdrop.

alt text

In Properties, go to Port Settings, and select Advanced.

alt text

Here, you'll see a drop down menu with all the available COM ports in information technology. Some of them will have (in use) adjacent to them. These are the ports that have been assigned to a serial device.

alt text

Find that COM 9 doesn't have an (in utilize) adjacent to it because that is the port we are currently working with.

If we wanted to change COM nine to COM 3, nosotros simply select COM 3 in this bill of fare, and click OK. The (in use) side by side to COM three should go abroad. Whatever was continued to COM nine is now associated with COM 3, and whatever was associated with COM 3 has now been overwritten.

If you demand to clear out some old COM ports, you can follow the steps above but for numerous COM ports.

WARNING: Practise not select COM i when cleaning upward onetime ports. This trick is only for if you really need it and shouldn't be performed very often, for sanity'south sake.

TTY vs CU (Mac, Linux)

In Unix and Linux environments, each serial communication port has two parts to it, a tty.* and a cu.*. When you lot look at your ports in say the Arduino IDE, yous'll see both for one port.

alt text

The difference between the 2 is that a TTY device is used to call into a device/system, and the CU device (call-upwardly) is used to phone call out of a device/organization. Thus, this allows for 2-fashion advice at the same time (total-duplex). This is more important to know if you are doing network communications through a terminal or other program, but it is yet a question that comes up frequently. Simply know that, for the purposes of this tutorial, always utilise the tty pick for serial communication.

Cannot Connect to That Port!

You can just accept one connexion to a detail port open at any given fourth dimension (just yous can have multiple concluding windows connected to different ports open at the aforementioned time). Thus, if you have an Arduino Serial Monitor window open and try to connect to that aforementioned port on a dissimilar terminal plan, it volition yell at you and say it could non establish a connexion with that port or some such jazz. If you are ever having trouble connecting to a port, make sure it's not open up somewhere else.

If you don't have another connection open up and nevertheless can't connect, make sure all your settings (baud rate, etc.) are correct.

Continued, But Tin can't Meet Any Data

If you are connected to the right port simply don't see any data, there are ii possible culprits. First check your baud rate. I know I sound like a cleaved tape, just baud charge per unit is the near of import setting to friction match up. Check that baud!

The other culprit could be that the TX and RX lines are reversed. Make sure you accept TX->RX and RX->TX.

Programming Arduino and Serial Advice

The Arduino has one defended UART, which is just the fancy name for the serial TX and RX lines. It is over these two lines that the Arduino gets programmed. Thus, when working with the Arduino (or other microcontrollers) it's best to avoid using these lines to communicate with other serial devices, especially if you are developing your code and need to upload frequently.

What happens is, if you accept another device hooked up to the UART, the data from your computer might not get interpreted correctly by the Arduino leading to code not working the way it'southward supposed to or not getting uploaded at all.

The same rule applies to serial terminals. If you lot have a terminal open up on the aforementioned port that yous are trying to program, it won't work. Arduino will throw some errors about non existence able to communicate with that port. If this happens, close your connection, and endeavor once more.

One uncomplicated manner effectually this is to use the Software Series Library built into Arduino to create a divide UART for outside serial communication. That way, your Arduino tin can communicate on one port while still leaving the default UART open for programming.

Resources and Going Farther

That was a lot of data! At the very least, y'all should walk away from this knowing what a terminal window is, how to utilize it, which terminal plan is best suited for you and your operating arrangement, and how to navigate that programme'southward interface. Once more, last programs are a very powerful tool when working with serial devices and microcontrollers. At present get collect some data!

If you'd like to know more about different types of communication, visit these tutorials:

  • Serial Peripheral Interface
  • ItwoC

To see some products that require the use of a serial terminal, check out these claw-up guides:

  • OpenLog Hookup Guide
  • Bluetooth Mate and BlueSMiRF Hookup
  • RN-52 Audio Bluetooth Hookup

Or check out this blog related post:

Your favorite terminal didn't brand the list? Tell united states which terminal emulator is your favorite and why in the discussion section.

neffitoponed.blogspot.com

Source: https://learn.sparkfun.com/tutorials/terminal-basics/all

0 Response to "How to Use Serial Port to Read Chip"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel