Board logo

标题: [更新!]数字温度计DS18B20内带原理图,程序(更新为C语言,见后面) [打印本页]

作者: zcllom    时间: 2006-4-23 11:16     标题: [更新!]数字温度计DS18B20内带原理图,程序(更新为C语言,见后面)

[此贴子已经被作者于2008-10-16 21:51:53编辑过]


作者: zcllom    时间: 2006-4-23 11:24

此处的图片链接已经失效,大家看后面的跟贴

[此贴子已经被作者于2008-12-16 17:59:55编辑过]


作者: zcllom    时间: 2006-4-23 11:27

别客气---下载数字温度计:

http://bbs.chinaecnet.com/uploadImages/ShuZiWenDuJi.rar

后面有更新的,大家下后面那个!

[此贴子已经被作者于2008-12-16 18:04:23编辑过]


作者: xwjj    时间: 2006-12-21 15:06


作者: zcllom    时间: 2008-10-12 20:38     标题: DS18B20测温

2IjpR5ge.png


图片附件: [[更新!]数字温度计DS18B20内带原理图,程序(更新为C语言,见后面)] 2IjpR5ge.png (2008-10-12 20:19, 10.19 KB) / 下载次数 704
http://bbs.eccn.com/attachment.php?aid=5235&k=773d47fab56b458e3851f15cdf476c56&t=1715131098&sid=f20mw7


作者: zcllom    时间: 2008-10-12 20:41

proteus仿真+C语言源代码+详尽的程序注解(需要的!不用回复了!:)):

QVUdmQjd.rar (63.3 KB)

[此贴子已经被作者于2008-12-16 18:01:39编辑过]



附件: [[更新!]数字温度计DS18B20内带原理图,程序(更新为C语言,见后面)] A3K1mGS3.rar (2008-10-12 20:22, 64.06 KB) / 下载次数 1144
http://bbs.eccn.com/attachment.php?aid=5236&k=c900821dab23d0cb8cf5e443725e2f47&t=1715131098&sid=f20mw7

附件: ksmMegZZ.rar (2008-12-12 16:07, 63.39 KB) / 下载次数 775
http://bbs.eccn.com/attachment.php?aid=5861&k=0bf9c78fbd22acb458cf84c652e69a89&t=1715131098&sid=f20mw7

附件: QVUdmQjd.rar (2008-12-16 17:42, 63.3 KB) / 下载次数 839
http://bbs.eccn.com/attachment.php?aid=5938&k=fdf16d65d70b3b3740413501c4ff79c1&t=1715131098&sid=f20mw7
作者: king200811    时间: 2008-10-15 17:15

来看看


作者: zcllom    时间: 2008-10-16 21:53

大家下后面的那个就行了,前面那个是汇编的,估计没人有心情看了吧,后面个C。
作者: 冰封雪剑    时间: 2008-10-20 17:10

dingyixia ~~~~~~~~~~~~~~
作者: 伍峰    时间: 2008-10-22 09:21

学习一下。


作者: se7ven1225    时间: 2008-11-4 10:13

支持啊!!!
作者: zhaoyi19860927    时间: 2008-11-5 22:39

ddddddd
作者: lj53080    时间: 2008-11-11 20:32

等的很急


作者: lj53080    时间: 2008-11-11 20:44

谢谢
作者: zcllom    时间: 2008-11-11 20:55

等的很急

===============================

到了要用的时候才来找,当然急了


作者: lj53080    时间: 2008-11-12 16:07

我下了你的C程序怎么在我的keil51上运行不了

我是才开始学的

麻烦高手指点一下.谢谢!

下面的程序在这个仿真图上运行是在什么问题??

图片点击可在新窗口打开查看

#include <reg51.h>
#include <intrins.h>

#define uint unsigned int
#define uchar unsigned char

sbit DQ=P3^3;

uint lp,hp,a,b,shi,ge,xs;

void Delay(uint num);
DS18B20_init(void);
eadOneChar(void) ;
WriteOneChar(uchar dat) ;
Read_Temperature(void);
Disp_Temperature() ;
void Delay1mS(unsigned int tt);


uchar code LEDData[] = {0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};

bit flag_init=0;


void main(void)
{

DS18B20_init();
while(1)
{
Read_Temperature();
Disp_Temperature();

}

}


DS18B20_init(void)
{
flag_init=1;
DQ = 1;
_nop_();

DQ = 0;
Delay(52);

DQ= 1;
Delay(5);

flag_init= DQ;
Delay(25);
}


Readonechar(void)
{
uchar i = 0;
uchar dat = 0;
for (i = 8; i > 0; i--)
{
DQ = 0;
dat >>= 1;
DQ = 1;

if(DQ)
dat |= 0x80;
Delay(5);
}
return (dat);
}

WriteOneChar(uchar dat)
{
uchar i = 0;
for (i = 8; i > 0; i--)
{
DQ = 0;
DQ = dat&0x01;
Delay(5);

DQ = 1;
dat>>=1;
}
}

Read_Temperature(void)
{

DS18B20_init();
WriteOneChar(0xcc);
WriteOneChar(0x44);
DS18B20_init();
WriteOneChar(0xcc);
WriteOneChar(0xbe);

lp=Readonechar();
hp=Readonechar();

 hp<<=8;
hp|=lp;
a=hp*625/10000;
b=a*10+5/10;

shi=b/100;
ge=b/10%10;
xs=b%10;

}


Disp_Temperature()
{
P2=0xfe;
P0=LEDData [shi];
Delay1mS(5);
P2=0xfd;
P0=LEDData [ge]|0x80;
Delay1mS(5);
P2=0xfb;
P0=LEDData [xs];
Delay1mS(5);
}


void Delay1mS(unsigned int tt)
{
unsigned char i;
while(tt--)
{
for(i=113;i>0;i--);
}
}


void Delay(uint num)
{
while( --num );
}



作者: zcllom    时间: 2008-11-12 16:16

在keilc51上运行不了?不会的,它提示什么错误,你把它贴出来
作者: lj53080    时间: 2008-11-12 16:41

Build target 'Target 1'
compiling Delay.C...
compiling DS18B20.C...
..\DS18B20_S\DS18B20.C(2): error C202: 'P3': undefined identifier
..\DS18B20_S\DS18B20.C(10): error C202: 'DQ': undefined identifier
..\DS18B20_S\DS18B20.C(12): error C202: 'DQ': undefined identifier
compiling 测温.c...
..\ds18b20_s\测温.c(1): warning C318: can't open file 'REGX51.H'
..\DS18B20_S\DS18B20.C(2): error C202: 'P3': undefined identifier
..\DS18B20_S\DS18B20.C(10): error C202: 'DQ': undefined identifier
..\DS18B20_S\DS18B20.C(12): error C202: 'DQ': undefined identifier
..\DS18B20_S\DS18B20.C(14): error C202: 'DQ': undefined identifier
..\DS18B20_S\DS18B20.C(16): error C202: 'DQ': undefined identifier
..\DS18B20_S\DS18B20.C(25): error C202: 'DQ': undefined identifier
..\DS18B20_S\DS18B20.C(27): error C202: 'DQ': undefined identifier
..\DS18B20_S\DS18B20.C(28): error C202: 'DQ': undefined identifier
..\DS18B20_S\DS18B20.C(40): error C202: 'DQ': undefined identifier
..\DS18B20_S\DS18B20.C(41): error C202: 'DQ': undefined identifier
..\DS18B20_S\DS18B20.C(43): error C202: 'DQ': undefined identifier
..\DS18B20_S\测温.C(8): error C202: 'P2': undefined identifier
..\DS18B20_S\测温.C(9): error C202: 'P0': undefined identifier
..\DS18B20_S\测温.C(11): error C202: 'P2': undefined identifier
..\DS18B20_S\测温.C(12): error C202: 'P0': undefined identifier
..\DS18B20_S\测温.C(14): error C202: 'P2': undefined identifier
..\DS18B20_S\测温.C(15): error C202: 'P0': undefined identifier
Target not created
作者: lj53080    时间: 2008-11-12 16:45

他出现这些怎么回事?

我大部分按你写的我写的前面发的那个程序

但仿真时显示的数字不动

麻烦你给我看下

谢谢

我才学几个星期很多都不知道


作者: zcllom    时间: 2008-11-12 16:56

你应该打开工程文件.Uv2


作者: zcllom    时间: 2008-11-12 17:00

还有就是你的UV2设置应该要搞成正确的


作者: lj53080    时间: 2008-11-12 17:10

我把下的程序写到一起

把#include<REGX51.H>改成##include<reg51.h>

就只出现

".\测温.obj"
TO "temp_test"
*** FATAL ERROR L210: I/O ERROR ON INPUT FILE:
EXCEPTION 0021H: PATH OR FILE NOT FOUND
FILE: F:\KC51\C51\LIB\C51FPS.LIB
Target not created

不改就出现上面的那些错误


作者: zcllom    时间: 2008-11-12 17:13

Build target 'Target 1'
compiling Delay.C...
compiling DS18B20.C...
..\DS18B20_S\DS18B20.C(2): error C202: 'P3': undefined identifier
..\DS18B20_S\DS18B20.C(10): error C202: 'DQ': undefined identifier
..\DS18B20_S\DS18B20.C(12): error C202: 'DQ': undefined identifier
compiling 测温.c...
..\ds18b20_s\测温.c(1): warning C318: can't open file 'REGX51.H'
..\DS18B20_S\DS18B20.C(2): error C202: 'P3': undefined identifier
..\DS18B20_S\DS18B20.C(10): error C202: 'DQ': undefined identifier
..\DS18B20_S\DS18B20.C(12): error C202: 'DQ': undefined identifier
..\DS18B20_S\DS18B20.C(14): error C202: 'DQ': undefined identifier
..\DS18B20_S\DS18B20.C(16): error C202: 'DQ': undefined identifier
..\DS18B20_S\DS18B20.C(25): error C202: 'DQ': undefined identifier
..\DS18B20_S\DS18B20.C(27): error C202: 'DQ': undefined identifier
..\DS18B20_S\DS18B20.C(28): error C202: 'DQ': undefined identifier
..\DS18B20_S\DS18B20.C(40): error C202: 'DQ': undefined identifier
..\DS18B20_S\DS18B20.C(41): error C202: 'DQ': undefined identifier
..\DS18B20_S\DS18B20.C(43): error C202: 'DQ': undefined identifier
..\DS18B20_S\测温.C(8): error C202: 'P2': undefined identifier
..\DS18B20_S\测温.C(9): error C202: 'P0': undefined identifier
..\DS18B20_S\测温.C(11): error C202: 'P2': undefined identifier
..\DS18B20_S\测温.C(12): error C202: 'P0': undefined identifier
..\DS18B20_S\测温.C(14): error C202: 'P2': undefined identifier
..\DS18B20_S\测温.C(15): error C202: 'P0': undefined identifier
Target not created
======================================================
问题出在 <REGX51.H>这个头文件上,可能你keil编译器设置的不对

作者: lj53080    时间: 2008-11-12 17:57

我以前都是用的<reg51.h>

没用过<REGX51.H>

keil编译器设置要怎么弄?

还有UV2应该怎么设置?\

不好意识新手啥都不知道


作者: zcllom    时间: 2008-11-12 18:11

那就好办了,你把<regx51>改成<reg51.h>就行了


作者: lj53080    时间: 2008-11-12 18:42

还是不行

Build target 'Target 1'
compiling Delay.C...
compiling 测温.c...
compiling DS18B20.C...
linking...
BL51 BANKED LINKER/LOCATER V5.03 - SN: Eval Version
COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2002
"Delay.obj",
"测温.obj",
"DS18B20.obj"
TO "DS18B20"
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
SYMBOL: _DELAY1MS
MODULE: 测温.obj (测温)
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
SYMBOL: _DELAY_US
MODULE: 测温.obj (测温)
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
SYMBOL: DECILE
MODULE: DS18B20.obj (DS18B20)
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
SYMBOL: TMP
MODULE: DS18B20.obj (DS18B20)
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
SYMBOL: TENS
MODULE: DS18B20.obj (DS18B20)
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
SYMBOL: TMPRT
MODULE: DS18B20.obj (DS18B20)
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
SYMBOL: UNITS
MODULE: DS18B20.obj (DS18B20)
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
SYMBOL: FLAG_INIT
MODULE: DS18B20.obj (DS18B20)
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
SYMBOL: READTEMPERATURE
MODULE: DS18B20.obj (DS18B20)
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
SYMBOL: _WRITEONECHAR
MODULE: DS18B20.obj (DS18B20)
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
SYMBOL: READONECHAR
MODULE: DS18B20.obj (DS18B20)
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
SYMBOL: DS18B20_INIT
MODULE: DS18B20.obj (DS18B20)
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
SYMBOL: _DELAY1MS
MODULE: DS18B20.obj (DS18B20)
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
SYMBOL: _DELAY_US
MODULE: DS18B20.obj (DS18B20)
*** FATAL ERROR L210: I/O ERROR ON INPUT FILE:
EXCEPTION 0021H: PATH OR FILE NOT FOUND
FILE: F:\KC51\C51\LIB\C51FPS.LIB
Target not created


作者: lj53080    时间: 2008-11-12 19:05

你有空时能不能帮我看一下

我发的那个程序

我按你那个写的

程序能运行

仿真的时有问题

非常感谢


作者: zcllom    时间: 2008-11-12 19:54

程序能运行

仿真的时有问题

======================

仿真有什么问题?


作者: zcllom    时间: 2008-11-12 19:55

你该把uv2 换成新的版本了
作者: cjjiwei    时间: 2008-11-13 17:16

顶啊,谢谢楼主!
作者: tt_2008    时间: 2008-11-27 10:02

找到了


作者: xiaoqiezi    时间: 2008-11-29 09:49

qq
作者: cghe    时间: 2008-11-30 22:35

ding ddddddddddddddddddddddddddddd
作者: zcllom    时间: 2008-11-30 23:23

找到适合自己的东西,兴奋之情,溢于言表
作者: lam007    时间: 2008-12-3 10:06

xiexiela谢谢 拉
作者: qzk123    时间: 2008-12-3 18:20

谢谢 看看了
作者: edncb    时间: 2008-12-4 09:48

谢谢楼主分享


作者: xmwzjl    时间: 2008-12-4 16:42

谢谢楼主


作者: xmwzjl    时间: 2008-12-4 16:43

谢谢
作者: ads26    时间: 2008-12-8 14:11

正需要中。。。。。。。。。。。。。。。。。。。
作者: 阿伯    时间: 2008-12-8 23:04

太感谢LZ了,正急用


作者: zcllom    时间: 2008-12-8 23:19

呵呵,想不到这么多新人找到了这个地方。。。。。
作者: wuyueqing309    时间: 2008-12-9 11:26     标题: 回复:(zcllom)[更新!]数字温度计DS18B20内带原理图...

谢谢了


作者: fg007fg    时间: 2008-12-9 21:16

谢谢楼主啊
作者: mayi5525    时间: 2008-12-10 17:04

[em01] ok


作者: sq05044203    时间: 2008-12-14 12:54

我想要看看
作者: ljpking    时间: 2008-12-16 13:53

kakkanla
作者: kaiguandianyuan    时间: 2009-1-15 11:15

版主绝对是好版主 谢谢了


作者: SINDYZHONG    时间: 2009-2-27 23:04

我照了你的意思.ISIS运行不了.编程也有很多错``
作者: l123456ren    时间: 2009-3-26 21:03

谢谢LZ啦~~~!
作者: xinlai    时间: 2009-4-6 17:39

谢谢
作者: maliang    时间: 2009-4-13 16:57

谢谢楼主的无私奉献
作者: zhanqu    时间: 2009-4-13 17:01

真是热心的版主啊


作者: zcllom    时间: 2009-4-13 17:05

为人为己
作者: carlos522    时间: 2009-4-20 22:07

我的毕业设计题目和它类似,真是谢谢啦!
作者: mty1    时间: 2009-4-28 20:12

顶!!
作者: txgcwg    时间: 2009-5-8 18:30

我想问问 怎么打不开 好像是说 版本不对


作者: ghfdsaa0000    时间: 2009-5-11 15:33     标题:


作者: jack107    时间: 2009-5-12 20:46

请教一下这个设计的温度的上下限的值 跪求了


作者: wsh128200    时间: 2009-5-14 16:43

原理图上面有三个端口 被截掉了 应该接什么呀


作者: mengjue    时间: 2009-6-6 10:56

谢谢


作者: XUFEIDAXIA    时间: 2009-6-20 20:05

楼主啊,这个做的不错啊,只是我还没学会PROTUS的用法啊。。。郁闷
作者: keenforce    时间: 2009-7-6 16:57

顶啊


作者: fengyun11747    时间: 2009-8-20 00:28

c 呢 没有啊
作者: 06082324    时间: 2009-11-20 19:52

有多点的嘛我要做实物的,苦于没有原理图之类的,有的话发我邮箱chobits0123456@163.com谢谢
作者: yangbicheng    时间: 2010-3-11 23:17

1# zcllom
作者: tongyaobin    时间: 2010-3-28 22:48

dddddddssssss




欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) Powered by Discuz! 7.0.0