PJRC.COM Offline Archive, February 07, 2004 Visit this page on the live site |
| ||
Shopping Cart Checkout Shipping Cost Download Website |
Home | MP3 Player | 8051 Tools | All Projects | PJRC Store | Site Map |
You are here: 8051 Tools Development Board Getting Started | Search PJRC |
|
Figure 1: Apply DC Voltage and Attach Serial Cable To Upper Port |
It is best to leave the board's power turned off until the terminal emulation program is running and properly configured. If some other software attempts to communicate with a device on your serial port, the board will hear whatever is sent, and may "learn" the baud rate used by the other program. This can happen, for example, when Windows is booted and the plug-n-play configuration attempt to find any modems connected. If the board has detected an incorrect baud rate from a previous communication, just turn off the power for a minute or two.
The example here will focus on Windows Hyperterminal. The dialogs shown are from a fresh Windows 95 installation. Your system may display slightly different dialogs, particularly if you have a modem already installed.
Hyperterminal is usually located in the "Accessories" group, which is available from "Programs" in the "Start" menu. It is usually just a folder, which should appear similar to figure 2.
Figure 2: Hyperterminal, Included In Default Windows Installation |
The "Hypertrm" icon represents the Hyperterminal program. When Hyperterminal is first run, it will display a dialog suggesting that you need to install a modem, as shown in figure 3. You do not actually need to install a modem, so select No from this dialog, if it appears.
Figure 3: Hyperterminal, No, You Do Not Actually Need To Install A Modem |
Next, Hyperterminal will ask you to provide a name for the new connection, as in figure 4. It does not matter what you name the connection. Hyperterminal may not allow certain names, such as "COM1:".
Figure 4: Hyperterminal, Name The Connection (Whatever You Like) |
After you've provided a name, you will need to select the port where the 8051 development board is connected. Most newer (ATX) PC computers have two 9-pin serial ports, where the one closer to the top of the computer is COM1 (/dev/ttyS0 in linux), and the lower is COM2 (/dev/ttyS1 in linux). Select the one where you connected the 8051 development board.
Figure 5: Hyperterminal, Choose The COM Port Where The Board Is Connected |
The last, and most important step is to configure the communication settings. You must select "None" for Flow Control. The default setting is "Hardware", and this is likely to cause problems. The 8051 development board can work at all standard baud rates, except 300 baud. Most people choose 115200 baud.
Some older PC computers, particularly those with 16450 (no fifo) UARTs are unable to communicate well at 115200 baud. Nearly all Pentium-class PCs can use 115200, but some older 486 computers can not communicate this fast. With an older computer that lacks a 16550 uart, 9600 baud is probably a better choice.
If you return to this menu and change to a different baud rate, be sure to turn off the board's power. The board detects and remembers your baud rate setting, so it must be shut off (a warm boot will not do) when you change the baud rate.
Figure 6: Hyperterminal, Port Settings, 57600 Baud, No Flow Control. Turn The Board's Power Off When Changing Baud Rates |
After setting up the communication parameters, Hyperterminal will show it's main window, with nothing in it. Turn on the board's power. If the board was already on, shut it off for several seconds and turn it back on.
The 8051 development board waits for you to press Enter, when it does not "know" what baud rate you have selected. When you press Enter, the welcome message should appear, as in Figure 7.
Figure 7: Hyperterminal, Press Enter And The PAULMON2 Welcome Message Appears |
Hyperterminal's File menu has a "Save As..." option which will allow you to save the setting to a file. This file can be copied to the desktop, so that you may easily run Hyperterminal again with the settings to use your board.
:102000001200489020B0120038752A0012003212D7 :102010000040B40D028020F5F09020DFA3E493602F :10202000EBB5F0F81200307420252AF8A6F0052A46 :10203000E52AB409D78000E52A60C51200481200DD |
While the board is sitting at the PAULMON2 prompt, it is ready for you to begin a download of intel-hex data. Older versions required you to press "D" to enter the download mode. This step still works, but it is not necessary with version 2.1. To begin the download using Hyperterminal, select "Send Text File..." from the "Transfer" menu, as shown in figure 8.
Figure 8: Downloading Example Code, Use "Send Text File..." |
The usual Windows file choosing dialog will appear. You will need to change the type to "All files (*.*)", because the file is EX1_2.OBJ, and the default dialog only displays .TXT files. Of course, navigate to the directory where the EX1_2.OBJ file is stored and select it, as shown in figure 9.
Figure 9: Downloading Example Code, Choose File To Send |
Once you've opened the file, Hyperterminal will begin sending it. A carrot "^" character will appear, which is in indication from PAULMON2 that is saw the colon ":" character that begins an intel-hex download. At PAULMON2 receives each line of the file, it will print a dot to show the progress of the download. When the transfer is finished, PAULMON2 will print a summary of the download, and it will alert you to any errors in the reception of the data. After downloading EX1_2.OBJ, your Hyperterminal window should appear similar to figure 10.
Figure 10: Downloading Example Code, Check Download Summary |
The intel hex data format encodes the address where the bytes are to be stored within its data stream. Most PAULMON2 functions operate based in the "Loc:" address shown in the prompt, but the intel-hex download will always place the data at the location specified in the file. Here is a detailed description of the intel-hex data format.
In this example program, the data happens to begin at location 0x2000. Some programs have a 64 byte header which is recognized by PAULMON2 and allow them to be shown in the menus and run from the "run" command. This example, however, does not have a header.
To run the example without a header, use the "Jump" command by pressing "J". PAULMON2 will ask you for the address where it will jump to run the program. You can type 2000, as shown in figure 11, or just press enter if the default is 2000.
Figure 11: Example Code, "Jump" to "2000" to Run EX1 Test Program |
The example program will ask you to type a word, and then it will print it in large block letters. Perhaps this isn't the most exciting program you could imagine, but the point has been to learn to use Hyperterminal to download and run a program. Now you're ready to create something more interesting to download to the 8051 development board.
Windows Tip: Hyperterminal sends data slowly. If you develop a large program and download times become long, you may need to switch to a better terminal emulator program. Many Windows users have recomended the free TeraTerm, which offers fast downloads and many advanced features not found in Microsoft's Hyperterminal.
Linux Tip: Linux will allow another program to send data to
the serial port, even while it is open and in use by your terminal
emulation program (minicom, seyon, etc). This can be handy for sending intel-hex to the
8051 development board. Just type a command in a terminal, such as
"cat ex1_2.obj > /dev/ttyS0
". I set my window manager
to "focus follows cursor", so to download new code, all that's needed
is to sweep the mouse a couple inches and press up-arrow and Enter
(of course, if the command was previously typed once)... much faster
than GUI menus and dialog boxes!
.