anda boleh rujuk litar ini, dalam litar ini telah tersedia nilai komponen untuk anda memasangnya. Sebelum itu ada mesti membina PCB nya terlebih dulu. Paling mudah saya nasihatkan anda boleh guna software conveter circuit to pcb. Dibawah ini saya berikan pada anda software c ++ program untuk projek ini. Semoga berjaya.
#include#include void timer0int(void); char *Puts(char* str); float read_temp1(void); float read_temp1_filter(void); char cputick; char buffer[24]; char pulseE; char timer3; char temp; char vout; int x1,x2,x3,x4,x5; sbit RS=P1^6; sbit E =P1^4; sbit RW=P1^5; sbit CLK=P1^2; sbit Data=P1^1; sbit CS=P1^3; sbit CHG=P3^0; int readADC(char n) { int k; char i,channel; k=0; CS=0; if(n==0) channel= 0x0d; else channel=0x0f; for (i=0;i<4;i++) { CLK = 0; if(channel&8) Data =1; else Data = 0; CLK =1; channel <<=1; } Data = 1; CLK =0; for(i=0; i<12;i++) { k<<=1; CLK =1; CLK=0; if(Data) k|=1; else k &=~1; } CS =1; return k&=0xfff; } void timer0int(void) interrupt 1 using 1 { TH0 |=0xdc; cputick++; } pause(int j) { int i; for (i=0;i continue; } pulesE() { E =1; ; E =0; } void delay(int m) { int j; for(j=0;j<=m;j++) continue; } LCDWI (char n) { RW =0; RS=0; E =0; P0=n; E =1; E =0; pause(50); } LCDWD(char n) { RW=0; RS=1; E=0; P0=n; E=1; E=0; pause(50); } print_LCD(char a,char *s) { LCDWI(a); while(*s != 0) LCDWD(*s++); } i_LCD() { RS=0; E=0; P0=0x30;pulesE();delay(10);pulesE();delay(1);pulesE();delay(1); P0=0x20;pulesE();pulesE();pulesE(); LCDWI(0x38); LCDWI(0x0c); LCDWI(0x06); LCDWI(1); delay(50); } print_ADC() { char buffer[20]; if(++timer3<50) { timer3=0; sprintf(buffer,"%0.1fC %0.1fF",read_temp1_filter(),read_temp1_filter()*9/5+32); print_LCD(0xc0,buffer); } } int low_pass_filter1(void) { x5=x4; x4=x3; x3=x2; x2=x1; x1=readADC(0); return(x1+x2+x3+x4+x5)/5; } float read_temp1_filter(void) { return(0.0323*low_pass_filter1()-15.615); } void main() { i_LCD(); print_LCD(0x80,"LCD Thermometer"); TMOD |= 0x01; TR0 = 1; cputick = 0; EA = 1; ET0 = 1; for(;;) { while(!TF0) continue; TF0=0; print_ADC(); } }
Sekiranya anda ingin menempah projek ini, sila berhubung dengan saya. Terima kasih.
Nampak macam bahasa C bukan C++ cuba chek balik #@!
ReplyDeletenak tayela..ade x idea t0k wat pr0jek sensor..asap gtaw ea..
ReplyDelete