The Rusty Spike

A Railroad Fan's Website

By

Chasing Lights (74HC595 Register + TI Launchpad)

Okay ladies and gents, here’s a Chasing Light project using a single Shift Register (74HC595) and a TI Launchpad. (I’m currently following a line of research using the Shift Registers, but there is an easier way to do this with just a Launchpad alone.) It can be easily adapted for many uses. Examples include, but not limited to:

  • Theatre Signs
  • Airport Landing Strip
  • Eat At Dave’s Signs

This particular Launchpad project uses an external device called a Shift Register. Simply put, it’s a device that remembers the 1 or 0 you just put into. If you put another 1 or 0 into it, it shifts all the existing saved 1’s and 0’s over one slot and adds your newest value in. It can hold 8 values, hence the term 8-bits.

Here’s what it looks like when its all put together on a breadboard:

Chasing Lights v1.0 from claymore1977 on Vimeo.

CCS 5 Project Files

Here’s the CCS 5 Project Files for this project

Wiring & Breadboard Diagrams

ChasingLights_bb

Disregard that blue wire… dunno where that came from. Need to edit it out

ChasingLights_schem

Code

Here’s the code for it. There’s only 5 parameters you need to set:

  • DATA – The pin on the Launchpad that will be hooked to the 74HC595’s DATA pin
  • LATCH – The pin on the Launchpad that will be hooked to the 74HC595’s LATCH pin
  • CLOCK – The pin on the Launchpad that will be hooked to the 74HC595’s CLOCK pin
  • LIGHT_SPACING – Every xth light will light. Video shows a spacing of 3.
  • LIGHT_DELAY – Delay between change. Lower numbers here means faster chasing.

You will also need the LP4MRR.h Header file and you can get it here.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/******************************************
 * Chasing Lights v1.0
 *
 * COPYRIGHT 2013 Dave Loman
 *
 * Provided  under a:
 *    Creative Commons Attribution,
 *    Non-Commercial
 *    Share-Alike,
 *    3.0 Unported License
 *
 ******************************************/
#include <msp430x20x2.h>
#include "lp4mrr.h"
 
/* Define our pins */
#define DATA BIT0  // DS    -> 1.0
#define LATCH BIT4 // ST_CP -> 1.4
#define CLOCK BIT5 // SH_CP -> 1.5
 
#define LIGHT_SPACING 3
#define LIGHT_DELAY 350
 
int main(void) {
	DISABLE_WATCHDOG();
	P1_DIR_OUT(DATA);
	P1_DIR_OUT(CLOCK);
	P1_DIR_OUT(LATCH);
 
	char i = 0, b = 0;
	for (;;) {
		b |= 0x01;
		for (i = 0; i < LIGHT_SPACING; ++i) {
			P1_SHIFT_OUT_8(b, LATCH, CLOCK, DATA);
			DELAY_MS(LIGHT_DELAY);
			b = (b << 1);
		}
	}
}

Leave a Reply

Your email address will not be published. Required fields are marked *