This is a simple clock project based on ti MSP430G2231. The MSP430G2231 micro-controller comes included in the $4.30 TI Launchpad kit. The project objective is to create a working clock with minimal components. In order to achieve this objective, current limiting resistors for the LED display were omitted. also multiplexing is used to reduce the io pins needed to drive the LED display.
For a 4 digit x 7 segment display we need to drive 32 LEDs (including the decimal dot). the MSP430G2231 has only 10 IO pins at most, so instead of driving individual LEDs we use multiplexing to briefly turn on and off led segments for each digit. We do this ever so quickly to fool our eyes that the LEDs are constantly on. This is also known as POV (persistence of vision). The control (user interface) is also arranged so that we only use one tactile button for input. The firmware capture long button presses (press and hold) for menu rotation and normal button presses for menu selection.
Another objective of this project is to lower the admission level for anyone who is thinking about picking up electronics as a hobby. No special tools are needed to built this project. DIP components are used instead of SMD so no special placement tools are needed. Breadboard is used instead of PCB to eliminate the need of access to a soldering iron. Cost of components are minimal (the micro-controller programmer is included) and parts are commonly accessible.
I called this the 3P4W clock as it takes only 3 parts (alarm is optional) and 4 wires to assemble this project.
TI LaunchPad Link: http://processors.wiki.ti.com/index.php/MSP430_LaunchPad_%28MSP-EXP430G2%29?DCMP=launchpad&HQS=Other+PR+launchpadwiki-pr
Below is video on full construction, direct link if embedded doesn't work
http://www.youtube.com/watch?v=Ama9BEEP9gs
Remove these ads by
Signing UpStep 1Features and Parts
Features
. Minimal components, 3 parts (4 parts if you need alarm)
. 4 jumper wires on a mini breadboard
. Battery operated from 3V
. Use of internal VLO clock (~12Khz) to keep time, sleep mode takes less than 1uA power
. VLO is calibrated against DCO at startup, DCO in turn use factory calibrated value
. Manual calibration allow fine adjustment to oscillator timing
. Fairly accurate if you consider that there is no crystal used
. Ambient temperature read in metric and imperial units
. Optional alarm if you connects a buzzer (auto-detect), this will make the 4p4w clock
. Hidden easter egg function for you to find
Parts
. MSP430G2231 (from your Launchpad kit)
. 4 digit 7 segment LED display (red works best on 3V power)
. Tactile button
. Buzzer 3V (Optional, and becomes the 4P4W clock)
You will also need a breadboard to place your components, a 3v 2xAAA battery holder with batteries and 4 connecting jumper wires, I used a 170 tie-point mini breadboard as the platform and used network cable cores as jumper wires.
The LED display is commonly available in ebay, look for those 0.4" or 0.36" 4 digit displays, you will want to make sure it's common cathode and the pin layout matches (most do)
__a__ (0) A F (1)(2) B
f| |b -+--+--+--+--+--+-
|__g__| | |
e| |c |Pin1 |
|__d__| -+--+--+--+--+--+-
E D . C G (3)
Tools
. Computer with either Linux or Windows
. TI LaucnPad, EZ430-F2013 Kit, or other MSP430 programmer
. mspdebug or TI CCS development environment (programming software)
| « Previous Step | Download PDFView All Steps | Next Step » |










































the change should be make here (locate and replace w/ the commented lines), there are two lines (port1 and port2) change, we want to reverse the polarity right when we output the port values.
// use this (w/ negate) if led is common anode
//P2OUT = ~(*ioptr & ~digit_map2[pos]);
P2OUT = *ioptr & ~digit_map2[pos];
P2DIR = *ioptr++ | digit_map2[pos];
// use this (w/ negate) if led is common anode
//P1OUT = ~(*ioptr & ~digit_map1[pos]);
P1OUT = *ioptr & ~digit_map1[pos];
i've tried it and it work well, except that now when u long-press the button for menu, one of the segment lit up (instead of a decimal) because of the polarity and shared io pins. u will know what i mean when u built.
also updated the source file 3p4w-noegg.c on my site.
"..\lnk_msp430g2231.cmd", line 60: error: placement fails for object ".text",
size 0x8a4 (page 0). Available ranges:
FLASH size: 0x7e0 unused: 0x732 max hole: 0x732
error: errors encountered during linking; "C:\Texas Instruments\clk.out" not
built
1. download and built 3p4w_noegg.c instead, it requires less flash.
2. try IAR.
3. built w/ mspgcc under linux or mspgcc under cygwin under windows.
see my webpage for recent updates. i had a reader did a successful built recently. read the comments on hints.
http://www.43oh.com/2010/08/an-msp430-based-clock/
u can try locate this code segment from the source
*pp++ = digit2ports[digit][--offset];
and replace it w/
*pp++ = ~digit2ports[digit][--offset];
this would negate the output logic levels and should work, i will find time to try it myself and post the result.
also, this clock was not accurate and i had since add a rtc chip to keep accurate time (plus date), if u are interested, checkout my website.
Somnath
Mail : somnathkolkata@hotmail.com
Thanks
see more detail for what is needed and a simple led blinky "get start" project.
http://www.simpleavr.com/msp430-projects/launchpad-shield
i don't use IAR or CCS as i don't use windows. i am use u can get help in the ti forums (or google around) if u need to get things done under windows.
http://www.simpleavr.com/msp430-projects/3p4w-clock
let me know if u have problems and i will try to help.
if u need code snippets for launchpad temperature sensing, u should try
http://www.43oh.com and the google group http://groups.google.com/group/ti-launchpad , a lot of helpful people there.