1. 單片機 自製一個單片機最小系統,包括串口下載、復位電路,
1個位元組的壓縮BCD碼(2位)指的是用1個位元組(8位)二進制數來表位二位十進制數
每位十進制數佔4位 可表示0范圍到15, 但舍棄10-15的無效數據
這樣原本可以表示0到255的數,現在只能表示0到99
分離也很簡單,假設這個BCD數存於變數A中,個位就是 A&0X0F
十位就 是(A>>4)&0X0F 或直接(A>>4) 高4位被補0了
2. 51單片機有沒有什麼最簡單的diy小設計
51單片機往哪裡記錄?
在淘寶上買GPS模塊的時候,大部分商家會給你一些資料。包括PC機用的軟體,和51單片機採用12864LCD顯示的源碼。
3. 懂單片機的過來看看,要你設計一個基於單片機的作品是什麼意思啊 !!!
基於單片機的作品很多啊~關鍵是你知不知道單片機是什麼啊?簡單的單片機作品上網一搜一大堆,滿大街都是~
4. 單片機8051設計簡易波形發生器,要求能產生正弦波,方波,三角波,通過鍵盤可改變輸出信號的頻率和幅度
這個網上資料很多的,你可以參考下的,我前幾天也做了個,proteus模擬的,程序如下,希望能幫到你的,有問題可以交流下的
#include<reg51.h>
unsigned char i,sqar_num=128; //最大值100,默認值50
unsigned char cho=0; //0:正弦波。1:方波。2:三角波。3:鋸齒波。
unsigned char num=0;
unsigned char TIME0_H=0xff,TIME0_L=0xdc; //定時器0的初值設置;全局變數.對應正弦波,鋸齒波50HZ
sbit chg= P1^0;
sbit freq_u=P1^1;
sbit freq_d=P1^2;
sbit ty_u=P1^3;
sbit ty_d=P1^4;
sbit cs =P3^7;
bit flag=0;
unsigned int FREQ=50;//初始化頻率,30HZ
unsigned char flag1;
sbit rs=P1^5;
sbit lcdcs=P1^7;
sbit cd=P3^0;
unsigned char TempBuffer[7];
unsigned char value1[]={"Frequency:"};
void delay(unsigned int ms)
{
unsigned int i,j;
for (j=0;j<ms;j++)
for (i=0;i<120;i++);
}
unsigned char code sin_num[]={
0x80,0x82,0x85,0x88,0x8b,0x8e,0x91,0x94,0x97,0x9a,0x9d,0xa0,0xa3,0xa6,
0xa9,0xac,0xaf,0xb2,0xb6,0xb9,0xbc,0xbf,0xc2,0xc5,0xc7,0xca,0xcc,0xcf,
0xd1,0xd4,0xd6,0xd8,0xda,0xdd,0xdf,0xe1,0xe3,0xe5,0xe7,0xe9,0xea,0xec,
0xee,0xef,0xf1,0xf2,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,
0xfd,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xfe,0xfd,0xfd,0xfc,0xfb,0xfa,0xf9,0xf8,0xf7,0xf6,0xf5,0xf4,0xf2,0xf1,
0xef,0xee,0xec,0xea,0xe9,0xe7,0xe5,0xe3,0xe1,0xde,0xdd,0xda,0xd8,0xd6,
0xd4,0xd1,0xcf,0xcc,0xca,0xc7,0xc5,0xc2,0xbf,0xbc,0xba,0xb7,0xb4,0xb1,
0xae,0xab,0xa8,0xa5,0xa2,0x9f,0x9c,0x99,0x96,0x93,0x90,0x8d,0x89,0x86,
0x83,0x80,
0x80,0x7c,0x79,0x76,0x72,0x6f,0x6c,0x69,0x66,0x63,0x60,0x5d,
0x5a,0x57,0x55,0x51,0x4e,0x4c,0x48,0x45,0x43,0x40,0x3d,0x3a,0x38,0x35,
0x33,0x30,0x2e,0x2b,0x29,0x27,0x25,0x22,0x20,0x1e,0x1c,0x1a,0x18,0x16,
0x15,0x13,0x11,0x10,0x0e,0x0d,0x0b,0x0a,0x09,0x08,0x07,0x06,0x05,0x04,
0x03,0x02,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x01,0x02,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,
0x0d,0x0e,0x10,0x11,0x13,0x15,0x16,0x18,0x1a,0x1c,0x1e,0x20,0x22,0x25,
0x27,0x29,0x2b,0x2e,0x30,0x33,0x35,0x38,0x3a,0x3d,0x40,0x43,0x45,0x48,
0x4c,0x4e,0x51,0x55,0x57,0x5a,0x5d,0x60,0x63,0x66,0x69,0x6c,0x6f,0x72,
0x76,0x79,0x7c,0x80
/* 135,145,158,167,176,188,199,209,218,226,234,240,245,249,252,254,254,253,251,247,243,237,230,222,213,204,193,182,170,158,
146,133,121,108,96,84,72,61,50,41,32,24,17,11,7,3,1,0,0,2,5,9,14,20,28,36,45,55,66,78,90,102,114,128
*/
};
unsigned code sanjiao_num[]=
{
0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,
36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,
70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,
104,106,108,110,112,114,116,118,120,122,124,126,128,130,
132,134,136,138,140,142,144,146,148,150,152,154,158,160,162,164,166,168,170,
172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,208,210,
212,214,216,218,220,222,224,226,228,230,232,234,236,238,240,242,244,246,248,250,
252,254,255,254,252,250,248,246,244,242,240,238,236,234,232,230,228,226,224,222,220,
218,216,214,212,210,208,206,204,202,200,198,196,194,192,190,188,186,184,182,180,178,
176,174,172,170,168,166,164,162,160,158,154,152,150,148,146,144, 142,140,138,136,134,
132,130,128,126,124,122,120,118,116,114,112,110,108,106,104,102,100,98,96,94,92,90,88,
86,84,82,80,78,76,74,72,70,68,66,64,62,60,58,56,54,52,50,48,46,44,42,40,38,36,
34,32,30,28,26,24,22,20,18,16,14,12,10,8,6,4,2,0,
};
//調節部分——頻率
void freq_ud(void)
{
unsigned int temp;
if(freq_d==0)
{ FREQ--; }
else if(freq_u==0)
{ FREQ++; }
temp=0xffff-3906/FREQ; //切換後頻率為50HZ 65336-10^6/(256*FREQ)
// temp=0xffff-1953/FREQ;
TIME0_H=temp/256;
TIME0_L=temp%256;
}
//調節部分——方波的占空比
void ty_ud(void) //方波也採用512次中斷構成一個周期。
{
if(ty_d==0&sqar_num>0)
sqar_num--;
else if(ty_u==0&sqar_num<255)
sqar_num++;
}
//波形發生函數
void sint(void)
{
// char num=0;
// if(!flag)
{
cs=0;P2=sin_num[num++];cs=1;
if(num==255){num=0;}
}
/* else if(flag)
{
cs=0;P2=sin_num[num--];cs=1;
if(num==0){num=0;flag=0;}
} */
}
void square(void)
{
if(i++<sqar_num) {cs=0;P2=0XFF;cs=1;}
else{cs=0;P2=0X00;cs=1;}
}
void triangle(void)
{
cs=0;P2=num++;cs=1;
}
void stw(void)
{
cs=0;P2=sanjiao_num[num++];cs=1;
if(num==255){num=0;flag=1;}
}
//1602顯示開始
void write_command(unsigned char command)
{
rs=0;
P0=command;
lcdcs=1;
lcdcs=0;
}
void write_data(unsigned char data0)
{
rs=1;
P0=data0;
lcdcs=1;
lcdcs=0;
}
void init_1602()
{
delay(1);
write_command(0x38);
delay(1);
write_command(0x0c);
delay(1);
write_command(0x06);
delay(1);
}
//1602顯示結束
/*******************頻率值轉換為字元串**********************/
void temp_to_str()
{
TempBuffer[0]=FREQ/1000+'0'; //千位
TempBuffer[1]=FREQ%1000/100+'0'; //百位
TempBuffer[2]=FREQ%1000%100/10+'0';//十位
TempBuffer[3]=FREQ%1000%100%10+'0';//個位
TempBuffer[4]='H';
TempBuffer[5]='Z';
TempBuffer[6]='\0';
}
void main()
{
TMOD=0X01;
TH0=0xff;
TL0=0xd9;
IT0=1; //設置中斷觸發方式,下降沿
EA=1;
EX0=1;
ET0=1;
IP=0X01; //鍵盤中斷級別高
init_1602();//初始化lcd
write_command(0x80);//液晶顯示位置
delay(1);
for (i=0;i<sizeof(value1)-1;i++)
{
write_data(value1[i]);
delay(1);
}
TR0=1;
while(1)
{
show_frequency();
}
}
5. 單片機電子作品DIY比賽
數字直流電壓源的設計,你可以參考下
6. 51單片機能DIY哪些小東西
51單片機能DIY:
1.
多功能時鍾,秒錶,報警器,計數器,紅外門禁檢測,密碼門;
2.
計算器,能想到的東西都可以啊,還有溫濕度等付感器相關的;
3.
或者電壓表,電流表,測電阻的,測電容電感的,無線通信類的東西,或者電源逆變之類的;
4.
還有機械控制電機之類的。
7. 我是單片機的初學者,想自製一個基於ISP的89S52單片機的下載器,誰能給個原理圖或是PCB非常感激。
你說的我知道,是AT系列的,支持USB-ISP下載,介面和AVR的ISP是一樣的,用mega8做的,STC用的是串口下載,能用到你的232,但是下載過程比較麻煩,開電源關電源的。你要是要的話我有51的USB下載線,AVR的USB-ISP,和AT通吃的USB-ISP的原理圖驅動程序和固件,免費給你提供哦,郵箱請求就OK:[email protected]加分哦
8. 怎麼製作一個diy手工單片機
DIY單片機!!! 你真是神一樣的存在。
樓上,FPGA的資源都要用不少呢,要多少74系列IC呢?ATLRA的一個LE可能就要一片74了。
為何叫單片機,因為集成了運算器,輸入輸出設備,存儲設備。 要把這些結合在一起,用分立原件是不現實的。
9. 創意DIY:僅憑單片機和電感器,怎麼實現升壓電路
難道不要功率放大器件和二極體嗎?靠單片機輸出的毫安級電流升壓後就更小了。
簡單的升壓辦法是,單片機輸出高占空比的脈沖,驅動三極體,高電平時給電感線圈充電,低電平時向外放電,即並聯型開關電源。
10. 如何給單片機diy作品做一個精美的外殼包裝
用CAD畫圖,用雕刻機雕一個