Astrobe for Cortex-M3 Source Code

ARM Oberon Development System for Windows

Version 7.0.1 Copyright © 2006-2019 CFB Software
Last Updated 22 Apr 2019

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-v7.0\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.

UserTraps.mod UserTraps
Demonstrates the trapping and user-defined display of runtime errors.

Extensions.mod
ExtensionsCase.mod
ExtensionsProc.mod
Lists.mod
Extensions
Shows three different ways to use Oberon's Type Extension feature 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.



Extensions uses the IS operator to perform the type tests in association with type guards.

ExtensionsCase
uses a CASE statement to perform the type tests and selections.

ExtensionsProc uses procedure variables as record fields to perform type-specific actions for the different record extensions.

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

Tested on:
Nokia 6100 Display (LCDEpson and SPI0) +
  Olimex LPC1766-STK Board

AdaFruit 1.8" TFT Display (ST7735 and SPI1) +
  ARM LPC1768 mbed
  STM32L152 Nucleo-64 Board
  STM32F207 Nucleo-144 Board

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.

Tested on: 
ARM LPC1768 mbed on an mbed Application Board with a Newhaven 32x128 LCD display connected to SPI0 via a Sitronix ST756R LCD controller
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.

Tested on:
Nokia 6100 Display (LCDEpson and SPI0) +
  Olimex LPC1766-STK Board
Temperature.mod
I2CConfig.mod
Time.mod
I2C Temperature Logger
Monitors the current temperature every second using the Real Time Clock and writes it and the time to output, whenever it changes.

Tested on:
SparkFun SEN-09418: TI Digital Temperature Sensor Breakout (I2C1) +
  STM32L152 Nucleo-64 Board
  STM32F207 Nucleo-144 Board
 
 
HCTest.mod
HCDir.mod
HCfiles.mod
HCDrive.mod
HCFiler Filesystem: HCTest
Inititialise an HCFiler filesystem and create a number of test files on an SDHC Card accessed via SPI1.

Tested on: 
Opus-Two MicroSD Adaptor
+ Embedded Artists LPC1769 LPCXpresso
+ ARM LPC1768 mbed
+ All supported STM Nucleo-32, Nucleo-64 and Nucleo-144 boards
HCReadSpeed.mod
HCDir.mod
HCDrive.mod
HCFiler Filesystem: HCReadSpeed
Time SDHC card sector reading speed on an HCFiler filesystem accessed via SPI1.

Tested on: 
Opus-Two MicroSD Adaptor
+ Embedded Artists LPC1769 LPCXpresso
+ ARM LPC1768 mbed
+ All supported STM Nucleo-32, Nucleo-64 and Nucleo-144 boards

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.

Tested on:
Bosch SBM380 3-axis Accelerometer connected to the I2C2 bus on an Olimex LPC1766-STK 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%.

Tested on: 
SparkFun SEN-12786 breakout board with an Analog Devices ADXL337 3-axis Accelerometer (ADC0) +
  ARM LPC1768 mbed  
DRAMTest.mod DRAM Test
Tests 4164 64kbit DRAM chips for a variety of failures. It has been used on retrocomputing projects and could be modified to test other types of RAM chips.

Tested on:
STM32F207 Nucleo-144 Board
EEPROM8K.mod EEPROM via I2C
Read / Writes a string and an integer to EEPROM via 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.

Tested on:
EzSBC LPC1347 EzSBC2 


Licence Agreement

Astrobe for Cortex-M3 Examples Source Code

Copyright (c) 2006-2019 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.