PIC Vietnam

Go Back   PIC Vietnam > Các Đề Tài > Các dự án mã nguồn mở

Tài trợ cho PIC Vietnam
Trang chủ Đăng Kí Hỏi/Ðáp Thành Viên Lịch Bài Trong Ngày Vi điều khiển

Các dự án mã nguồn mở Nếu bạn không mở mã nguồn, ít nhất là một phần nào đó trong dự án của bạn, xin đừng vào đây.

 
 
Ðiều Chỉnh Xếp Bài
Prev Previous Post   Next Post Next
Old 31-07-2012, 05:58 PM   #10
mrtddiep
Nhập môn đệ tử
 
Tham gia ngày: May 2009
Bài gửi: 8
:
moi nguoi oi giup minh voi ! minh dang viet chuong trinh bang ccs cho pic16f877a doc nhiet do tu ds18b20 hien thi len lcd 16x2 .ma khong the nao doc nhiet do tu ds18b20 duoc luc nao lcd cung hien thi 84 ma minh tang giam ds18b20 thi tren lcd van khong thay doi. minh cung lam mach that va mo phong tren protues nhung ket qua nhu nhau thoi,cao thu nao xem giup minh sai cho nao voi ?. minh up code va mo phong o link duoi.
http://www.mediafire.com/?ood3ibt0qd1j3iw
#include <16F877A.h>
#fuses XT,NOWDT,NOPROTECT,NOLVP
#device adc=16
#include <lcd420.c>
#include <math.h>
#define dp pin_c0
#use delay(clock=4000000)

//---------reset--------------
void reset()
{
output_low(dp);
delay_us(500);
output_float(dp);
delay_us(500);
}

//-------------------------read----------------------
int read()
{
int a,data;
for(a=0;a<8;a++)
{
output_low(dp);
delay_us(10);
shift_right(&data,1,input(dp));
delay_us(45);
output_float(dp);
delay_us(2);
}
return(data);
}

//----------------------write-----------------------------
void write(int data)
{
int a;
for(a=0;a<8;a++)
{
set_tris_c(0x00);
output_low(dp);
delay_us(15);
output_bit(dp, shift_right(&data,1,0));
delay_us(45);
output_float(dp);
delay_us(2);
}
}
//---------------------chuong trinh chinh-------------------
void main()
{
int8 data,tem1,tem2,busy=0;
int16 temp;
float t;
reset();
write(0xcc);
write(0x44);
delay_ms(1000);
while(busy==0)
busy=read();
reset();
write(0xcc);
write(0xbe);
tem1=read();
tem2=read();
temp=make16(tem2,tem1);
temp=temp>>4;
t=(float)(temp);
while(true)
{
lcd_init();
lcd_gotoxy(1,2);
t=(int8)floor(t);
printf(lcd_putc,"%x",t);
delay_ms(1000);
}
}
mrtddiep vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
 


Quyền Sử Dụng Ở Diễn Ðàn
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Mở
Smilies đang Mở
[IMG] đang Mở
HTML đang Tắt

Chuyển đến


Múi giờ GMT. Hiện tại là 02:21 PM.


Được sáng lập bởi Đoàn Hiệp
Powered by vBulletin®
Page copy protected against web site content infringement by Copyscape
Copyright © PIC Vietnam