求个DS1820的汇编程序

求个DS1820的汇编程序,第1张

$NOMOD51

$INCLUDE (src\郑贺main\pin.inc)

NAME DS2438

?PR?initialize?DS2438 SEGMENT CODE

?PR?_write?DS2438 SEGMENT CODE

?PR?read?DS2438 SEGMENT CODE

?PR?_function0x0BE?DS2438 SEGMENT CODE

EXTRN CODE ( ?C?CSTPTR )

PUBLIC _function0x0BE

static void initialize( void )

RSEG ?PR?initialize?DS2438

initialize:

USING 0

SETB DQ

NOP

CLR DQ

MOV R7, #240

DJNZ R7, $

SETB DQ

MOV R7, #240

DJNZ R7, $

RET

static void write( char x )

RSEG ?PR?_write?DS2438

_write:

USING 0

MOV R0, #8

loop1:

RRC A

CLR DQ

NOP

MOV DQ, C

MOV R7, #60

DJNZ R7, $

SETB DQ

DJNZ R0, loop1

RET

static char read( void )

RSEG ?PR?read?DS2438

read:

USING 0

MOV R0, #8

loop2:

CLR DQ

NOP

SETB DQ

NOP

MOV R7, #6

DJNZ R7, $

MOV C, DQ

RRC A

MOV R7, #22

DJNZ R7, $

DJNZ R0, loop2

RET

void function0x0BE( char *pc )

RSEG ?PR?_function0x0BE?DS2438

_function0x0BE:

USING 0

LCALL initialize

MOV A, #0CCH

LCALL _write

MOV A, #044H

LCALL _write

LCALL initialize

MOV A, #0CCH

LCALL _write

MOV A, #0BEH

LCALL _write

LCALL read

ANL A, #0F0H

MOV R4, A

LCALL read

ANL A, #00FH

ORL A, R4

SWAP A

passing generic ptr in R3-R1(type/MSB/LSB)

LCALL ?C?CSTPTR

RET

END

仅限于KEIL编译器和89C51或兼容系列单片机的DS18B20汇编程序

我截断了温度喊伏派的小数部分,觉得精度不够的话,楼主可以修厅激改部分或全部的代码

能给点分咩楼主~~

例如镍镉电池,充电容量是放电容量的1.4倍,用电池电压做放电停止顷祥检测,每节放到1.1V就停止放电,同时CCA和DCA清零,以后电池电量的显示是K(CCA/1.4-DCA),这里K是一个系数,可根游乎顷神陆据所用电阻和DS2438说明书中的公式计算出来。

Along with the humiture examination system's widespread utilization, the different profession and the domain have the various requirement and the standard to the humiture examination. This design mainly uses in the ordinary indoor humiture survey. Uses the DS2438, HIH3605B integration chip to take the humiture sensor. In the article has analyzed the humiture survey principle of work and the process, proposed the humiture examination system design's overall plan, has carried on the plan proof to each submodule design and compares. The hardware design uses protel the 99se software, has completed the monolithic integrated circuit smallest system, the LCD display circuit, sensor's schematic diagram and the PCB chart. The software design uses Keil uVision2, has completed the program module each module design programming, has realized to the humiture signal processing process programming and the debugging. This measurement system humidity measuring range 0%~100%, resolution ±2%Temperature survey scope - 40~+125℃, resolution ±0.5℃. Can meet the daily life humiture survey requirements.

key words: AT89S52HIH3605BDS2438LCDData acquisitionData processing


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/12485075.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-25
下一篇 2023-05-25

发表评论

登录后才能评论

评论列表(0条)

保存