//*APPLICATION NOTE E6000 ICEXPLORER ***************
//* Title: FOR colk_time www.55dianzi.com *
//* Version: 00 *
//* Last Updated: 2006.06.29 *
//* MCU: PIC16F72 *
//***************************************************
//****ROM PCLATH.D3=0 000H-7FFH ;
// PCLATH.D3=1 800H-FFFH ;
//***************************************************
//** RAM BANK0=20H---7FH STATUS RP0=0,RP1=0 *
//** BANK1=A0H---FFH STATUS RP0=1,RP1=0 *
//***************************************************
// __________________
// MCLR/VPP/TH-| 1 28 |-RB7/PGD
// RA0/AN0-| 2 27 |-RB6/PGC
// RA1/AN1-| 3 26 |-RB5
// RA2/AN2/VRref--| 4 25 |-RB4
// RA3/AN3/VRref+-| 5 24 |-RB3/PGM
// RA4/TOCKI-| 6 23 |-RB2
// RA5/AN4/SS-| 7 22 |-RB1
// VSS-| 8 21 |-RB0/INT
// OSC1/CLKIN-| 9 20 |-VDD
// OSC2/CLKOUT-| 10 19 |-VSS
// RC0/TISO/TICKI-| 11 18 |-RC7/RX/DT
// RC1/T1OSI/CCP2-| 12 17 |-RC6/TX/CK
// RC2/CCP1-| 13 16 |-RC5/SDO
// RC3/SCK/SCL-| 14 15 |-RC4/SDA
// |________________|
// 16F72
//***************************************************
#include <pic.h> //
#include <stdio.h> //
#include <math.h> //
#define uchar unsigned char //
#define uint unsigned int //
//------------------------------------------
#define KEY_UP RC1 //
#define KEY_DOWN RA4 //
#define KEY_SET RC2 // www.55dianzi.com
//------------------------------------------
void com_buf(void); //
void display(void); //
void buf_initial(void); //
void ad_program(void); //
void add_colk(void); //
void keywork1(void); //
void PORT_DATA(void); //
void sub_colk(void); //
void timr0int(void); //
void colk_stt(void); //
//------------------------------------------
static volatile unsigned char ADRES @ 0x1E;
static volatile unsigned char FLAG1 @ 0x20; //可位寻址的状态寄存器
static volatile bit SET @ (unsigned) &FLAG1 * 8 + 2; //
static volatile bit UP @ (unsigned) &FLAG1 * 8 + 1; //
static volatile bit DOWN @ (unsigned) &FLAG1 * 8 + 0; //
//----------------------------------------------------
static bit B_JIAN0,B_JIAN1,B_JIAN2,B_JIAN3,B_ON,B_OFF,B_BUF,B_ADD;
static bit B_DP,B_COM,B_END;//
unsigned char buf[4]; //
unsigned char k,data,sreg,disppoint,msec,sec,ad_buf,SEL,spbuf; //
unsigned char T_ON0,T_ON1,T_ON2,T_ON3,T_OFF0,T_OFF1,T_OFF2,T_OFF3; //
unsigned char colk0,colk1,colk2,colk3; //
unsigned int i,kcon1,kcon2,PORT_BUF; //
const char table[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xd8,0x80,0x90}; //
//*********************************
/*延时函数*/
//*********************************
void delay_10ms() //
{ uint j; //
[1] [2] [3] [4] [5] [6] [7] [8] 下一页
本文关键字:程序 定时器 PIC单片机,单片机-工控设备 - PIC单片机