K-42 The hardware, part 4: Alarm module and Guidance Computer

This post is a repost of a blog entry from 26th September 2015 on Kerbal Space Program forum (soon to be defunct).

The Alarm Module 
The alarm module took a little time to complete as it was the only module able to receive commands from the master over I2C. There's a command to light up alarms, to blink them and to set off the master alarm. It is also able to generate simple sounds other than the master alarm signal but those are limited to periodic beeps with a single frequency. I've used the beep to indicate radar altitude when in landing mode which make it easier to estimate distance to ground while monitoring vertical speed.
If the master does not poll the state of the alarm module often enough the computer alarm lights up and if the delay is more than 15 seconds it sounds the master alarm.
Source code: 


The Guidance Computer

The guidance computer is made up of two modules, one input module and one display module. They contain very little processing ability and are in all respects just IO units.

The input module contains a home brewed matrix keyboard and four switches. The switches are read over I2C as for all other modules but the keyboard sends ASCII over the serial TX line to the master.

The display module is simply a serial terminal that can parse simple commands embedded in the string sent to it. All commands starts and ends with a single backslash as it is not possible to print a backslash on the display anyway and I couldn't think of a reason to print the Yen sign that has substituted it.

The most common commands (those I've actually used) are as follows:

  • "\W\" - Wipe (clear) all displays.
  • "\w\" - Wipe current display only.
  • "\Dn\" - Select deisplay where n is the display number, 0-2.
  • "\Cxx:yy\" - Set cursor to character position xx on line yy on current display.
  • "\B\" - Display cursor as a blinking block.
  • "\b\" - Hide cursor.
Source code:


No comments:

Post a Comment