Hardware Libraries and Drivers
FIGURE 5-12:
System_initialization()
{
rtcc_init();
}
5.8.1.2
rtcc_handler
The rtcc_handler function must be called frequently to keep the internal seconds
counter accurate.
FIGURE 5-13:
System_interrupt_service_routine()
{
If(TMR1IF & TMR1IE)
{
TMR1IF = 0;
rtcc_handler();
}
}
5.8.1.3
rtcc_set
After system initialization, the seconds counter is cleared to ‘ 0 ’. The standard C
libraries equate 0 seconds to Midnight, Jan 1, 1970. That time has expired a long time
ago, so a new time in seconds can be configured with rtcc_set() .
FIGURE 5-14:
#include <time.h>
Time_set() // set the time & date to 1 second after midnight, July 4, 2009
{
struct tm time_str;
time_t unix_time;
time_str.tm_year = 2009; // the year
time_str.tm_mon = 7;
time_str.tm_mday = 4;
time_str.tm_hour = 0;
time_str.tm_min = 0;
time_str.tm_sec = 1;
// the month
// the day of the month
// the hour (0-23)
// the minutes
// the seconds
time_str.tm_isdst = -1; // daylight savings time modifier
unix_time = mktime(&time_str);
rtcc_set(unix_time);
}
5.8.1.4
time
The standard C libraries require the application to supply the time function. This
function returns the current time_t value or loads a supplied time_t value. The
interrupts are saved and restored to make this function safe for use with interrupt driven
code.
5.9
USING THE MCP9800 DRIVER
The MCP9800 is an I 2 C temperature sensor. The MCP9800 driver provides a simple
interface to the features in the sensor.
? 2009 Microchip Technology Inc.
DS41401A-page 27
相关PDF资料
DV243003 KIT STARTER FOR SRL MEM PRODUCTS
DVA1001 ADAPTER FOR PIC16F716 18DIP
DVA1004 DEVICE ADAPTER 8/14/20DIP
E3R-D12GP-P RELAY RCVR PLUG-IN DIMMER
E3R-R12-3HOTP RCVR 3WIRE RELAY 120V
E3R-R12GP RCVR PLUG-IN RELAY
E3T-MICFP-40 CONVERTER 4-CH SLT SENSOR
E3T-R12-2INTP TRANSMITTER SWITCH LEG 120V
相关代理商/技术参数
DV164132 制造商:Microchip Technology Inc 功能描述:PIC12F1xxx/PIC16F1xxx F1 Evaluation Kit
DV164133 功能描述:电源管理IC开发工具 Energy Harvesting Development Tool RoHS:否 制造商:Maxim Integrated 产品:Evaluation Kits 类型:Battery Management 工具用于评估:MAX17710GB 输入电压: 输出电压:1.8 V
DV164136 功能描述:开发板和工具包 - PIC / DSPIC PIC18F DEV Kit (with PICkit 3) RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DV164139 功能描述:开发板和工具包 - PIC / DSPIC Lo PIn Count USB Dev Kit (w/PICkit 3) RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DV17K3225T 制造商:SEI Stackpole Electronics Inc 功能描述:- Tape and Reel 制造商:SEI Stackpole Electronics Inc 功能描述:Var MOV 17VAC/22VDC 100A 27V 3225 SMD T/R
DV17K4032T 制造商:SEI Stackpole Electronics Inc 功能描述:VAR 17VAC 22VDC 250A 27V 4032 SMD - Tape and Reel 制造商:SEI Stackpole Electronics Inc 功能描述:Var MOV 17VAC/22VDC 250A 27V 4032 SMD T/R
DV18-145MB-3K 功能描述:端子 PIN -DSC 22-18 145X032 VYL RED RoHS:否 制造商:AVX 产品:Junction Box - Wire to Wire 系列:9826 线规:26-18 接线柱/接头大小: 绝缘: 颜色:Red 型式:Female 触点电镀:Tin over Nickel 触点材料:Beryllium Copper, Phosphor Bronze 端接类型:Crimp
DV18-145M-C 功能描述:端子 MALE BLADE ADAPT RoHS:否 制造商:AVX 产品:Junction Box - Wire to Wire 系列:9826 线规:26-18 接线柱/接头大小: 绝缘: 颜色:Red 型式:Female 触点电镀:Tin over Nickel 触点材料:Beryllium Copper, Phosphor Bronze 端接类型:Crimp