home   |  video   |  gallery   |  circuitry   |  code   |  schematics   |  bom   |  gems of wisdom  


CODE

Signaling Module:
[Header File]  [Pseudocode]  [C Code]

Timing Module:
[Header File]  [Pseudocode]  [C Code]

Pinout:

[Pinout Diagram]
Game Play Module:
[Header File]  [Pseudocode]  [C Code]

Main Module:
[Header File]  [Pseudocode]  [C Code]

Timing C Code

/* Timing module for Railroad HandCar arcade game */

/**************************************************/
/* Includes                                       */
/**************************************************/

#include <timers12.h>

#include "Timing.h"

/**************************************************/
/* Functions                                      */
/**************************************************/

/* Initialize timer and set 1ms 'tick' increments */

void InitializeTimer(void) {
  TMRS12_Init(TMRS12_RATE_1MS);
}

/* Wait for specified delay time (provided in ms) */

void Wait(unsigned int Delay) {
  TMRS12_InitTimer(WAIT_TIMER, Delay);
  while (!Expired(WAIT_TIMER));
}			  

/* Return whether the specified timer is counting */

char Active(char Timer) {
  return (TMRS12_IsTimerActive(Timer) == TMRS12_ACTIVE);
}

/* Return whether the specified timer has expired */

      
char Expired(char Timer) {
  return (TMRS12_IsTimerExpired(Timer) == TMRS12_EXPIRED);
}