Getting Started with "Monitor" Command-Line Interface
Interacting with the LPC2148 Reference Board via the "Monitor" command-line interface
The LPC2148 Code Base includes a basic command-line interface called "Monitor" that works over a standard serial connection (either UART0 or USB Serial, depending on the settings in ProjectConfig.h). It operates on the same principle as the Windows command-line: you enter a command via any terminal software (we recommend the freely available RealTerm), the LPC2148 receives and interprets the commands, and then replies with an appropriate message.
The advantage of using standard UART/serial communication is that it is very easy to write software on the PC-side to communicate with your hardware (in C#.Net, for example, you can open a serial port and start sending commands with less than 10 lines of code), as well as to make different embedded devices talk to each other. It also allows easy human-interaction with the device if you are debugging or developing your firmware. This tutorial should give you all of the information that you need to get connected, and start communicating with the LPC2148.
Connecting the LPC2148 Reference Board to your PC
Depending on the configuration settings in ProjectConfig.h when to code was compiled, Monitor will communicate using either UART0 or the USB port on the board. Since any boards shipped from us are pre-configured to use USB, we'll assume USB is being used in this tutorial.
As soon as you plug the USB cable into the board, it should be recognized by the PC as a USB device and the computer will try to create a new serial ("COM") port on your computer. If you are using a Windows PC, you will likely see a message similar to the image below (from Windows 7 in this case): and you will need to point the device to an appropriate installation configuration file:
You will need to point the device to an appropriate installation configuration file. A config file for Windows can be found in the "Windows" folder of the full source code of the LPC2148 Code Base. You can tell Windows to use this config file by opening the Device Manager. Right click on "My Computer", select "Properties" in the menu, then select "Device Manager" and scroll down to "Ports (COM & LPT)". You should see a screen similar to the following with the new USB device displayed:
Right-click on "USBSerial" and select "Update Driver Software..." from the popup menu, select ""Browse my computer for driver software" from the menu, and then point to the "Windows" folder in the LPC2148 Code Base (which contains the installation config file):
Once you have installed the driver, it should appear in the Device Manager as "LPC2148 Reference Board". In order to make sure that the COM port has the right settings (it should, but it doesn't hurt to check), right-click on the device and select "Properties". Go to the "Port Settings" tab and make sure that "Bits per second" is set to 9600, since this is the default speed used by the LPC2148 Code Base. Be sure to note the name of the COM port as well (ex. COM5 or COM9) since you'll be using it shortly:
Connecting to Monitor via RealTerm
Now that you've added and configured the COM port, you can connect to Monitor by opening up any terminal software (we'll be using RealTerm in this tutorial). Open RealTerm, switch to the "Port" tab and set the Baud rate to 9600 and the Port to whatever COM port you saw in the Device Manager above:
Then you simply need to press the Change button and you should be connected to the LPC2148 Monitor. Click inside the black text input area and press the enter key and you should see the following command prompt:
Try entering the "version" and "help" commands, and you should see the following response in your terminal software:
Any exposed functionality in the monitor can be discovered with two basic commands: "help" and "?", as you can see in the description below:
Basic Monitor Commands
|version ||The "version" command will display the version number and some basic project information. These strings are all defined in the ProjectConfig.h file if you wish to change them to display something else. |
|help ||You can see all available commands by entering "help" at the command prompt. This same logic also applies to any second-level commands. For example, you can enter "led help" for a list of all commands available under "led" ("led start", for example, will start the blinking led, and "led stop" will turn it off). |
|? || |
A "?" can be used to display the syntax for a particular command. For example, if you wish to change the rate that the LED blinks, you can use the led "delay" command. To find out the syntax for this command, simply enter "led delay ?", which should display: "delay <5..500>", meaning that the command expects a numeric value between 5 and 500. To set the delay to 25 ticks (roughly 250mS), you would enter "led delay 25". This should cause the led to flicker at a faster rate (the default value is 100 ticks or 1s).