📄 fet4xx_rtcwlcd.c
字号:
//*******************************************************************************
//
// Description "FET410_RTCwLCD": This program maintains a real time clock and
// displays the current time on a 3.5 digit static LCD. The colon between the
// minutes and seconds toggles on or off each second to indicate that the clock
// is running. The digits of the display are only rewritten each minute once
// the elapsed seconds roll over from 60 back to 0. The fourth digit is
// automatically blank for hours 1-9. The software is totally interrupt driven.
// It only comes out of low power mode 3 and executes code when a Basic Timer
// interrupt occurs, once each second.
//
//*******************************************************************************
//*******************************************************************************
// Modified Stefan Schauer
// date 11/03/2004
// Changes:
// - SetArrow function
//
// Version 1.0 converted to C
// 11/03/2004
//
//*******************************************************************************
//*******************************************************************************
// THIS PROGRAM IS PROVIDED "AS IS". TI MAKES NO WARRANTIES OR
// REPRESENTATIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
// INCLUDING ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR
// COMPLETENESS OF RESPONSES, RESULTS AND LACK OF NEGLIGENCE.
// TI DISCLAIMS ANY WARRANTY OF TITLE, QUIET ENJOYMENT, QUIET
// POSSESSION, AND NON-INFRINGEMENT OF ANY THIRD PARTY
// INTELLECTUAL PROPERTY RIGHTS WITH REGARD TO THE PROGRAM OR
// YOUR USE OF THE PROGRAM.
//
// IN NO EVENT SHALL TI BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
// CONSEQUENTIAL OR INDIRECT DAMAGES, HOWEVER CAUSED, ON ANY
// THEORY OF LIABILITY AND WHETHER OR NOT TI HAS BEEN ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGES, ARISING IN ANY WAY OUT
// OF THIS AGREEMENT, THE PROGRAM, OR YOUR USE OF THE PROGRAM.
// EXCLUDED DAMAGES INCLUDE, BUT ARE NOT LIMITED TO, COST OF
// REMOVAL OR REINSTALLATION, COMPUTER TIME, LABOR COSTS, LOSS
// OF GOODWILL, LOSS OF PROFITS, LOSS OF SAVINGS, OR LOSS OF
// USE OR INTERRUPTION OF BUSINESS. IN NO EVENT WILL TI'S
// AGGREGATE LIABILITY UNDER THIS AGREEMENT OR ARISING OUT OF
// YOUR USE OF THE PROGRAM EXCEED FIVE HUNDRED DOLLARS
// (U.S.$500).
//
// Unless otherwise stated, the Program written and copyrighted
// by Texas Instruments is distributed as "freeware". You may,
// only under TI's copyright in the Program, use and modify the
// Program without any charge or restriction. You may
// distribute to third parties, provided that you transfer a
// copy of this license to the third party and the third party
// agrees to these terms by its first use of the Program. You
// must reproduce the copyright notice and any other legend of
// ownership on each copy or partial copy, of the Program.
//
// You acknowledge and agree that the Program contains
// copyrighted material, trade secrets and other TI proprietary
// information and is protected by copyright laws,
// international copyright treaties, and trade secret laws, as
// well as other intellectual property laws. To protect TI's
// rights in the Program, you agree not to decompile, reverse
// engineer, disassemble or otherwise translate any object code
// versions of the Program to a human-readable form. You agree
// that in no event will you alter, remove or destroy any
// copyright notice included in the Program. TI reserves all
// rights not specifically granted under this license. Except
// as specifically provided herein, nothing in this agreement
// shall be construed as conferring by implication, estoppel,
// or otherwise, upon you, any license or other right under any
// TI patents, copyrights or trade secrets.
//
// You may not use the Program in non-TI devices.
//*******************************************************************************
#include "parameter.h"
#if PCB == TI_BOARD
#include "device.h"
#define _def_clock
#include "fet4xx_rtclcd.h"
//--------RAM bytes used for variables-------------------------------------------
unsigned char SEC = 0x00;
unsigned char MIN = 0x00;
unsigned char HOUR = 0x12;
unsigned char DAY = 0x01;
unsigned char MONTH = 0x01;
unsigned char YEAR = 0x04;
//-------------------------------------------------------------------------------
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// LCD Definitions
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// LCD_TYPE
// Top Digit at LCD
// SB LCD
#define ta 0x10
#define tb 0x01
#define tc 0x04
#define td 0x08
#define te 0x40
#define tf 0x20
#define tg 0x02
#define tdp 0x80
const unsigned char TLCD_Tab[] = {
ta+tb+tc+td+te+tf, // displays "0"
tb+tc, // displays "1"
ta+tb+td+te+tg, // displays "2"
ta+tb+tc+td+tg, // displays "3"
tb+tc+tf+tg, // displays "4"
ta+tc+td+tf+tg, // displays "5"
ta+tc+td+te+tf+tg, // displays "6"
ta+tb+tc, // displays "7"
ta+tb+tc+td+te+tf+tg, // displays "8"
ta+tb+tc+td+tf+tg, // displays "9"
ta+tb+tc+te+tf+tg, // displays "A"
tc+td+te+tf+tg, // displays "B"
ta+td+te+tf, // displays "C"
tb+tc+td+te+tg, // displays "D"
ta+td+te+tf+tg, // displays "E"
ta+te+tf+tg, // displays "F"
};
// SB LCD
#define a 0x08
#define b 0x04
#define c 0x02
#define d 0x01
#define e 0x20
#define f 0x40
#define dp 0x10
#define colon 0x80
#define g 0x4000
#define h 0x8000
#define j 0x0800
#define k 0x0400
#define m 0x0200
#define n 0x0100
#define q 0x2000 //1000h
#define p 0x1000 //2000h
//--- character definitions
// decode special Char to be placed at end of the table
const unsigned int CHAR_SPACE = 0;
const unsigned int CHAR_MINUS = g+m;
//#define CHAR_MINUS LCD_mi
//#define LCD_mi LCD_sp[13]
const unsigned short LCD_sp[] = {
0, // displays " "
j+p, // displays "!"
b+f, // displays """
a+b+c+d+e+f+g+j+m+p, // displays "#"
a+f+g+m+c+d+j+p, // displays "$"
c+f+k+q, // displays "%"
d+h+j+n+q, // displays "&"
j, // displays "'"
j+k+n+p, // displays "("
h+j+p+q, // displays ")"
g+h+j+k+m+n+p+q, // displays "*"
g+j+m+p, // displays "+"
q, // displays ","
g+m, // displays "-"
dp, // displays "."
k+q, // displays "/"
};
const unsigned short LCD_Tab[] = {
a+b+c+d+e+f+k+q, // displays "0" with diagonal slash
b+c, // displays "1"
a+b+d+e+g+m, // displays "2"
a+b+c+d+g+m, // displays "3"
b+c+f+g+m, // displays "4"
a+c+d+f+g+m, // displays "5"
a+c+d+e+f+g+m, // displays "6"
a+b+c, // displays "7"
a+b+c+d+e+f+g+m, // displays "8"
a+b+c+d+f+g+m, // displays "9"
colon, // displays ":"
colon+q, // displays ";"
k+n, // displays "<"
d+g+m, // displays "="
h+q, // displays ">"
a+b+m+p, // displays "?"
a+b+d+e+f+g+m, // displays "@"
a+b+c+e+f+g+m, // displays "A"
c+d+e+f+g+m, // displays "B"
a+d+e+f, // displays "C"
b+c+d+e+g+m, // displays "D"
a+d+e+f+g, // displays "E"
a+e+f+g, // displays "F"
a+c+d+e+f+m, // displays "G"
b+c+e+f+g+m, // displays "H"
j+p +a+d, // displays "I"
b+c+d+e, // displays "J"
e+f+g+k+n, // displays "K"
d+e+f, // displays "L"
b+c+e+f+h+k, // displays "M"
e+f+h+n+c+b, // displays "N"
a+b+c+d+e+f, // displays "O" big
a+b+e+f+g+m, // displays "P"
a+b+c+d+e+f+n, // displays "Q"
e+f+a+b+m+g+n, // displays "R"
a+c+d+f+g+m, // displays "S"
a+j+p, // displays "T"
c+d+e+f+b, // displays "U"
e+f+q+k, // displays "V"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -