Astrobe for Cortex-M3 Source Code

ARM Oberon Development System for Windows

Version 6.1 Copyright © 2012-2016 CFB Software
Last Updated 16 Sep 2016

E-Mail:   info@cfbsoftware.com
Website:   www.astrobe.com

Oberon Examples

All of the included examples can be compiled and built on all editions of the current version of Astrobe for Cortex-M3. The source code examples are located in your AstrobeM3-v6.0\Examples\General folders. You will also find additional source code examples on the Astrobe Forum.

The general 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. They should work with little or no modification on any of the supported LPC1347 / LPC1759 / LPC1769 / LPC1788-family development boards.

Filename  Description
Info.mod System Info
Outputs the linker and startup parameters specified for the current application and shows the amount of RAM remaining for use by the program.


ViewMemory.mod ViewMemory
Outputs the contents of the first 256 words of memory starting from address Data Start 0000H and then the last 256 words of memory up to address Data End. Each line of output contains the address and the contents of the next 4-word block of data displayed in Hexadecimal format.


TestTraps.mod TestTraps
Demonstrates the trapping and display of runtime errors.

Extensions.mod
ExtensionsCase.mod
Lists.mod
Extensions
Extensions 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.



ExtensionsCase is an alternative implementation which uses a CASE statement instead of an IF statement for performing the type tests.
CalcBaudRate 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.

IAPDemo.mod
In-Application Programming (IAP)
Uses the LPC1xxx on-chip In-Application Programming (IAP) functions to perform the following tasks:
1. Display the part identification number and name
2. Display the boot code version number
3. Display the unique device serial number
4. Display the last sector details
5. Fill the last sector with 0AAH
6. Blank check the last sector
7. Prepare the last sector
8. Erase the last sector
9. Blank check the last sector again
10. Compare a range of identical bytes
11. Compare a range of dissimilar bytes




The following examples have been tested with specific combinations of MCU and breakout boards / baseboards etc.

Filename  Description
Blinker.mod Blinker
Blinks an LED once per second using Timer1. You may have to change the pin configuration-related statements depending on which pins your LEDs are connected to. See the Getting Started section of the Astrobe Help file for more information.
IRQBlinker.mod IRQ Blinker
Led connected blinking approx. once per second as a result of interrupt requests (IRQ) generated by Timer1
ExtraRAM.mod Extra RAM for Dynamic Variables
Illustrates the use of the additional 2kB blocks of SRAM1 and USB RAM present on LPC134x MCUs with a total of 10kB or more of SRAM, and the additional 16kB blocks of AHB SRAM present on LPC176x MCUs with a total of 32kB or more of SRAM.
SlideDemo.mod
Slide.mod
IO.mod
Graph.mod
LCDEpson.mod
ST7735.mod
AutoCAD Slide Drawing
Uses the Astrobe Graphics line-drawing functions to display AutoCAD Slide images of St Paul's Cathedral and the space shuttle on a Nokia 6100 display or an AdaFruit 1.8" TFT Display.

Target:
LPC1768/69 systems with a display connected via SPI

Tested on:
Olimex LPC1766-STK Board / Nokia 6100 Display (LCDEpson and SPI0)
ARM LPC1768 mbed / AdaFruit 1.8" TFT Display (ST7735 and SPI1)

Watch a video of the ARM7 version of this example 
DisplayDemo.mod
Display.mod
Fonts6x8.mod
Fonts6x8.res
LCDST756R.mod
Text and Graphics Display
Uses the Astrobe graphics and font functions to display text and graphics on a Newhaven 32x128 LCD display.

Target:
LPC1769 systems with a Newhaven 32x128 LCD display connected to SPI0
via a Sitronix ST756R LCD controller

Tested on: 
ARM LPC1768 mbed on an mbed Application Board
TextDisplay.mod
Display.mod
LCDEpson.mod
Fonts.mod
Text Display
Redirect all text output from functions in the Out module to the Nokia 6100 / Epson display using a font stored in resource data.

Target:
LPC1769 systems with a Nokia 6100 / Epson display connected to SPI0

Tested on:
Olimex LPC1766-STK Development Prototype Board
EEPROM8K.mod EEPROM via I2C
Read / Writes a string and an integer to EEPROM via I2C bus

Target:
LPC1769 systems with a 8 kbit EEPROM e.g. MicroChip 24LC64
connected to the I2C bus

Tested on:
Embedded Artists LPCXpresso LPC1769
(I2C1, P0.19 = SDA1, P0.20 = SCL1)

EEPROM.mod On-chip EEPROM via IAP
Read / Writes a string and an integer to EEPROM via In-application Programming (IAP) functions.

Target:
LPC1347 systems with up to 4 kB of on-chip EEPROM

Tested on:
EzSBC LPC1347 EzSBC2 

ShowTime.mod 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.

Target:
LPC17xx systems

ReadCard.mod
MMC.mod
Read SD Card
Display the letters and numbers found in the first four blocks of an SD Card that appear to contain text information.

Target:
LPC17xx systems with an SD Card connected to the SPI1 bus

Tested on:
Olimex LPC1766-STK Development Prototype Board
ARM LPC1768 mbed with SparkFun BOB-00544 microSD Transflash breakout board
ReadCard.mod
SpeedTest.mod
SDHC.mod
SPI1.mod
Read SDHC Card / SpeedTest
Display the letters and numbers found in the first four sectors that appear to contain text information on an SDHC Card with a Project Oberon 2013 fileystem on it.

Time SDHC card read / write activities.

Target:
LPC17xx systems with an SDHC Card connected to the SPI1 bus

Tested on: 
Embedded Artists LPC1769 LPCXpresso + Opus-Two MicroSD Adaptor
ARM LPC1768 mbed + Opus-Two MicroSD Adaptor

Accelerometer.mod
Bosch SBM380 Accelerometer and Temperature Readings
Reads the accelerometer X, Y, Z and temperature values every 50ms and displays the values whenever the change exceeds a specified threshold.

Target:
LPC1769 systems with a Bosch SBM380 3-axis Accelerometer connected to the I2C2 bus

Tested on:
Olimex LPC1766-STK Development Prototype Board 
Accelerometer.mod
Analog Devices ADXL337 Accelerometer Readings
Reads the accelerometer X, Y, Z and temperature values every 2ms and displays the values whenever the change exceeds ~1%.

Target: 
LPC17xx systems with an Analog Devices ADXL337 3-axis Accelerometer connected to ADC0

Tested on: 
ARM LPC1768 mbed with SparkFun SEN-12786 ADXL337 breakout board 
Compass.mod
Honeywell HMC6352 Digital Compass
Displays the magnetic compass bearings (0 - 359 deg) every second.

Target: 
LPC178x/7x systems with a Honeywell HMC6352 digital compass connected to the I2C bus

Tested on: 
Starterkit.ru SK-MLPC1788 Board with SparkFun SEN-07915 Compass Module  


Licence Agreement

Astrobe for Cortex-M3 Library and Examples Source Code

Copyright (c) 2012-2016 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.

DISCLAIMER

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.