?? program.c
字號:
//51單片機(jī)用的程序,有兩個,如下
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
unsigned long htod(unsigned long convdata)//將一個十六進(jìn)制數(shù)據(jù)轉(zhuǎn)換成十進(jìn)制數(shù)據(jù)
{ //十六進(jìn)制數(shù)據(jù)最大不能超過:0x05f5e0ff
unsigned long temp1,temp2;
unsigned char a1;
temp1=0;
a1=convdata/10000000;
temp1=a1;
temp1=temp1<<4;
temp2=convdata%10000000;
a1=temp2/1000000;
temp1 |=a1;
temp1=temp1<<4;
temp2=temp2%1000000;
a1=temp2/100000;
temp1 |=a1;
temp1=temp1<<4;
temp2=temp2%100000;
a1=temp2/10000;
temp1 |=a1;
temp1=temp1<<4;
temp2=temp2%10000;
a1=temp2/1000;
temp1 |=a1;
temp1=temp1<<4;
temp2=temp2%1000;
a1=temp2/100;
temp1 |=a1;
temp1=temp1<<4;
temp2=temp2%100;
a1=temp2/10;
temp1 |=a1;
temp1=temp1<<4;
a1=temp2%10;
temp1 |=a1;
return temp1;
}
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
unsigned long dtoh(unsigned long convdata)//將一個十進(jìn)制數(shù)據(jù)轉(zhuǎn)換為十六進(jìn)制數(shù)據(jù)
{
unsigned long temp;
temp=((convdata>>28)&0x0000000f)*10000000;
temp=temp+((convdata>>24)&0x0000000f)*1000000;
temp=temp+((convdata>>20)&0x0000000f)*100000;
temp=temp+((convdata>>16)&0x0000000f)*10000;
temp=temp+((convdata>>12)&0x0000000f)*1000;
temp=temp+((convdata>>8)&0x0000000f)*100;
temp=temp+((convdata>>4)&0x0000000f)*10;
temp=temp+(convdata&0x0000000f);
return temp;
}
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
// zxw36792116@hotmail.com
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -