B码对时资料


B码对时资料,多个资料,很有用的,大家共同学习
资源截图
代码片段和文件信息


#include 

#define UINT8  unsigned char
#define UINT16  unsigned int

sbit B_IN=P4^3;
sbit B_SS=P1^7;

UINT8 Bcode[89]i=0;  //RAM for the coment decoded form IRIG-B100 in 1s
UINT8 sec=0min=0hour=0;  //clock time to display in segment
UINT8 ppn;
bit flag=0pr=0;  //B-code valid flagif B-code‘s exist is ascerstainedthen set 

UINT8 code COM[6]={0x010x020x040x080x100x20}; //段选码-时分秒
UINT8 code SEG[10]={0x030x9f0x250x0d0x990x490x410x1f0x010x09}; //0-9的字型码

void InitSYS()
{
IP=0x80;
// AUXR=0x11;
// BRT=0xfc;
// SCON=0x50;
TMOD=0x11;    //both time0 time1 as 16-bit timer
TH0=0x00;
TL0=0x00;

TH1=0xf8;
TL1=0xcd; //2ms
TR1=1; //enable timer1 2ms interrupt  

IT0=1; //INT0 posedge trig

// ES=1;
EA=1;
}

void InitPCA()
{
AUXR1=0x40; //P1.3 transist to P4.3
CCON=0x00; //stop timerclear all flag
CMOD=0x00; //Fosc/12disable timer overflow
CCAPM1=0x31; //PCA module 1 capture as a transtion occours
CL=0;
CH=0;
CR=1; //enable all interrupt
}

/*void send(UINT8 serial_data)
{
SBUF=serial_data;
while(!TI) ;
TI=0;
}
*/
void INT0_int() interrupt 0  //clock generated by 1pps from B-code
{
sec++;
if(sec>=60) {sec=0;min++;}
if(min>=60) {min=0;hour++;}
if(hour>=24){hour=0;}
}

void Timer1_int() interrupt 3
{
UINT8 j;  //0-5just for scan

TH1=0xf8;
TL1=0xcd; //2ms

P2=COM[j];

switch(j)
{
case 0: P0=SEG[sec/10]; break;
case 1: P0=SEG[sec%10]; break;
case 2: P0=SEG[min/10]; break;
case 3: P0=SEG[min%10]; break;
case 4: P0=SEG[hour/10];break;
case 5: P0=SEG[hour%10];break;
default: break;
}
j++;
if(j>=6) j=0;
}

void PCA_int() interrupt 7
{
CCF1=0;

if(B_IN)  //posedge
{
TR0=1;
}
if(!B_IN)    //negedgeIRIG-B decoder and storage
{
TR0=0; //stop timer0.

if((TH0>0x25)&&(TH0<0x27)) //8ms
{
p=2;
if(i==0) B_SS=0;
if(pn==2) {i=0;pr=1;}
}
else if((TH0>0x17)&&(TH0<0x19)) p=1;  //5ms
else if((TH0>0x08)&&(TH0<0x10)) p=0; //2ms
if((p==1)||(p==0))
{
Bcode[i]=p;
i++;
}
if(pr)
{
if(i==10) B_SS=1;
if(i==30) flag=1; //IRIG-B code existsthen set the flagonly need the first clock timeso the others are passed by
if(i==88) pr=0;   //precede set 11s is overthe new pps will begin
}
if(i>=89) i=0;    
pn=p;

TH0=0x00;
TL0=0x00;


/*
if((TH0>0x25)&&(TH0<0x27)) //8ms
{
p=2;
if(pn==2) {i=0;pr=1;}
}
else if(TH0<0x20)
{
p=1;
Bcode[i]=TH0;
i++;
}
if(pr)
{
if(i==10) B_SS=1;
if(i==30) flag=1; //IRIG-B code existsthen set the flagonly need the first clock timeso the others are passed by
if(i==88) {B_SS=0;pr=0;}   //precede set 11s is overthe new pps will begin
}    
pn=p;

if(p==1) {send(i);send(Bcode[i]);}
TH0=0x00;
TL0=0x00;
}
*/
}

void main()
{
InitSYS();
InitPCA();
B_SS=1;

while(!flag

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     649126  2012-06-29 08:57  B码对时+B+码对时.pdf

     文件       3579  2011-08-23 13:47  B码对时B-decoder1.c

     文件      96768  2012-06-29 09:01  B码对时FPGA_CPLD数字时钟的实现(原代码).doc

     文件     330070  2009-12-29 11:08  B码对时IRIG Serial Time Code Formats.pdf

     文件      74657  2009-12-22 16:42  B码对时IRIG-B.pdf

     文件     200192  2012-06-28 16:33  B码对时IRIG-B格式时间码解码接口卡电路设计.doc

     文件     349696  2012-06-29 08:59  B码对时IRIG-B码校时、对时_DCS、PLC对时.doc

     文件     742194  2012-06-28 16:50  B码对时IRIG-B解码芯片说明书(v1.12).pdf

     文件     145207  2012-06-29 09:02  B码对时在变电站智能设备中实现B码对时.pdf

     文件     144000  2012-06-29 09:01  B码对时基于CPLD的IRIG—B码解码器的设计.pdf

     目录          0  2012-07-04 10:36  B码对时

----------- ---------  ---------- -----  ----

              2735489                    11


版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)