Skip to content

Instantly share code, notes, and snippets.

View ajarmst's full-sized avatar

AJ Armstrong ajarmst

  • Northern Alberta Institute of Technology
  • Edmonton, Canada
View GitHub Profile
// this demo is specifically set to run on the R1.0 ATmega328PB Proto PCB
// and the R1.8 'Sweet Sensor Suite' boards.
// demo board is using a 12MHz XTAL with the DIV8 fuse cleared, so... 12MHz
// to operate this demo set the bus rate for your device correctly
#define F_CPU 12E6
// the accelerometer and i/o chip both use interrupts that this demo use
// accelerometer is configured to interrupt on tap (used to wakeup the OLED)
// i/o configured to interrupt on pin change
@ajarmst
ajarmst / cgram.c
Last active December 10, 2023 21:15
Demo of custom character generation on the Hitachi LCD interface.
/////////////////////////////////////////////////////////////////////////////
// HC12 Program: I2C Demo
// Processor: MC9S12XDP512
// Bus Speed: 20 MHz (Requires Active PLL)
// Author: AJ Armstrong
// Details: Simple Demo of CGRAM on the Hitachi LCD
// Date: Dec 2023
// Revision History :
/////////////////////////////////////////////////////////////////////////////
@ajarmst
ajarmst / i2crtcacc.c
Created December 10, 2023 00:46
I2C Demo 2 - Advanced RTC, Accelerometer
/////////////////////////////////////////////////////////////////////////////
// HC12 Program: I2C Demo 2 - Advanced RTC, Accelerometer
// Processor: MC9S12XDP512
// Bus Speed: 20 MHz (Requires Active PLL)
// Author: AJ Armstrong
// Details: Demonstration of the I2C Driver Libraries
// Date: Dec 2023
// Revision History :
/////////////////////////////////////////////////////////////////////////////
@ajarmst
ajarmst / stepper.c
Created December 7, 2023 21:47
Stepper Motor Control Demo (9S12 Board)
/////////////////////////////////////////////////////////////////////////////
// HC12 Program: Stepper (Port A4-A7) Demo
// Processor: MC9S12XDP512
// Bus Speed: 20 MHz (Requires Active PLL)
// Author: AJ Armstrong
// Details: Simple Demo of Full-Wave Reversible Stepper Control
// (using a )
// Date: Dec 2023
// Revision History :
/////////////////////////////////////////////////////////////////////////////
@ajarmst
ajarmst / I2CBasics.c
Created December 5, 2023 16:00
Basic demo of using the I2C library.
/////////////////////////////////////////////////////////////////////////////
// HC12 Program: I2C Demo
// Processor: MC9S12XDP512
// Bus Speed: 20 MHz (Requires Active PLL)
// Author: AJ Armstrong
// Details: Demonstration of the I2C Driver Libraries
// Date: Dec 2023
// Revision History :
/////////////////////////////////////////////////////////////////////////////
@ajarmst
ajarmst / pwmtri.c
Created November 23, 2023 21:52
PWM Demo - Tricolour LED
/////////////////////////////////////////////////////////////////////////////
// HC12 Program: PWM Demo
// Processor: MC9S12XDP512
// Bus Speed: 20 MHz (Requires Active PLL)
// Author: AJ Armstrong
// Details: Demo of using PWM to control the Tricolour LED.
// Date: Nov 2023
// Revision History :
/////////////////////////////////////////////////////////////////////////////
@ajarmst
ajarmst / pulseaccum.c
Created November 16, 2023 23:43
Simple demo of the HC9S12 Pulse Accumulator used as a frequency counter.
/////////////////////////////////////////////////////////////////////////////
// HC12 Program: Pulse Accumulator Demo
// Processor: MC9S12XDP512
// Bus Speed: 20 MHz (Requires Active PLL)
// Author: AJ Armstrong
// Details: Very rudimentary demo of a frequency counter
// using Pulse Accumulator A
// Date: Nov 2023
// Revision History :
/////////////////////////////////////////////////////////////////////////////
@ajarmst
ajarmst / hcsr04.c
Created November 15, 2023 16:42
Demonstration of using the ECT to control a HC-SR04 ultrasonic distance sensor
/////////////////////////////////////////////////////////////////////////////
// HC12 Program: Exam 1 - Solution
// Processor: MC9S12XDP512
// Bus Speed: 20 MHz (Requires Active PLL)
// Author: AJ Armstrong, based on work by Carlos Estay
// Details: Demo of using the ECT for an HC-SR04 ultrasonic distance snsr
// Date: Nov 2023
// Revision History :
/////////////////////////////////////////////////////////////////////////////
@ajarmst
ajarmst / adc.c
Last active October 27, 2023 19:57
ADC Demo
/////////////////////////////////////////////////////////////////////////////
// HC12 Program: Demo 5 - ADC
// Processor: MC9S12XDP512
// Bus Speed: 20 MHz (Requires Active PLL)
// Author: AJ Armstrong
// Details: Demo of voltage measurement
// Date: Oct 2023
// Revision History :
/////////////////////////////////////////////////////////////////////////////
@ajarmst
ajarmst / scids.c
Created October 17, 2023 18:32
Passing Data Structures using the SCI
/////////////////////////////////////////////////////////////////////////////
// HC12 Program: Demo 4 - Serial Structures
// Processor: MC9S12XDP512
// Bus Speed: 20 MHz (Requires Active PLL)
// Author: AJ Armstrong
// Details: Demonstrates basic SCI operations allowing one board
// to synchronize with another. If PJ1 is pressed,
// the current state of the board (Segs and Leds) is trans-
// mitted to the other board. PJ0 resets everything to 0.
// Date: Oct 2023