68HC11 Sample Code - Detecting Logic Edges, basic input-capture facilities
Simple input-capture program to detect falling-edges on a pin, and to count them via an input-capture interrupt. Change one line to capture rising edges, or to capture both edges!
Uses on-chip SCI for commands/responses.
Uses PORT A pin 0 (input-capture #3) to detect falling edges.
Uses PORT B pin 2 to generate pin-transitions under program control.
A loopback wire from 68HC11 PB2 to PA0 is thus required.
Runtime commands:
- r = report value of input-capture #3 interrupt-counter (in hex)
- t = trigger pin transition on PB2
- 1 = directly toggle LED1
- 2 = directly toggle LED2
- q = restart BUFFALO
Source Code:
- icic.asm - the main program
- lib.asm - utility routines located in on-chip EEPROM
- board.def - definitions for the target board (EVB, EVBU, Adapt-11, EVM, modern EVBU replicas, etc)
- hc11e.def - definitions for the 68HC11E MCU family
- mancon.def - manifest constants
- buffalo.def - definitions of addresses when using the 68HC11 BUFFALO monitor
- masm11 - shell-script to invoke cpp preprocessor and then as11 assembler to produce loadable object-code and symbol-table.
Mike Spooner, 24th April 2017