資源簡介
程序時關(guān)于用GPS秒脈沖或者UTC時間,同步LED閃爍頻率的
代碼片段和文件信息
#include?
__CONFIG(LP&PROTECT&MCLRDIS&WDTEN);
#define PinSunDetIn GP0
#define PinGpsEnOut GP1
#define PinLedOut GP2
#define PinPpsIn GP3
bit?PpsBit;
bit?SunDetBit;
bit?PpsDelayBit;
unsigned?char?LedDelay;
unsigned?char?PpsNum;
unsigned?char?TimBit1;
unsigned?char?Second;
unsigned?char?Min;
unsigned?char?Num;
unsigned?char?PpsDelay;
void?main()
{
OPTION?=?0X04;
TRIS?=?0XF9;
if(PinSunDetIn)
{
PinGpsEnOut?=?1;
}
else
{
PinGpsEnOut?=?0;
}
Second?=?0;
Min =?0;
SunDetBit?=?0;
PpsDelayBit?=?0;
PpsBit?=?0;
LedDelay?=?0;
PpsNum?=?0;
while(1)
{
CLRWDT();
if((!SunDetBit)&&(PinSunDetIn))
{
PinGpsEnOut?=?1;
SunDetBit?=?1;
}
if(PinSunDetIn)
{
LedDelay?=?30;
}
//////////////////////////
評論
共有 條評論