Astrobe for Cortex-M3 Source Code

ARM Oberon Development System for Windows

Version 6.2.0 Copyright © 2006-2017 CFB Software
Last Updated 24 Jun 2017

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.2\Examples\General folders. You will also find additional source code examples on the Astrobe Forum.

The example programs which are shown with screenshots below use the Astrobe Out library module to generate text output and send it via a UART port on the development board to a COM port on the PC where it is displayed on the Astrobe terminal window. Most recent development boards allow the serial communication to be performed via a virtual COM port using a USB cable to connect the board to the PC.

The first group of examples should work with little or no modification on any of the supported NXP or STM32 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
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.

The following examples have been tested with specific combinations of development and breakout boards.

Filename  Description
Blinker.mod Blinker
Blinks an LED once per second using Timer0. 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
IRQTimer.mod
IRQ Blinker
Led connected blinking approx. once per second as a result of interrupt requests (IRQ) generated by a timer
ShowTime.mod
Time.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.

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

Target: 
NXP systems

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

Target: 
NXP systems

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 and STM32L152 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)
STM32L152 Nucleo-64 Board / 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 

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 Examples Source Code

Copyright (c) 2017 CFB Software.
http://www.astrobe.com

Permission to use, copy, modify, and/or distribute these examples in source code form (the "Software") for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 

DISCLAIMER

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THE SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES OR LIABILITY WHATSOEVER, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE DEALINGS IN OR USE OR PERFORMANCE OF THE SOFTWARE.