📄 rtc.h
字号:
//*****************************************************************************
//*****************************************************************************
// FILENAME: RTC.h
// Version: 1.0, Updated on 2008/12/13 at 11:0:49
// Generated by PSoC Designer ???
//
// DESCRIPTION: RTC User Module C Language interface file
// for the 21x45/22x45 PSoC family of devices
//-----------------------------------------------------------------------------
// Copyright (c) Cypress Semiconductor Corporation 2000-2008. All Rights Reserved.
//*****************************************************************************
//*****************************************************************************
#include <m8c.h>
#pragma fastcall16 RTC_EnableInt
#pragma fastcall16 RTC_DisableInt
#pragma fastcall16 RTC_Start
#pragma fastcall16 RTC_Stop
#pragma fastcall16 RTC_SetIntPeriod // Write RTCCR
#pragma fastcall16 RTC_bReadSecond // Read RTCS
#pragma fastcall16 RTC_bReadMinute // Read RTCM
#pragma fastcall16 RTC_bReadHour // Read RTCH
#pragma fastcall16 RTC_SetSecond // Write RTCS
#pragma fastcall16 RTC_SetMinute // Write RTCM
#pragma fastcall16 RTC_SetHour // Write RTCH
//-------------------------------------------------
// Prototypes of the RTC API.
//-------------------------------------------------
extern void RTC_EnableInt(void);
extern void RTC_DisableInt(void);
extern void RTC_Start(void);
extern void RTC_Stop(void);
extern void RTC_SetIntPeriod(BYTE bConfiguration);
extern BYTE RTC_bReadSecond(void);
extern BYTE RTC_bReadMinute(void);
extern BYTE RTC_bReadHour(void);
extern void RTC_SetSecond(BYTE bSecond);
extern void RTC_SetMinute(BYTE bMinute);
extern void RTC_SetHour(BYTE bHour);
//--------------------------------------------------
// RTC interrupt selection definitions
//--------------------------------------------------
#define RTC_INT_SEC (0x00)
#define RTC_INT_MIN (0x04)
#define RTC_INT_HOUR (0x08)
#define RTC_INT_DAY (0x0C)
//--------------------------------------------------
// Constants for RTC API's.
//--------------------------------------------------
#define RTC_RTCCR_REG_START_BIT ( 0x01 )
#define RTC_INT_MASK ( 0x20 )
#define RTC_INT_SEL_MASK ( 0x0C )
//-------------------------------------------------
// Register Addresses for RTC
//-------------------------------------------------
#pragma ioport RTC_RTCH_REG: 0x1a4 //RTC Hour register
BYTE RTC_RTCH_REG;
#pragma ioport RTC_RTCM_REG: 0x1a5 //RTC Minute register
BYTE RTC_RTCM_REG;
#pragma ioport RTC_RTCS_REG: 0x1a6 //RTC Second register
BYTE RTC_RTCS_REG;
#pragma ioport RTC_RTCCR_REG: 0x1a7 //Control register
BYTE RTC_RTCCR_REG;
//-------------------------------------------------
// RTC Macro 'Functions'
//-------------------------------------------------
#define RTC_Start_M \
( RTC_RTCCR_REG |= RTC_RTCCR_REG_START_BIT )
#define RTC_Stop_M \
( RTC_RTCCR_REG &= ~RTC_RTCCR_REG_START_BIT )
#define RTC_EnableInt_M \
M8C_EnableIntMask(RTC_RTCCR_REG, RTC_INT_MASK) ;\
M8C_EnableIntMask(INT_MSK2, INT_MSK2_RTC) ;\
#define RTC_DisableInt_M \
M8C_DisableIntMask(RTC_RTCCR_REG, RTC_INT_MASK) ;\
M8C_DisableIntMask(INT_MSK2, INT_MSK2_RTC) ;\
// end of file RTC.h
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -