您当前的位置:五五电子网电子知识单片机-工控设备51单片机DS1620温度芯片与8751芯片连接代码 正文
DS1620温度芯片与8751芯片连接代码

DS1620温度芯片与8751芯片连接代码

点击数:7808 次   录入时间:03-04 11:39:06   整理:http://www.55dianzi.com   51单片机
               lcall placecur
               lcall prtlcd     ; Print some fancy corners
               db    '*                  *',0
               mov   a,#4
               mov   b,#0
               lcall placecur
               lcall prtlcd
               db    '*                  *',0
               mov   a,#2
               mov   b,#0
               lcall placecur
               lcall prtlcd
               db ' DS1620 TEMPERATURE ',0
               mov   a,#3         ; set cursor on line #3
               mov   b,#12        ; at position #12
               lcall placecur     ; place cursor routine
               lcall prtlcd       ; print routine
               db    11011111b,01000110b,0
                                  ; Data for deg F symbol.
               mov   a,#0ffh
               lcall delay
               mov   a,#3         ; Set location for cursor
               mov   b,#6         ; to display current
                                  ; temperature.
               lcall placecur
               mov   r4,#offcur   ; Turn OFF Cursor.
               lcall wrlcdcom     ; write lcd command routine

;  Here we will continously convert temp,
;  in CPU Mode for Temp Display
check_tmp:
               clr   p3.2        ; reset ds1620
               setb  p3.0        ; RXD and TXD high
               setb  p3.1

               mov   a,#0ch      ; Load Write configuration
                                 ; byte instruction
               lcall out_cmd     ; send it to 1620
               mov   a,#02h      ; set config byte = cpu mode,
               lcall out_data    ; send it to 1620

               mov   a,#0eeh     ; initiate temperature conversion
               lcall out_cmd

               mov   a,#0ffh     ; set delay time here
               lcall delay

read_tmp:
               clr   a
               mov   a,#0aah     ; Load instruction to fetch last temp
               lcall out_cmd     ; conversion result.

        
     nbsp;      lcall in_data     ; get temp data from ds1620 ( LSB )
               mov   r3,a        ; move ( LSB ) of temp data to Storage
                                 ; Register.
               lcall in_data     ; get temp data from ds1620 ( MSB )
               mov   r1,a        ; move ( MSB ) of temp data to Storage
                                 ; Register.

; use data retrieved into Storage Registers, to point to
; lookup_table data to be shown on LCD.

               mov   a,r3        ; mov conversion results to ACC
               lcall look_up     ; Fetch display data.

上一页  [1] [2] [3] [4] [5] [6]  下一页


本文关键字:暂无联系方式51单片机单片机-工控设备 - 51单片机