?? 51無防真器下內存監測程序.txt
字號:
用【 小 | 中 | 大 】字體瀏覽
C51編程:提供51無防真器下內存監測程序(pc軟件為"超級終端") [wxky] [42次] 01-11-13 下午 03:19:05
#include "REG52.H"
#include "stdio.h"
#include "string.h"
#define ESC "\033"
#define CSI ESC"["
/* 前景色 */
#define BLK ESC"[30m" /* 黑色 */
#define RED ESC"[31m" /* 紅色 */
#define GRN ESC"[32m" /* 綠色 */
#define YEL ESC"[33m" /* 黃色 */
#define BLU ESC"[34m" /* 藍色 */
#define MAG ESC"[35m" /* 紫色 */
#define CYN ESC"[36m" /* 青色 */
#define WHT ESC"[37m" /* 白色 */
/* 加強前景色 */
#define HIR ESC"[1;31m" /* 亮紅 */
#define HIG ESC"[1;32m" /* 亮綠 */
#define HIY ESC"[1;33m" /* 亮黃 */
#define HIB ESC"[1;34m" /* 亮藍 */
#define HIM ESC"[1;35m" /* 亮紫 */
#define HIC ESC"[1;36m" /* 亮青 */
#define HIW ESC"[1;37m" /* 亮白 */
/* 加強背景色 */
#define HBRED ESC"[41;1m" /* 亮紅 */
#define HBGRN ESC"[42;1m" /* 亮綠 */
#define HBYEL ESC"[43;1m" /* 亮黃 */
#define HBBLU ESC"[44;1m" /* 亮藍 */
#define HBMAG ESC"[45;1m" /* 亮紫 */
#define HBCYN ESC"[46;1m" /* 亮青 */
#define HBWHT ESC"[47;1m" /* 亮白 */
/* 背景色 */
#define BBLK ESC"[40m" /*黑色 */
#define BRED ESC"[41m" /*紅色 */
#define BGRN ESC"[42m" /*綠色 */
#define BYEL ESC"[43m" /* 黃色 */
#define BBLU ESC"[44m" /*藍色 */
#define BMAG ESC"[45m" /*紫色 */
#define BCYN ESC"[46m" /*青色 */
#define NOR ESC+"[2;37;0m" /* 返回原色 */
#define BOLD ESC"[1m" /* 打開粗體 */
#define CLR ESC"[2J" /* 清屏 */
#define HOME ESC"[H" /* 發送光標到原處 */
//#define REF CLRHOME /* 清屏和清除光標 */
#define BIGTOP ESC"#3" /* Dbl height characters, top half */
#define BIGBOT ESC"#4" /* Dbl height characters, bottem half */
#define SAVEC ESC"[s" /* Save cursor position */
#define REST ESC"[u" /* Restore cursor to saved position */
#define SINGW ESC"#5" /* Normal, single-width characters */
#define DBL ESC"#6" /* Creates double-width characters */
#define FRTOP ESC"[2;25r" /* 凍結首行 */
#define FRBOT ESC"[1;24r" /* 凍結底部一行 */
#define UNFR ESC"[r" /* 首行和底部一行解凍 */
#define BLINK ESC"[5m" /* 不斷閃亮模式 */
#define U ESC+"[4m" /* 下劃線模式 */
#define REV ESC"[7m" /* 打開反白模式 */
#define HIREV ESC"[1,7m" /* 亮色彩反白顯示 */
sbit T2MOD =0xC9;
#define uchar unsigned char
#define uint unsigned int
#define ulong unsigned long
char i_su;
char buff[21];
char code m1[]="***** 89C52 mem serial monitor ! ***** |WXKY|\n\r";
void Send(uchar buff)
{
SBUF =buff;
while(!TI);
TI =0;
}
void sco_msg(char *strg)
{
while(*strg!='\0')
{
Send(*strg);
strg++;
};
}
void receive(void) interrupt 4
{ if(RI)
{
RI =0;
buff[i_su] =SBUF;
if(i_su<=20){i_su++;}else{i_su=0;};
};
}
void main(void)
{
char i,ii;
char data *point;
char tmp;
SCON =0x50; //WORK WITH MODE ONE
TMOD =0x11;
T2CON =0x30;
T2MOD =0x01;
TH2 =0xFF; //9600BPS
TL2 =0xDC;
RCAP2H =0xFF;
RCAP2L =0xDC;
T2CON =0x34;
ET2 =0;
EA =1;
ES =1;
sco_msg(UNFR);
sco_msg(CLR);
sco_msg(DBL);
sco_msg(FRTOP);
sco_msg(BLINK);
sco_msg(m1);
sco_msg(ESC"[0m");
sco_msg(SAVEC);
sco_msg(HBGRN);
while(1)
{
point=0;
for(i=0;i<8;i++)
{
for(ii=0;ii<16;ii++)
{
tmp =*point;
tmp >>=4;
tmp &=0x0f;
if(tmp>9){tmp+='0'+7;}else{tmp+='0';};
Send(tmp);
tmp =*point;
tmp &=0x0f;
if(tmp>9){tmp+='0'+7;}else{tmp+='0';};
Send(tmp);
Send(' ');
point++;
};
Send('\n');
Send('\r');
};
sco_msg(REST);
};
}
我想用在592上也是一樣的吧! [wxky] [3次] 01-11-13 下午 04:58:05
點擊這里回復這篇貼子>>
_____________________________________________________________________________
Copyright?,C51BBS論壇 2000-2002
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -