📄 pc668okls.bak
字号:
/*MAIN BOOT SECTION
BOOK1=DATASHTS\PHILIPS\P51_PG.PDF("80C51 Family Programmer's Guide")
BOOK2=DATASHTS\PHILIPS\P89C51Rx2xx_DS.PDF("Data Sheet")
CPU=IRAM(0-0xFF) IROM(0-0xFFFF) XRAM(0-0x2FF) CLOCK(33000000) MODP2
MON=S8051.DLL TP51.DLL("-p51R2")
REGFILE=REG51F.H("Philips")
SIM=S8051.DLL DP51.DLL("-p51R2")
//-------------------------------------------------------
8051 based CMOS controller with PCA, Dual DPTR, WDT,
32 I/O lines, 3 Timers/Counters, 7 Interrupts/4 Priority Levels,
64K Bytes ISP FLASH, 256 Bytes on-chip RAM, 768 Bytes XRAM
*/
#include <REG66x.h>
#include <stdio.h>
#include <math.h>
#include <absacc.h>
#include <string.h>
#include <intrins.h>
#include <ctype.h>
#include <stdlib.h>
//------------------------------------
#define uchar unsigned char /*宏定义*/
#define uint unsigned int
#define _Nop() _nop_() /*定义空指令*/
/* 地址定义 */
#define d_add XBYTE[0x8000]
#define c_add XBYTE[0x8200] /*[0x8100]*/
#define key_add XBYTE[0xc100]
#define led_add XBYTE[0xc000]
#define led_dd 0xc0;
/* 常数定义 */
#define para1 16;
#define keyyun 0x80; //键盘
#define keyting 0x40;
#define keyup 0x20;
#define keydown 0x04;
#define keyz 0x02;
#define P668 0x88;
#define P669 0x89;
#define keyy 0x01;
#define keyenter 0x10;
#define keyesc 0x08;
#define l161ram0 0; //4 断路器动作次数( 0-0x700)
#define l161ram1 16; //10+14 可编程输出定值
#define l161ram2 32; //10+16 可编程输入定值
#define l161ram3 48; //10+14 辅助保护定值
#define l161ram4 64; //10+22 显示系数
#define l161ram5 96; //10+14 参数定值
#define l161ram6 112; //电压修正
#define l161ram7 128; //电流修正
#define ledyun 0x40; //LED
#define ledtin 0x20;
#define ledshi 0x10; //LED
#define ledjin 0x08;
#define ledhdu 0x04; //LED
#define ledtdu 0x02;
#define ledzhg 0x01; //LED
#define ENDRDSLA 0xc0;
#define ENDWRSLA 0xa0;
#define WRSLA 0x60; //写从器件的总线状态字进入此状态后用RCVBYTE 取总线数据
#define RDSLA 0xa8;
//S0CONL DATA 98H
/* 定义标志位 */
sbit Acc_0=ACC^0;
sbit Acc_1=ACC^1;
sbit Acc_2=ACC^2;
sbit Acc_3=ACC^3;
sbit Acc_7=ACC^7;
sbit p1_2=P1^2;
sbit p2_7=P2^7;
sbit p1_4=P1^4; //背光
sbit p1_3=P1^3;
sbit SDA2=P3^5; /*模拟I2C 数据传送位*/
sbit SCL2=P3^4; /*模拟I2C 时钟控制位*/
/*状态标志*/
bit ack,I2cwr; /*应答标志位*/
bit shezhibiao=0;
bit tsbbb=0;
bit jiezhque=0;
bit keynew,enter,esc,miaobai,shibiao,ledshan;
bit yunbiao,tingbiao,up000,down000,lef000,trig000;
bit gucherror; //通讯过程失败
bit yunbiao1,tingbiao1;
unsigned char xdata thkonzi;
unsigned char xdata punjunzi;
unsigned char xdata rS0BUF[200];
unsigned char xdata tS0BUF[50];
unsigned char xdata b0buf[50];
unsigned int xdata b1buf[64];
unsigned int xdata pe1buf[11];
unsigned int xdata pe2buf[11];
uchar *w1161;
unsigned char xdata b2buf[8];
unsigned char xdata b3buf[100]; //用于通讯设置定值、参数
unsigned char xdata ram1buf[6];
unsigned char xdata ram2buf[8];
unsigned char xdata R2buf[100];//I2c接收数据
unsigned char xdata T2buf[100];
unsigned int xdata ramtemp1,ramtemp2,ramtemp3,ramtemp4,ramtemp5;
unsigned int xdata dettt1;
unsigned int xdata ptbian,ctbian;
unsigned char rS0BUFr,tS0BUFr,tS0BUFend;
unsigned char keytemp,keyzt1,keyzt,haomiao1,updown,leftright,keytime;
unsigned char menu1,chup,chdown,chleft,chright,chesc,chenter,secnum;
unsigned char code days_month[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
struct TIME
{
unsigned char sec;
unsigned char min;
unsigned char hour;
};
struct DATIE
{
unsigned int year;
unsigned char month;
unsigned char day;
};
struct TIME time;
struct DATIE date;
unsigned int O_X,O_Y,com,dat1,dat2;
unsigned int chart_add_l,chart_add_h;
unsigned char code_1,attr;
/******************************/
code unsigned char CGTAB[128]={ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // " "80
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, // 84
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F, // → 88
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x40,0x30,0x3C,0xFE,
0x3C,0x30,0x40,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x3F, // 三 8c
0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,
0x00,0x08,0xFC,0x00,0x00,0x00,0x10,0xF8,
0x00,0x00,0x00,0x00,0x04,0xFE,0x00,0x00
};
code unsigned char CCTAB[14][32]={ 0x20,0x22,0x3F,0x48,0x08,0xFF,0x10,0x14, // 智 0
0x22,0x42,0x9F,0x10,0x1F,0x10,0x1F,0x10,
0x00,0x04,0x7E,0x44,0x44,0xC4,0x44,0x7C,
0x44,0x10,0xF8,0x10,0xF0,0x10,0xF0,0x10,
0x10,0x10,0x24,0x44,0xFE,0x02,0x7C,0x44, // 能 1
0x7C,0x44,0x44,0x7C,0x44,0x44,0x54,0x48,
0x80,0x88,0x98,0xA0,0xC0,0x84,0x84,0x7C,
0x00,0x88,0x98,0xA0,0xC0,0x82,0x82,0x7E,
0x00,0x40,0x27,0x24,0x85,0x65,0x25,0x0D, // 测 2
0x15,0x25,0xE5,0x21,0x22,0x24,0x28,0x20,
0x00,0x44,0xE4,0x54,0x54,0x54,0x54,0x54,
0x54,0x54,0x54,0x04,0x84,0x44,0x54,0x08,
0x10,0x10,0x13,0x12,0xFC,0x10,0x15,0x18, // 控 3
0x30,0xD3,0x10,0x10,0x10,0x10,0x57,0x20,
0x40,0x20,0xFE,0x02,0x54,0x88,0x04,0x00,
0x08,0xFC,0x20,0x20,0x20,0x24,0xFE,0x00,
0x00,0x00,0x02,0x01,0x00,0x00,0x00,0x00, // 〉 4
0x00,0x00,0x00,0x01,0x02,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0x40,0x20,0x10,
0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x04, // 〈 5
0x08,0x04,0x02,0x01,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x40,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0x40,0x00,0x00,
0x00,0x00,0x01,0x01,0x03,0x03,0x07,0x07, // ▲ 6
0x0F,0x0F,0x1F,0x1F,0x3F,0x7F,0x00,0x00,
0x00,0x80,0xC0,0xC0,0xE0,0xE0,0xF0,0xF0,
0xF8,0xF8,0xFC,0xFC,0xFE,0xFF,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ▼ 7
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x06,0x1E,0x3F, // ← 8
0x1E,0x06,0x01,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x01,0x01,0x03,0x03,0x04,0x00, // ↑ 9
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x80,0xC0,0xC0,0xE0,0xE0,0x90,0x80,
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F, // → 10
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x40,0x30,0x3C,0xFE,
0x3C,0x30,0x40,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ↓ 11
0x00,0x04,0x03,0x03,0x01,0x01,0x00,0x00,
0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
0x80,0x90,0xE0,0xE0,0xC0,0xC0,0x80,0x00,
0x00,0x00,0x01,0x01,0x03,0x7F,0x3F,0x1F, // ★ 12
0x0F,0x07,0x0F,0x0F,0x1E,0x18,0x20,0x00,
0x80,0x80,0xC0,0xC0,0xE0,0xFF,0xFE,0xFC,
0xF8,0xF0,0xF8,0x78,0x3C,0x0C,0x02,0x00,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // " " 13
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
};
code unsigned char DTAB[38]={0x30,0x23,0,0x4c,0x4e,0x54,0x4c,0x4c,0x49,0x47, //PC Intelligent Measure & Control Devive
0x45,0x4e,0x54,0x00,0x2d,0x45,0x41,0x53,0x55,0x52,0x45,
0,0x06,0,0x23,0x4f,0x4e,0x54,0x52,0x4f,0x4c,0,0x24,
0x45,0x56,0x49,0x43,0x45};
code unsigned char DTAB1[256]={0x35,0x41,0x1d,0,0,0,0,0,0,0,0,0x36,0,0,0,0,
0x35,0x42,0x1d,0,0,0,0,0,0,0,0,0x36,0,0,0,0, //Ua Ub
0x35,0x43,0x1d,0,0,0,0,0,0,0,0,0x36,0,0,0,0,
0x35,0x4f,0x1d,0,0,0,0,0,0,0,0,0x36,0,0,0,0,
0x29,0x41,0x1d,0,0,0,0,0,0,0,0,0x21,0,0,0,0,
0x29,0x42,0x1d,0,0,0,0,0,0,0,0,0x21,0,0,0,0, //Ua Ub
0x29,0x43,0x1d,0,0,0,0,0,0,0,0,0x21,0,0,0,0,
0x29,0x4f,0x1d,0,0,0,0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,0x11,0x41,0,0,0,0,0,0,0,0,0,0,0,0,0,
0x30,0x11,0x42,0,0,0,0,0,0,0,0,0,0,0,0,0, //Ua Ub
0x30,0x11,0x43,0,0,0,0,0,0,0,0,0,0,0,0,0,
0x30,0x11,0x44,0,0,0,0,0,0,0,0,0,0,0,0,0,
0x30,0x11,0x45,0,0,0,0,0,0,0,0,0,0,0,0,0,
0x30,0x12,0x41,0,0,0,0,0,0,0,0,0,0,0,0,0, //Ua Ub
0x30,0x12,0x42,0,0,0,0,0,0,0,0,0,0,0,0,0,
0x30,0x12,0x43,0,0,0,0,0,0,0,0,0,0,0,0,0,
0x30,0x12,0x44,0,0,0,0,0,0,0,0,0,0,0,0,0,
0x30,0x12,0x45,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -