?? debug.c
字號:
#include <REG52.H>
#include "Debug.H"
xdata unsigned char hex[]={"0123456789ABCDEF"}; //為ascii-》hex的轉換表
/*
void DebugInit(void)
{
TMOD=0x21;
SCON=0x50;
TH1=0xfd;
TL1=0xfd ;
IP=0x10;
PCON|=0x80;
TR1=1;
EA=0;
ET0=0;
ES=0;
RI=0;
}
*/
unsigned char DebugSend(unsigned char de_data)
{
unsigned int Dtime=0;
SBUF=de_data;
do{
Dtime++;
if(Dtime>1000)
return 1;
}while(!TI);
TI=0;
return 0;
}
void Debughex(unsigned char senddata)
{
unsigned char ch;
ch=senddata>>4;
DebugSend(hex[ch]);
ch=senddata&0x0f;
DebugSend(hex[ch]);
}
void DebugString(unsigned char *string)
{
while(*string!=0)
{
DebugSend(*string);
string++;
}
}
void DebugData(unsigned int length,unsigned char x,unsigned char *buff)
{
unsigned int i=0,j=0;
unsigned int pos=0;
unsigned char temp;
for(i=0;i<length/x;i++)
{
for(j=0;j<x;j++)
{
temp=buff[pos];
Debughex(temp);
temp<<=2;
DebugString(" ");
pos++;
}
DebugString("\r\n");
}
for(i=0;i<(length%x);i++)
{
Debughex(buff[pos]);
DebugString(" ");
pos++;
}
DebugString("\r\n");
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -