历史上的今天
今天是: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
下一篇:LCD12864汇编语言程序例子
史海拾趣
|
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核心板方案: CPU:PXA270 SDRAM:128M FLASH:32M 接口:USB、SDCARD、SERIAL等 LCD+TOUCH:3.5‘ 支持WIFI 方案可提供:SCH + PCB + BOOM + WINCE5 ...… 查看全部问答> |
|
转自:http://www.arm9home.net/read.php?tid-8062.html经过几天的不懈努力,友善之臂现在已经实现了Linux版本的硬解码播放器,它基于开源的SMPlayer,充分发挥了三星多媒体硬解码Linux驱动,在全屏播放时采用了Post Processor技术实现硬缩放,因此 ...… 查看全部问答> |
|
刚准备采购103RCT6,冲着它的内部RAM是48K,我正好需要这么大的,结果经销商告诉我它的内部RAM是32K的,看选型手册,103系列64脚的内部RAM分别是6K\\10k\\20K\\20K\\48K\\64K\\64K,从20K直接跨到了48K,经销商振振有词的说STM32的RAM跨度没那 ...… 查看全部问答> |
|
当我和厂里的师傅们在为了使数控机床提高一级精度而不分白夜进行调试、翻译德文资料时,当我费尽千辛万苦又没有假期和加班费、满身污垢,满手是伤,操作失败了无数次但最终第一次加工制造出精度达到预计的0.0001毫米要求的样品时,我兴奋了一阵子, ...… 查看全部问答> |
|
学习笔记分享】【MSP430学习笔记】IAR开发环境中的数据、函数定位方法 IAR集成开发环境下,变量和函数的定位方法。 qq:906411450 triton.zhang [ 本帖最后由 Triton.zhang 于 2011-9-2 08:47 编辑 ]… 查看全部问答> |
|
我现在有套系统,FPGA 驱动AD采样,采样结果想通过VGA来显示出波形,我的做法是将ad结果存入fpga内部DPRAM中(注:没有外扩sdram)。然后让vga从DPRAM中读出数据显示。ad是12位的,我每次采样420个点,想在800*600中间的420*400区域中来显示。我的想 ...… 查看全部问答> |




