DCF77 Atomic clock using Nokia 6610 colour LCD display. This will continue to run with no signal and shows a graphic bit map display demonstrating the time build. Does not use the Mbed RTC so will run on the LPC11U24. The main signal timing is achieved by using a Ticker ISR that looks at the DCF signal input every 50mS this also produces the seconds on the local clock incase of signal errors or no signal. Many thanks to Lynton Towler for the idea of this part of the code and Wim who helped me convert it from an Arduino program. The Parity code was fromHans program that works.

Dependencies:   mbed

/media/uploads/star297/_scaled_20130306_221042.jpg

Re published due to error in title.

I have also updated the 'Leap' year print code as that was incorrect.

This program works on the both Mbed's (LPC1768 and LPC11U24)

Committer:
star297
Date:
Tue Mar 19 11:25:13 2013 +0000
Revision:
2:31f5b5d56af6
Parent:
1:cad87f63a115
Leap indicator correction

Who changed what in which revision?

UserRevisionLine numberNew contents of line
star297 1:cad87f63a115 1 /* mbed Library - Nokia LCD Labelled "X3"
star297 1:cad87f63a115 2 * This is using the Philips PCF8833 controller
star297 1:cad87f63a115 3 * Copyright (c) 2009 P.R.Green
star297 1:cad87f63a115 4 */
star297 1:cad87f63a115 5
star297 1:cad87f63a115 6 #ifndef MBED_MOBILELCD_H
star297 1:cad87f63a115 7 #define MBED_MOBILELCD_H
star297 1:cad87f63a115 8
star297 1:cad87f63a115 9 //Colours in RGB 5:6:5 16bit mode
star297 1:cad87f63a115 10 #define BLACK 0x0000
star297 1:cad87f63a115 11 #define RED 0xF800
star297 1:cad87f63a115 12 #define GREEN 0x07E0
star297 1:cad87f63a115 13 #define BLUE 0x001F
star297 1:cad87f63a115 14 #define WHITE 0xFFFF
star297 1:cad87f63a115 15 #define YELLOW 0xFF00
star297 1:cad87f63a115 16 #define MAGENTA 0xF0F0
star297 1:cad87f63a115 17 #define CYAN 0x05FC
star297 1:cad87f63a115 18
star297 1:cad87f63a115 19 #include "mbed.h"
star297 1:cad87f63a115 20
star297 1:cad87f63a115 21
star297 1:cad87f63a115 22 namespace mbed {
star297 1:cad87f63a115 23
star297 1:cad87f63a115 24 /* Class: MobileLCD
star297 1:cad87f63a115 25 * An abstraction of the 130x130 Nokia Mobile labelled "X3" phone screen
star297 1:cad87f63a115 26 *
star297 1:cad87f63a115 27 * Example:
star297 1:cad87f63a115 28 * >
star297 1:cad87f63a115 29 * > #include "mbed.h"
star297 1:cad87f63a115 30 * > #include "MobileLCD.h"
star297 1:cad87f63a115 31 * >
star297 1:cad87f63a115 32 * > MobileLCD lcd(p5,p6,p7,p8,p9);
star297 1:cad87f63a115 33 * >
star297 1:cad87f63a115 34 * > int main() {
star297 1:cad87f63a115 35 * > lcd.printf("Hello World!");
star297 1:cad87f63a115 36 * > }
star297 1:cad87f63a115 37 */
star297 1:cad87f63a115 38
star297 1:cad87f63a115 39 class MobileLCD : public Stream {
star297 1:cad87f63a115 40
star297 1:cad87f63a115 41 public:
star297 1:cad87f63a115 42 /* Constructor: MobileLCD
star297 1:cad87f63a115 43 * Create and object for the Mobile LCD, using SPI and two DigitalOuts
star297 1:cad87f63a115 44 *
star297 1:cad87f63a115 45 * Variables:
star297 1:cad87f63a115 46 * mosi - SPI data out
star297 1:cad87f63a115 47 * miso - SPI data in, not used
star297 1:cad87f63a115 48 * clk - SPI clock
star297 1:cad87f63a115 49 * cs - Chip Select
star297 1:cad87f63a115 50 * rst - reset
star297 1:cad87f63a115 51 */
star297 1:cad87f63a115 52
star297 1:cad87f63a115 53 MobileLCD(PinName mosi, PinName miso, PinName clk, PinName cs, PinName rst);
star297 1:cad87f63a115 54
star297 1:cad87f63a115 55 virtual void reset();
star297 1:cad87f63a115 56 virtual void _select();
star297 1:cad87f63a115 57 virtual void _deselect();
star297 1:cad87f63a115 58 virtual void _window(int x, int y, int width, int height);
star297 1:cad87f63a115 59 virtual void _putp(int colour);
star297 1:cad87f63a115 60 //virtual void orientation();
star297 1:cad87f63a115 61
star297 1:cad87f63a115 62 void command(int value);
star297 1:cad87f63a115 63 void data(int value);
star297 1:cad87f63a115 64 void foreground(int v);
star297 1:cad87f63a115 65 void background(int v);
star297 1:cad87f63a115 66 /* Function: locate
star297 1:cad87f63a115 67 * Set the text cursor to location x,y
star297 1:cad87f63a115 68 *
star297 1:cad87f63a115 69 * Variables:
star297 1:cad87f63a115 70 * x - An integer setting the column position
star297 1:cad87f63a115 71 * y - An integer setting the row position
star297 1:cad87f63a115 72 */
star297 1:cad87f63a115 73 void locate(int column, int row);
star297 1:cad87f63a115 74 /* Function: newline
star297 1:cad87f63a115 75 * Set the text cursor to the start of the next line
star297 1:cad87f63a115 76 */
star297 1:cad87f63a115 77 void newline();
star297 1:cad87f63a115 78 virtual int _putc(int c);
star297 1:cad87f63a115 79 virtual int _getc() { return 0; }
star297 1:cad87f63a115 80 SPI _spi;
star297 1:cad87f63a115 81 DigitalOut _rst;
star297 1:cad87f63a115 82 DigitalOut _cs;
star297 1:cad87f63a115 83 void bitblit(int x, int y, int width, int height, const char* bitstream);
star297 1:cad87f63a115 84 void fill(int x, int y, int width, int height, int colour);
star297 1:cad87f63a115 85 void blit(int x, int y, int width, int height, const int* colour);
star297 1:cad87f63a115 86 /* Function: cls
star297 1:cad87f63a115 87 * Clear the screen
star297 1:cad87f63a115 88 */
star297 1:cad87f63a115 89 void cls();
star297 1:cad87f63a115 90 int width();
star297 1:cad87f63a115 91 int height();
star297 1:cad87f63a115 92 int columns();
star297 1:cad87f63a115 93 int rows();
star297 1:cad87f63a115 94 void putp(int v);
star297 1:cad87f63a115 95 void window(int x, int y, int width, int height);
star297 1:cad87f63a115 96 void pixel(int x, int y, int colour);
star297 1:cad87f63a115 97 int _row, _column, _rows, _columns, _foreground, _background, _width, _height;
star297 1:cad87f63a115 98 };
star297 1:cad87f63a115 99
star297 1:cad87f63a115 100 }
star297 1:cad87f63a115 101
star297 1:cad87f63a115 102 #endif
star297 1:cad87f63a115 103
star297 1:cad87f63a115 104