ARM Oberon Development System for Windows
Version 4.4.0 Copyright © 2006-2013 CFB Software
Last Updated 13 Feb 2013
The source code examples are grouped in subfolders in your Windows Documents\Astrobe-v4.4.0\Examples folder:
NOTE: Additional examples can be found in the LPC2000 Source Code Examples section of the Astrobe Forum.
The general examples should work with little or no modification on any of the supported LPC2xxx targets. Header comments in each of the source code files list the target microcontrollers that the examples were designed for.
The example programs which are shown with screenshots below use the Out library module to generate the text output and send it to UART0. The UART0 socket should be connected to a dumb terminal or terminal emulator running at 38,400 Baud.
Blinks an LED once per second using Timer0.
Outputs the linker and startup parameters specified for the current application and shows the amount of RAM remaining for use by the program.
Outputs the contents of 256 words of memory starting from address 00000 0000H and then 256 words of memory starting from address 01000 0000H. Each line of output contains the address and the contents of the next 4-word block of data displayed in Hexadecimal format.
Demonstrates the trapping and display of runtime errors.
Shows how Oberon's Type Extension feature can be used to create and scan a dynamic list of a variety of objects. Lists contains the generic functions to build and traverse a list of objects. Extensions contains definitions for a number of related objects. The examples used are shapes e.g. circles, rectangles etc. The application first builds a list of different shapes and then scans the list displaying the relevant dimensions and area of each shape.
Set and Display the Real Time Clock
Prompts for the input of the current time (hours, minutes and seconds) and then displays the updated time every second.
Calculate Baud Rate Parameters
If you are using a crystal frequency of 14.7456 MHz the standard UART baud rates can be accurately generated. If you are using a crystal operating at other frequencies you can use the library function Serial.InitEx instead of Serial.Init to achieve finer control over the baudrate. The function requires that the target MCU has an extended UART feature, the fractional divider register (FDR).
This example program calculates and displays the values of the parameters to be used with Serial.InitEx for a range of crystal frequency and baud rate combinations.
The Calculate function included in the example was designed to be efficient enough to be extracted and included in your application if you want to generate the values dynamically.
In-Application (IAP) Programming
Uses the LPC2000 on-chip In-Application Programming (IAP) functions to perform the following tasks:
1. Display the part identification number
2. Display the boot code version number
3. Compare a range of identical bytes
4. Compare a range of dissimilar bytes
|ADC / LED7||
ADC / 7-Segment LED Examples
Led7ADC displays a number in the range 0 to 9 relative to the rotation of a potentiometer connected to an ADC channel. Led7Seconds increments the number displayed every second. Both examples import a utility module Led7.mod which displays a single digit on a 7-segment LED that is connected directly to GPIO pins.
Blinks an LED once a second by handling interrupts (IRQ) generated by Timer1.
Fast Interrupts Example
Blinks an LED once a second by handling fast interrupts (FIQ) generated by Timer1.
IRQ interrupted by an FIQ
Timer0 generates IRQs and Timer1 generates FIQs. The IRQ handler stays in an infinite loop which only terminates when it is interrupted by an FIQ. If you need convincing, see what happens when you comment out the statement
7-Segment LED Counter using SPI
Displays 0 - 9 seconds counter on a 7-segment LED connected via an SPI0 bus.
Reading an SD Card using SPI/MMC
Displays the letters and numbers found in the first four blocks of an SD Card that appear to contain text information. The following resulted from reading a newly-formatted 2GB SD card with a FAT file system that had the single file ReadCard.mod in its root folder.
Reading a temperature sensor via the I2C bus
Monitors the current reading of an NS LM75 or TI TMP102 temperature sensor connected as a slave device to the I2C0 bus. The device is interrogated every second and the value is written to output whenever it changes.
NOTE: Change the CONST value I2CBUS in the source code to 1 if you want to use it with a sensor on the I2C1 bus of an LPC2103 microcontroller.
Reading a digital compass via the I2C bus
Monitors the current reading of a Honeywell HMC6352 digital compass connected as a slave device to the I2C bus. The device is interrogated every second and the value is written to output whenever it changes.
NOTE: Change the CONST value I2CBUS in the source code to 1 if you want to use it with a compass on the I2C1 bus instead of the I2C0 bus.
Reading / writing an EEPROM via the I2C bus
Read a string and a counter from a 2kbit EEPROM via the I2C0 or I2C1 bus. If the string doesn't equal "Astrobe" the program has not been run before and the counter is set to zero. The counter is displayed, incremented and then written back to the EEPROM.
e.g. when the application has been run eleven times:
When the application is run the next time:
NOTE: Change the CONST value I2CBUS in the source code to 1 if you want to use it with an EEPROM on the I2C1 bus instead of the I2C0 bus.
Reading / writing a 256Kbit EEPROM via the I2C bus
The program prompts the user for an EEPROM address and one of five actions:
e.g. Set the start address to 0, store the data and then read it back and compare it with what was written:
Alphanumeric LCD Display and Real Time Clock Example
Displays the current time on a 2x16 character alphanumeric LCD display driven by a Samsung KS0070B controller using an 8-bit data interface.
Step Motor Example
Controls a small bipolar step motor connected to P0.12 and P0.21 as implemented on the Embedded Artists LPC2148 Education Board(V3). The application runs the motor at 5, 50 and 500 RPM for 5 seconds at each speed in clockwise and then anti-clockwise directions.
Blinks an LED once a second by handling interrupts (IRQ) generated by Timer1.
Fast IO Example
Led connected to pin P0.13 configured as a fast IO pin, blinking once per second controlled by Timer0
LCD Text Display Example
Redirect all text output from functions in the Out module to the Nokia 6100 / Epson display using a font store in resource data.
LPC2378 systems with a Nokia 6100 / Epson display connected to SPI0 / SSP0
Olimex LPC2378-STK Development Prototype Board
Astrobe for LPC2000 Library and Examples Source Code
Copyright (c) 2006-2013 CFB Software.
You should carefully read the following terms and conditions before using the software. By using this software you indicate that you accept this license agreement.
You are granted the right to use the source code in whole or in part, and to adapt or to modify it, for the purpose of developing application software. The contents of the source files are protected by international copyright laws. Unauthorized reproduction and distribution of all or any portion of the code contained in the source files is strictly prohibited. The source code shall at no time be copied, transferred, sold, distributed, or otherwise made available to other individuals without prior written permission.
This software is provided on an "as is" basis without warranty of any kind, expressed or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. The person using the software bears all risk as to the quality and performance of the software. The author will not be liable for any special, incidental, consequential, indirect or similar damages due to loss of data or any other reason, even if the author or an agent of the author has been advised of the possibility of such damages. In no event shall the author's liability for any damages ever exceed the price paid for the license to use the software, regardless of the form of the claim.