Saturday, February 12, 2011

LED Visor, MSP430 (Software)

This post is the third in a multi-post set: 

For this project I decided to use the Free version of Code Composer Studio, provided by TI. I have been working with version 4.1.

CCS provides a nice Eclipse based editor with a integrated complier and debugger. It installed without issues on my windows 7 64 bit machine.

I broke my software up into several pieces:
  • Main: The section which pulls everything together.
  • Standard.h: A section for constants, macros, typdefs, etc. which are shared across the entire project.
  • Button driver : This code de-bounces button presses, and sends back button press and button released events.
  • Led Driver: This is really a serial driver. It sends out data to the CAT4008 LED driver device.
  • Led Patterns: Code which generates different patterns for the LED. Some patterns are hard coded, and others are functions.
In order to save power, I designed the software to only drive 1 LED at a time. In order to make it look like more then 1 LED is on at a time, we use persistence of vision.

The software can be downloaded from a google code repository found here. The Source file are:
  • Main.c
  • Standard.h
  • buttons.h
  • buttons.c
  • LedDriver.h
  • LedDriver.c
  • LedPattern.h
  • LedPattern.c
The other files are the Code Composer Studio project files.

When running, the code :
  • scans for button presses
    • If SW2 is pressed, the code will change the pattern being run.
    • If SW1 is pressed, the speed at which the code is run is changed.
  • One the LED pattern is determined, it is clocked out to the LED driver.
  • The MSP430 goes into a sleep mode until the next clock interrupt starts the cycle again.

No comments:

Post a Comment