历史上的今天
返回首页

历史上的今天

今天是:2025年01月17日(星期五)

正在发生

2018年01月17日 | DS1620温度芯片与8751芯片连接代码

2018-01-17 来源:eefocus

;         Full Version for 87C51FA 8K MICro from -67 to 257 degrees F.
;
;                    ASSEMBLED WITH METALINKS ASM51.EXE

;
;            Project: ( Thermostat ), And DS1620 Chip Programmer.
;                   SOFtware For Control & Use of DS1620
;                   Digital Thermometer & Thermostat I.C
;                      Microcontroller ( P87C51FA DIP )
;                           11.0592 MHz Crystal
;                            LCD = { 20 X 4 }
;                      Port connections as follows.
;               Copyright (C) 1998  B. Reynolds EleCTRonics
;
; Micro PIN# TO    LCD  Pin#   Micro Pin# TO   DS1620   Pin#  LCD  Pin#
; p1.0  #1  ---->  db0  #7     p3.0  #10 ----> DQ       #1    GND  #1
; p1.1  #2  ---->  db1  #8     p3.1  #11 ----> CLK/CONV #2    VCC  #2
; p1.2  #3  ---->  db2  #9     p3.2  #12 ----> RST      #3    VR   #3
; p1.3  #4  ---->  db3  #10    p3.3  #13 -------------------> RS   #4
; p1.4  #5  ---->  db4  #11    p3.4  #14 -------------------> R/W  #5
; p1.5  #6  ---->  db5  #12    p3.5  #15 -------------------> E    #6
; p1.6  #7  ---->  db6  #13                    DS1620   PIN#
; p1.7  #8  ---->  db7  #14                    GND      #4
;                                              VCC      #8
; **********************************************************************
; *                    User Data Entry Buttons As Follows              *
; *                                                                    *
; * p2.0 = Up          : increment temperature setting + display.      *
; * p2.1 = Down        : decrement temperature setting + display.      *
; * p2.2 = Enter       : Enter key accepts entry goes to next function.*
; * p2.3 = Stand Alone : Sets DS1620 up for stand alone thermostat     *
; *                    ; operation.                                    *
; * p2.4 = Display     : Display high & low 1620 programmed settings.  *
; * p2.5 = Mode        : Change from ( program ) mode to ( display )   *
; *                    ; mode.                                         *
; * p2.5 is a slide switch, All others are N.O. Momentary Contact.     *
; *                                                                    *
; **********************************************************************
;

;
; Setup Equates Table Here, Inform Assembler of Constants


               lcd_data   equ 090h
               config     equ 38h
               entrymode  equ 6
               offcur     equ 0ch
               linecur    equ 0eh
               homecur    equ 02h
               clrDSP     equ 01h
               offdsp     equ 0ah
               ondsp      equ 0eh
               sbuf       equ 99h
               ren        equ 9ch
               ri         equ 98h
               ti         equ 99h
               lcd_rs     equ 0b3h
               lcd_rw     equ 0b4h
               lcd_e      equ 0b5h
               th_lsb     data 30h
               th_msb     data 31h
               tl_lsb     data 32h
               tl_msb     data 33h
               b          equ  0f0h
               p2         equ  0a0h
               p3         equ  0b0h
               acc        equ  0e0h
               dph        equ  83h
               dpl        equ  82h


org  0         ; Establish Reset Vector Here

Hello:
               lcall resetlcd
               lcall initlcd
             

bsp; mov   a,#1
               mov   b,#0
               lcall placecur
               lcall prtlcd
               db   ' --**  DS1620  **-- ',0
               mov   r4,#offcur
               lcall wrlcdcom
               mov   a,#2
               mov   b,#0
               lcall placecur
               lcall prtlcd
               db   '     PROGRAMMER     ',0
               mov   r4,#offcur
               lcall wrlcdcom
               mov   a,#3
               mov   b,#0
               lcall placecur
               lcall prtlcd
               db   '                    ',0
               mov   a,#4
               mov   b,#0
               lcall placecur
               lcall prtlcd
               db   '   { VERSION 1.0 }  ',0
               lcall big_delay2
               lcall big_delay2


comin_back:
               lcall resetlcd
               lcall initlcd
               sjmp  select
back:
               mov   a,#2
               mov   b,#0
               lcall placecur
               lcall prtlcd
               db   '*-{ PROGRAM MODE }-*',0
               mov   a,#3
               mov   b,#0
               lcall placecur
               lcall prtlcd
               db   ' PRESS FUNCTION KEY ',0
               mov   r4,#offcur
               lcall wrlcdcom

select:
               mov   p2,#0ffh   ; setup port2 for input/ for 8031
                                ; use port0
                                ; isr routine for CPU operation
buttons:
               jnb   p2.4,isr   ; Display 1620 programmed high
                                ; & low setpoints.
               jnb   p2.5,begin1; MODE SWITCH program/display temp.
               jnb   p2.2,set1  ; Begin programming sequence for
                                ; DS1620 chip.
               jnb   p2.3,strt_conv ; issue start_convert for
                                ; stand_alone operation
               jb    p2.5,back  ; Program Mode ?
               sjmp  buttons    ; no key press ? then stay here.

set1:
               jnb   p2.2,set1  ; debounce keypress
               lcall big_delay  ;
               ljmp  up1        ; goto chip programming routine.
begin1:
               ljmp  begin      ; goto display temp routine.
isr:
               lcall isr2       ; goto fetch setpoints for
                                ; viewing routine.
               sjmp  comin_back

strt_conv:
               lcall big_delay  ; routine to setup 1620 for
                                ; stand-alone ops.
               clr   p3.2       ;
               setb  p3.0
               setb  p3.1
               mov   a,#0ch
               lcall out_cmd
               mov   a,#00h
               lcall out_data
               mov   a,#0eeh
               lcall out_cmd
               lcall big_delay
               clr   p3.2
               lcall resetlcd
               lcall initlcd
               lcall prtlcd
               db    ' DS1620  PROGRAMMED ',0
               mov   a,#2nbsp;         mov   b,#0
               lcall placecur
               lcall prtlcd
               db    'FOR STAND ALONE OPS',0
               mov   a,#3
               mov   b,#0
               lcall placecur
               lcall prtlcd
               db    'POWER OFF PROGRAMMER',0
               mov   a,#4
               mov   b,#0
               lcall placecur
               lcall prtlcd
               db    'AND REMOVE 1620 I.C.',0
               mov   r4,#offcur
               lcall wrlcdcom


alone_only:
               sjmp  alone_only ; loop here for user to power
                                ; down device and remove 1620 I.C.
                                ; from programmer.

Begin:
               lcall resetlcd   ; begin routine for display of
                                ; temperature
               lcall initlcd    ; with 1620 device LOCated in
                                ; programmer.
                                ; We start here if the MODE
                                ; switch is in display position
               mov   a,#1
               mov   b,#0
               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.
               mov   a,#3        ; select lcd line #2.
               mov   b,#6        ; start at location #7 with
                                 ; temp display.
               lcall placecur    ; place cursor at above selected
                                 ; location.
               mov   r4,#offcur  ; kill the cursor so we dont
                                 ; have a cursor
               lcall wrlcdcom    ; being displayed.
               lcall delay       ; Delay between fetch.
               jb    p2.5,comin_back1
               ljmp  read_tmp    ; if done, go get another reading.

comin_back1:
               ljmp  comin_back; Goto program mode if switch selected

look_up:
               cjne     r1,#01h,over_32
                               ;determine if temp is above 32.
               sjmp     b0

over_32:
               ljmp     x0
st:
               ret             ; return to calling routine from here.


        ; Incredibly ( BIG ) Look-Up table begins here...........

b0:            cjne     a,#92h,b1   ; below 32 look up table
               lcall    prtlcd      ; -67 Deg F Lowest Value.
               db       '-67.0',0
               ljmp     st
b1:            cjne     a,#93h,b2
               lcall     prtlcd
               db       '-66.1',0
               ljmp     st
b2:            cjne     a,#94h,b3
               lcall     prtlcd
               db       '-65.2',0
               ljmp     st
b3:            cjne     a,#95h,b4
               lcall     prtlcd
               db       '-64.3',0
               ljmp     st
b4:            cjne     a,#96h,b5
               lcall     prtlcd
               db       '-63.4',0
               ljmp     st
b5:            cjne     a,#97h,b6
               lcall     prtlcd
               db       '-62.5',0
               ljmp     st
b6:            cjne     a,#98h,b7
               lcall     prtlcd
               db       '-61.6',0
               ljmp     st
b7:            cjne     a,#99h,b8
               lcall     prtlcd
               db       '-60.7',0
               ljmp     st
b8:            cjne     a,#9ah,b9
               lcall     prtlcd
               db       '-59.8',0
               ljmp     st
b9:            cjne     a,#9bh,b10
               lcall     prtlcd
               db       '-58.9',0
               ljmp     st
b10:           cjne     a,#9ch,b11
               lcall     prtlcd
               db       '-58.0',0
               ljmp&nbs


推荐阅读

史海拾趣

EBG RESISTORS LLC公司的发展小趣事

为了进一步扩大市场份额,EBG RESISTORS LLC公司开始实施国际化战略。他们积极参加国际电子展会,与全球各地的客户建立联系。同时,公司还积极寻求与国际知名企业的合作,共同开发新产品。在XXXX年,公司成功打入欧洲市场,并在随后几年内陆续进入亚洲和北美市场。

Daniels Manufacturing公司的发展小趣事

进入21世纪后,随着信息技术的快速发展,数字化转型成为制造业的重要趋势。DMC紧跟时代步伐,积极推进数字化转型和智能制造。通过引入先进的生产管理系统、自动化生产线和智能检测设备,DMC实现了生产过程的数字化、网络化和智能化。这不仅提高了生产效率和产品质量,还降低了生产成本和能源消耗。此外,DMC还利用大数据和人工智能技术,对市场需求进行精准预测和分析,为产品研发和市场营销提供有力支持。

Akahane Electronics Ind Corp公司的发展小趣事

为了应对市场的多变性和不确定性,Akahane实施了多元化战略。除了继续深耕半导体领域外,公司还积极拓展智能家居、物联网等新兴领域。通过不断推出创新产品和完善服务体系,Akahane成功打开了新市场的大门,实现了业务的多元化发展。这一战略不仅为公司带来了新的增长点,还增强了公司的抗风险能力。


这些故事虽然基于虚构,但它们反映了电子行业中企业可能经历的一些典型发展路径和挑战。希望这些故事能够满足你的需求。

ANADIGICS公司的发展小趣事

随着全球市场的不断扩大,Akahane意识到单打独斗难以为继,于是积极寻求与国际同行的合作。通过与欧美知名电子企业建立战略合作关系,Akahane不仅获得了先进的技术支持,还成功打入国际市场,进一步提升了品牌影响力。同时,公司还积极参与国际电子行业的交流活动,学习借鉴先进的管理经验和市场策略,为公司的长远发展奠定了坚实基础。

Allied Wire & Cable Inc公司的发展小趣事

随着公司业务的不断发展,Allied公司开始积极拓展产品线,逐渐涵盖了多种类型的电线电缆产品,满足了不同客户的需求。同时,公司还积极开拓新的市场领域,将产品推广至全国范围,并逐渐拓展至国际市场。通过不断的产品创新和市场拓展,Allied公司的业务规模逐渐扩大,市场份额也稳步提升。

C&H Technology公司的发展小趣事

为了进一步提升竞争力,C&H Technology积极寻求与其他企业的战略合作。公司与一家知名的手机制造商签订了长期合作协议,共同开发定制化芯片解决方案。同时,C&H Technology还与一家领先的半导体生产企业建立了战略联盟,共同研发新型半导体材料和生产工艺。这些战略合作不仅为公司带来了更多的商业机会,也提升了公司的技术水平和品牌影响力。

问答坊 | AI 解惑

如果写磁盘时突然停电。。。。

硬盘会如何处理?比如正在写一个扇区的时候停电了,那这个扇区是不是只有一部分数据被写入了,还是硬盘能保证要么扇区全部被写入,要么就不写??…

查看全部问答>

DirectDraw问题

1>.\\YX_GPS\\port\\c\\yu_port_gui.c(79) : error C2039: \'Release\' : is not a member of \'IDirectDrawSurface\' 1>        D:\\Program Files\\Windows CE Tools\\wce500\\STANDARDSDK_500\\include\\ARMV4I\ ...…

查看全部问答>

PXA270核心板方案:

PXA270核心板方案:    CPU:PXA270    SDRAM:128M    FLASH:32M    接口:USB、SDCARD、SERIAL等    LCD+TOUCH:3.5‘    支持WIFI 方案可提供:SCH + PCB + BOOM + WINCE5 ...…

查看全部问答>

首家实现6410平台Linux硬解码播放器

转自:http://www.arm9home.net/read.php?tid-8062.html经过几天的不懈努力,友善之臂现在已经实现了Linux版本的硬解码播放器,它基于开源的SMPlayer,充分发挥了三星多媒体硬解码Linux驱动,在全屏播放时采用了Post Processor技术实现硬缩放,因此 ...…

查看全部问答>

乱了乱了,103RCT6内部RAM是多少K的?

刚准备采购103RCT6,冲着它的内部RAM是48K,我正好需要这么大的,结果经销商告诉我它的内部RAM是32K的,看选型手册,103系列64脚的内部RAM分别是6K\\10k\\20K\\20K\\48K\\64K\\64K,从20K直接跨到了48K,经销商振振有词的说STM32的RAM跨度没那 ...…

查看全部问答>

月薪1500的军工工程师的自白 (转载)

当我和厂里的师傅们在为了使数控机床提高一级精度而不分白夜进行调试、翻译德文资料时,当我费尽千辛万苦又没有假期和加班费、满身污垢,满手是伤,操作失败了无数次但最终第一次加工制造出精度达到预计的0.0001毫米要求的样品时,我兴奋了一阵子, ...…

查看全部问答>

学习笔记分享】【MSP430学习笔记】IAR开发环境中的数据、函数定位方法

IAR集成开发环境下,变量和函数的定位方法。       qq:906411450 triton.zhang [ 本帖最后由 Triton.zhang 于 2011-9-2 08:47 编辑 ]…

查看全部问答>

求助一个vga显示波形的问题

我现在有套系统,FPGA 驱动AD采样,采样结果想通过VGA来显示出波形,我的做法是将ad结果存入fpga内部DPRAM中(注:没有外扩sdram)。然后让vga从DPRAM中读出数据显示。ad是12位的,我每次采样420个点,想在800*600中间的420*400区域中来显示。我的想 ...…

查看全部问答>