; 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 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,#2 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. 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 st b11: cjne a,#9dh,b12 lcall prtlcd db '-57.1',0 ljmp st b12: cjne a,#9eh,b13 lcall prtlcd db '-56.2',0 ljmp st b13: cjne a,#9fh,b14 lcall prtlcd db '-55.3',0 ljmp st b14: cjne a,#0a0h,b15 lcall prtlcd db '-54.4',0 ljmp st b15: cjne a,#0a1h,b16 lcall prtlcd db '-53.5',0 ljmp st b16: cjne a,#0a2h,b17 lcall prtlcd db '-52.6',0 ljmp st b17: cjne a,#0a3h,b18 lcall prtlcd db '-51.7',0 ljmp st b18: cjne a,#0a4h,b19 lcall prtlcd db '-50.8',0 ljmp st b19: cjne a,#0a5h,b20 lcall prtlcd db '-49.9',0 ljmp st b20: cjne a,#0a6h,b21 lcall prtlcd db '-49.0',0 ljmp st b21: cjne a,#0a7h,b22 lcall prtlcd db '-48.1',0 ljmp st b22: cjne a,#0a8h,b23 lcall prtlcd db '-47.2',0 ljmp st b23: cjne a,#0a9h,b24 lcall prtlcd db '-46.3',0 ljmp st b24: cjne a,#0aah,b25 lcall prtlcd db '-45.4',0 ljmp st b25: cjne a,#0abh,b26 lcall prtlcd db '-44.5',0 ljmp st b26: cjne a,#0ach,b27 lcall prtlcd db '-43.6',0 ljmp st b27: cjne a,#0adh,b28 lcall prtlcd db '-42.7',0 ljmp st b28: cjne a,#0aeh,b29 lcall prtlcd db '-41.8',0 ljmp st b29: cjne a,#0afh,b30 lcall prtlcd db '-40.9',0 ljmp st b30: cjne a,#0b0h,b31 lcall prtlcd db '-40.0',0 ljmp st b31: cjne a,#0b1h,b32 lcall prtlcd db '-39.1',0 ljmp st b32: cjne a,#0b2h,b33 lcall prtlcd db '-38.2',0 ljmp st b33: cjne a,#0b3h,b34 lcall prtlcd db '-37.3',0 ljmp st b34: cjne a,#0b4h,b35 lcall prtlcd db '-36.4',0 ljmp st b35: cjne a,#0b5h,b36 lcall prtlcd db '-35.5',0 ljmp st b36: cjne a,#0b6h,b37 lcall prtlcd db '-34.6',0 ljmp st b37: cjne a,#0b7h,b38 lcall prtlcd db '-33.7',0 ljmp st b38: cjne a,#0b8h,b39 lcall prtlcd db '-32.8',0 ljmp st b39: cjne a,#0b9h,b40 lcall prtlcd db '-31.9',0 ljmp st b40: cjne a,#0bah,b41 lcall prtlcd db '-31.0',0 ljmp st b41: cjne a,#0bbh,b42 lcall prtlcd db '-30.1',0 ljmp st b42: cjne a,#0bch,b43 lcall prtlcd db '-29.2',0 ljmp st b43: cjne a,#0bdh,b44 lcall prtlcd db '-28.3',0 ljmp st b44: cjne a,#0beh,b45 lcall prtlcd db '-27.4',0 ljmp st b45: cjne a,#0bfh,b46 lcall prtlcd db '-26.5',0 ljmp st b46: cjne a,#0c0h,b47 lcall prtlcd db '-25.6',0 ljmp st b47: cjne a,#0c1h,b48 lcall prtlcd db '-24.7',0 ljmp st b48: cjne a,#0c2h,b49 lcall prtlcd db '-23.8',0 ljmp st b49: cjne a,#0c3h,b50 lcall prtlcd db '-22.9',0 ljmp st b50: cjne a,#0c4h,b51 lcall prtlcd db '-22.0',0 ljmp st b51: cjne a,#0c5h,b52 lcall prtlcd db '-21.1',0 ljmp st b52: cjne a,#0c6h,b53 lcall prtlcd db '-20.2',0 ljmp st b53: cjne a,#0c7h,b54 lcall prtlcd db '-19.3',0 ljmp st b54: cjne a,#0c8h,b55 lcall prtlcd db '-18.4',0 ljmp st b55: cjne a,#0c9h,b56 lcall prtlcd db '-17.5',0 ljmp st b56: cjne a,#0cah,b57 lcall prtlcd db '-16.6',0 ljmp st b57: cjne a,#0cbh,b58 lcall prtlcd db '-15.7',0 ljmp st b58: cjne a,#0cch,b59 lcall prtlcd db '-14.8',0 ljmp st b59: cjne a,#0cdh,b60 lcall prtlcd db '-13.9',0 ljmp st b60: cjne a,#0ceh,b61 lcall prtlcd db '-13.0',0 ljmp st b61: cjne a,#0cfh,b62 lcall prtlcd db '-12.1',0 ljmp st b62: cjne a,#0d0h,a0 lcall prtlcd db '-11.2',0 ljmp st a0: cjne a,#0d1h,a1 lcall prtlcd db '-10.3',0 ljmp st a1: cjne a,#0d2h,a2 lcall prtlcd db '-9.40',0 ljmp st a2: cjne a,#0d3h,a3 lcall prtlcd db '-8.50',0 ljmp st a3: cjne a,#0d4h,a4 lcall prtlcd db '-7.60',0 ljmp st a4: cjne a,#0d5h,a5 lcall prtlcd db '-6.70',0 ljmp st a5: cjne a,#0d6h,a6 lcall prtlcd db '-5.80',0 ljmp st a6: cjne a,#0d7h,a7 lcall prtlcd db '-4.90',0 ljmp st a7: cjne a,#0d8h,a8 lcall prtlcd db '-4.00',0 ljmp st a8: cjne a,#0d9h,a9 lcall prtlcd db '-3.10',0 ljmp st a9: cjne a,#0dah,a10 lcall prtlcd db '-2.20',0 ljmp st a10: cjne a,#0dbh,a11 lcall prtlcd db '-1.30',0 ljmp st a11: cjne a,#0dch,a12 lcall prtlcd db '-0.40',0 ljmp st a12: cjne a,#0ddh,a13 lcall prtlcd db '00.50',0 ljmp st a13: cjne a,#0deh,a14 lcall prtlcd db '1.40',0 ljmp st a14: cjne a,#0dfh,a15 lcall prtlcd db '2.30',0 ljmp st a15: cjne a,#0e0h,a16 lcall prtlcd db '3.20',0 ljmp st a16: cjne a,#0e1h,a17 lcall prtlcd db '4.10',0 ljmp st a17: cjne a,#0e2h,a18 lcall prtlcd db '5.00',0 ljmp st a18: cjne a,#0e3h,a19 lcall prtlcd db '5.90',0 ljmp st a19: cjne a,#0e4h,a20 lcall prtlcd db '6.80',0 ljmp st a20: cjne a,#0e5h,a21 lcall prtlcd db '7.70',0 ljmp st a21: cjne a,#0e6h,a22 lcall prtlcd db '8.60',0 ljmp st a22: cjne a,#0e7h,a23 lcall prtlcd db '9.50',0 ljmp st a23: cjne a,#0e8h,a24 lcall prtlcd db '10.40',0 ljmp st a24: cjne a,#0e9h,a25 lcall prtlcd db '11.30',0 ljmp st a25: cjne a,#0eah,a26 lcall prtlcd db '12.20',0 ljmp st a26: cjne a,#0ebh,a27 lcall prtlcd db '13.10',0 ljmp st a27: cjne a,#0ech,a28 lcall prtlcd db '14.00',0 ljmp st a28: cjne a,#0edh,a29 lcall prtlcd db '14.90',0 ljmp st a29: cjne a,#0eeh,a30 lcall prtlcd db '15.80',0 ljmp st a30: cjne a,#0efh,a31 lcall prtlcd db '16.70',0 ljmp st a31: cjne a,#0f0h,a32 lcall prtlcd db '17.60',0 ljmp st a32: cjne a,#0f1h,a33 lcall prtlcd db '18.50',0 ljmp st a33: cjne a,#0f2h,a34 lcall prtlcd db '19.40',0 ljmp st a34: cjne a,#0f3h,xa lcall prtlcd db '20.30',0 ljmp st xa: cjne a,#0f4h,xb lcall prtlcd db '21.20',0 ljmp st xb: cjne a,#0f5h,xc lcall prtlcd db '22.10',0 ljmp st xc: cjne a,#0f6h,xd lcall prtlcd db '23.00',0 ljmp st xd: cjne a,#0f7h,xe lcall prtlcd db '23.90',0 ljmp st xe: cjne a,#0f8h,xf lcall prtlcd db '24.80',0 ljmp st xf: cjne a,#0f9h,xg lcall prtlcd db '25.70',0 ljmp st xg: cjne a,#0fah,xh lcall prtlcd db '26.60',0 ljmp st xh: cjne a,#0fbh,xi lcall prtlcd db '27.50',0 ljmp st xi: cjne a,#0fch,xj lcall prtlcd db '28.40',0 ljmp st xj: cjne a,#0fdh,xk lcall prtlcd db '29.30',0 ljmp st xk: cjne a,#0feh,xl lcall prtlcd db '30.20',0 ljmp st xl: cjne a,#0ffh,xm lcall prtlcd db '31.10',0 xm: ljmp st x0: cjne a,#00h,x1 lcall prtlcd db '32.00',0 ljmp st x1: cjne a,#01h,x2 lcall prtlcd db '32.90',0 ljmp st x2: cjne a,#02h,x3 lcall prtlcd db '33.80',0 ljmp st x3: cjne a,#03h,x4 lcall prtlcd db '34.70',0 ljmp st x4: cjne a,#04h,x5 lcall prtlcd db '35.60',0 ljmp st x5: cjne a,#05h,x6 lcall prtlcd db '36.50',0 ljmp st x6: cjne a,#06h,x7 lcall prtlcd db '37.40',0 ljmp st x7: cjne a,#07h,x8 lcall prtlcd db '38.30',0 ljmp st x8: cjne a,#08h,x9 lcall prtlcd db '39.20',0 ljmp st x9: cjne a,#09h,x10 lcall prtlcd db '40.10',0 ljmp st x10: cjne a,#0ah,x11 lcall prtlcd db '41.00',0 ljmp st x11: cjne a,#0bh,x12 lcall prtlcd db '41.90',0 ljmp st x12: cjne a,#0ch,x13 lcall prtlcd db '42.80',0 ljmp st x13: cjne a,#0dh,x14 lcall prtlcd db '43.70',0 ljmp st x14: cjne a,#0eh,x15 lcall prtlcd db '44.60',0 ljmp st x15: cjne a,#0fh,x16 lcall prtlcd db '45.50',0 ljmp st x16: cjne a,#10h,x17 lcall prtlcd db '46.40',0 ljmp st x17: cjne a,#11h,x18 lcall prtlcd db '47.30',0 ljmp st x18: cjne a,#12h,x19 lcall prtlcd db '48.20',0 ljmp st x19: cjne a,#13h,x20 lcall prtlcd db '49.10',0 ljmp st x20: cjne a,#14h,x21 lcall prtlcd db '50.00',0 ljmp st x21: cjne a,#15h,x22 lcall prtlcd db '50.90',0 ljmp st x22: cjne a,#16h,x23 lcall prtlcd db '51.80',0 ljmp st x23: cjne a,#17h,x24 lcall prtlcd db '52.70',0 ljmp st x24: cjne a,#18h,x25 lcall prtlcd db '53.60',0 ljmp st x25: cjne a,#19h,x26 lcall prtlcd db '54.50',0 ljmp st x26: cjne a,#1ah,x27 lcall prtlcd db '55.40',0 ljmp st x27: cjne a,#1bh,x28 lcall prtlcd db '56.30',0 ljmp st x28: cjne a,#1ch,x29 lcall prtlcd db '57.20',0 ljmp st x29: cjne a,#1dh,x30 lcall prtlcd db '58.10',0 ljmp st x30: cjne a,#1eh,x31 lcall prtlcd db '59.00',0 ljmp st x31: cjne a,#1fh,x32 lcall prtlcd db '59.90',0 ljmp st x32: cjne a,#20h,x33 lcall prtlcd db '60.80',0 ljmp st x33: cjne a,#21h,x34 lcall prtlcd db '61.70',0 ljmp st x34: cjne a,#22h,x35 lcall prtlcd db '62.60',0 ljmp st x35: cjne a,#23h,x36 lcall prtlcd db '63.50',0 ljmp st x36: cjne a,#24h,x37 lcall prtlcd db '64.40',0 ljmp st x37: cjne a,#25h,x38 lcall prtlcd db '65.30',0 ljmp st x38: cjne a,#26h,x39 lcall prtlcd db '66.20',0 ljmp st x39: cjne a,#27h,x40 lcall prtlcd db '67.10',0 ljmp st x40: cjne a,#28h,x41 lcall prtlcd db '68.00',0 ljmp st x41: cjne a,#29h,x42 lcall prtlcd db '68.90',0 ljmp st x42: cjne a,#2ah,x43 lcall prtlcd db '69.80',0 ljmp st x43: cjne a,#2bh,x44 lcall prtlcd db '70.70',0 ljmp st x44: cjne a,#2ch,x45 lcall prtlcd db '71.60',0 ljmp st x45: cjne a,#2dh,x46 lcall prtlcd db '72.50',0 ljmp st x46: cjne a,#2eh,x47 lcall prtlcd db '73.40',0 ljmp st x47: cjne a,#2fh,x48 lcall prtlcd db '74.30',0 ljmp st x48: cjne a,#30h,x49 lcall prtlcd db '75.20',0 ljmp st x49: cjne a,#31h,x50 lcall prtlcd db '76.10',0 ljmp st x50: cjne a,#32h,x51 lcall prtlcd db '77.00',0 ljmp st x51: cjne a,#33h,x52 lcall prtlcd db '77.90',0 ljmp st x52: cjne a,#34h,x53 lcall prtlcd db '78.80',0 ljmp st x53: cjne a,#35h,x54 lcall prtlcd db '79.70',0 ljmp st x54: cjne a,#36h,x55 lcall prtlcd db '80.60',0 ljmp st x55: cjne a,#37h,x56 lcall prtlcd db '81.50',0 ljmp st x56: cjne a,#38h,x57 lcall prtlcd db '82.40',0 ljmp st x57: cjne a,#39h,x58 lcall prtlcd db '83.30',0 ljmp st x58: cjne a,#3ah,x59 lcall prtlcd db '84.20',0 ljmp st x59: cjne a,#3bh,x60 lcall prtlcd db '85.10',0 ljmp st x60: cjne a,#3ch,x61 lcall prtlcd db '86.00',0 ljmp st x61: cjne a,#3dh,x62 lcall prtlcd db '86.90',0 ljmp st x62: cjne a,#3eh,x63 lcall prtlcd db '87.80',0 ljmp st x63: cjne a,#3fh,x64 lcall prtlcd db '88.70',0 ljmp st x64: cjne a,#40h,x65 lcall prtlcd db '89.60',0 ljmp st x65: cjne a,#41h,x66 lcall prtlcd db '90.50',0 ljmp st x66: cjne a,#42h,x67 lcall prtlcd db '91.40',0 ljmp st x67: cjne a,#43h,x68 lcall prtlcd db '92.30',0 ljmp st x68: cjne a,#44h,x69 lcall prtlcd db '93.20',0 ljmp st x69: cjne a,#45h,x70 lcall prtlcd db '94.10',0 ljmp st x70: cjne a,#46h,x71 lcall prtlcd db '95.00',0 ljmp st x71: cjne a,#47h,x72 lcall prtlcd db '95.90',0 ljmp st x72: cjne a,#48h,x73 lcall prtlcd db '96.80',0 ljmp st x73: cjne a,#49h,x74 lcall prtlcd db '97.70',0 ljmp st x74: cjne a,#4ah,x75 lcall prtlcd db '98.60',0 ljmp st x75: cjne a,#4bh,x76 lcall prtlcd db '99.50',0 ljmp st x76: cjne a,#4ch,a39 lcall prtlcd db '100.4',0 ljmp st a39: cjne a,#4dh,a40 lcall prtlcd db '101.3',0 ljmp st a40: cjne a,#4eh,a41 lcall prtlcd db '102.2',0 ljmp st a41: cjne a,#4fh,a42 lcall prtlcd db '103.1',0 ljmp st a42: cjne a,#50h,a43 lcall prtlcd db '104.0',0 ljmp st a43: cjne a,#51h,a44 lcall prtlcd db '104.9',0 ljmp st a44: cjne a,#52h,a45 lcall prtlcd db '105.8',0 ljmp st a45: cjne a,#53h,a46 lcall prtlcd db '106.7',0 ljmp st a46: cjne a,#54h,a47 lcall prtlcd db '107.6',0 ljmp st a47: cjne a,#55h,a48 lcall prtlcd db '108.5',0 ljmp st a48: cjne a,#56h,a49 lcall prtlcd db '109.4',0 ljmp st a49: cjne a,#57h,a50 lcall prtlcd db '110.3',0 ljmp st a50: cjne a,#58h,a51 lcall prtlcd db '111.2',0 ljmp st a51: cjne a,#59h,a52 lcall prtlcd db '112.1',0 ljmp st a52: cjne a,#5ah,a53 lcall prtlcd db '113.0',0 ljmp st a53: cjne a,#5bh,a54 lcall prtlcd db '113.9',0 ljmp st a54: cjne a,#5ch,a55 lcall prtlcd db '114.8',0 ljmp st a55: cjne a,#5dh,a56 lcall prtlcd db '115.7',0 ljmp st a56: cjne a,#5eh,a57 lcall prtlcd db '116.6',0 ljmp st a57: cjne a,#5fh,a58 lcall prtlcd db '117.5',0 ljmp st a58: cjne a,#60h,a59 lcall prtlcd db '118.4',0 ljmp st a59: cjne a,#61h,a60 lcall prtlcd db '119.3',0 ljmp st a60: cjne a,#62h,a61 lcall prtlcd db '120.3',0 ljmp st a61: cjne a,#63h,a62 lcall prtlcd db '121.1',0 ljmp st a62: cjne a,#64h,a63 lcall prtlcd db '122.0',0 ljmp st a63: cjne a,#65h,a64 lcall prtlcd db '122.9',0 ljmp st a64: cjne a,#66h,a65 lcall prtlcd db '123.8',0 ljmp st a65: cjne a,#67h,a66 lcall prtlcd db '124.7',0 ljmp st a66: cjne a,#68h,a67 lcall prtlcd db '125.6',0 ljmp st a67: cjne a,#69h,a68 lcall prtlcd db '126.5',0 ljmp st a68: cjne a,#6ah,a69 lcall prtlcd db '127.4',0 ljmp st a69: cjne a,#6bh,a70 lcall prtlcd db '128.3',0 ljmp st a70: cjne a,#6ch,a71 lcall prtlcd db '129.2',0 ljmp st a71: cjne a,#6dh,A72 lcall prtlcd db '130.1',0 ljmp st a72: cjne a,#6eh,a73 lcall prtlcd db '131.0',0 ljmp st a73: cjne a,#6fh,a74 lcall prtlcd db '131.9',0 ljmp st a74: cjne a,#70h,a75 lcall prtlcd db '132.8',0 ljmp st a75: cjne a,#71h,a76 lcall prtlcd db '133.7',0 ljmp st a76: cjne a,#72h,a77 lcall prtlcd db '134.6',0 ljmp st a77: cjne a,#73h,a78 lcall prtlcd db '135.5',0 ljmp st a78: cjne a,#74h,a79 lcall prtlcd db '136.4',0 ljmp st a79: cjne a,#75h,a80 lcall prtlcd db '137.3',0 ljmp st a80: cjne a,#76h,a81 lcall prtlcd db '138.2',0 ljmp st a81: cjne a,#77h,a82 lcall prtlcd db '139.1',0 ljmp st a82: cjne a,#78h,a83 lcall prtlcd db '140.0',0 ljmp st a83: cjne a,#79h,a84 lcall prtlcd db '140.9',0 ljmp st a84: cjne a,#7ah,a85 lcall prtlcd db '141.8',0 ljmp st a85: cjne a,#7bh,a86 lcall prtlcd db '142.7',0 ljmp st a86: cjne a,#7ch,a87 lcall prtlcd db '143.6',0 ljmp st a87: cjne a,#7dh,a88 lcall prtlcd db '144.5',0 ljmp st a88: cjne a,#7eh,a89 lcall prtlcd db '145.4',0 ljmp st a89: cjne a,#7fh,a90 lcall prtlcd db '146.3',0 ljmp st a90: cjne a,#80h,a91 lcall prtlcd db '147.2',0 ljmp st a91: cjne a,#81h,a92 lcall prtlcd db '148.1',0 ljmp st a92: cjne a,#82h,a93 lcall prtlcd db '149.0',0 ljmp st a93: cjne a,#83h,a94 lcall prtlcd db '149.9',0 ljmp st a94: cjne a,#84h,a95 lcall prtlcd db '150.8',0 ljmp st a95: cjne a,#85h,a96 lcall prtlcd db '151.7',0 ljmp st a96: cjne a,#86h,a97 lcall prtlcd db '152.6',0 ljmp st a97: cjne a,#87h,a98 lcall prtlcd db '153.5',0 ljmp st a98: cjne a,#88h,a99 lcall prtlcd db '154.4',0 ljmp st a99: cjne a,#89h,a100 lcall prtlcd db '155.3',0 ljmp st a100: cjne a,#8ah,a101 lcall prtlcd db '156.2',0 ljmp st a101: cjne a,#8bh,a102 lcall prtlcd db '157.1',0 ljmp st a102: cjne a,#8ch,a103 lcall prtlcd db '158.0',0 ljmp st a103: cjne a,#8dh,a104 lcall prtlcd db '158.9',0 ljmp st a104: cjne a,#8eh,a105 lcall prtlcd db '159.8',0 ljmp st a105: cjne a,#8fh,a106 lcall prtlcd db '160.7',0 ljmp st a106: cjne a,#90h,a107 lcall prtlcd db '161.6',0 ljmp st a107: cjne a,#91h,a108 lcall prtlcd db '162.5',0 ljmp st a108: cjne a,#92h,a109 lcall prtlcd db '163.4',0 ljmp st a109: cjne a,#93h,a110 lcall prtlcd db '164.3',0 ljmp st a110: cjne a,#94h,a111 lcall prtlcd db '165.2',0 ljmp st a111: cjne a,#95h,a112 lcall prtlcd db '166.1',0 ljmp st a112: cjne a,#96h,a113 lcall prtlcd db '167.0',0 ljmp st a113: cjne a,#97h,a114 lcall prtlcd db '167.9',0 ljmp st a114: cjne a,#98h,a115 lcall prtlcd db '168.8',0 ljmp st a115: cjne a,#99h,a116 lcall prtlcd db '169.7',0 ljmp st a116: cjne a,#9ah,a117 lcall prtlcd db '170.6',0 ljmp st a117: cjne a,#9bh,a118 lcall prtlcd db '171.5',0 ljmp st a118: cjne a,#9ch,a119 lcall prtlcd db '172.4',0 ljmp st a119: cjne a,#9dh,a120 lcall prtlcd db '173.3',0 ljmp st a120: cjne a,#9eh,a121 lcall prtlcd db '174.2',0 ljmp st a121: cjne a,#9fh,a122 lcall prtlcd db '175.1',0 ljmp st a122: cjne a,#0a0h,a123 lcall prtlcd db '176.0',0 ljmp st a123: cjne a,#0a1h,a124 lcall prtlcd db '176.9',0 ljmp st a124: cjne a,#0a2h,a125 lcall prtlcd db '177.8',0 ljmp st a125: cjne a,#0a3h,a126 lcall prtlcd db '178.7',0 ljmp st a126: cjne a,#0a4h,a127 lcall prtlcd db '179.6',0 ljmp st a127: cjne a,#0a5h,a128 lcall prtlcd db '180.5',0 ljmp st a128: cjne a,#0a6h,a129 lcall prtlcd db '181.4',0 ljmp st a129: cjne a,#0a7h,a130 lcall prtlcd db '182.3',0 ljmp st a130: cjne a,#0a8h,a131 lcall prtlcd db '183.2',0 ljmp st a131: cjne a,#0a9h,a132 lcall prtlcd db '184.1',0 ljmp st a132: cjne a,#0aah,a133 lcall prtlcd db '185.0',0 ljmp st a133: cjne a,#0abh,a134 lcall prtlcd db '185.9',0 ljmp st a134: cjne a,#0ach,a135 lcall prtlcd db '186.8',0 ljmp st a135: cjne a,#0adh,a136 lcall prtlcd db '187.7',0 ljmp st a136: cjne a,#0aeh,a137 lcall prtlcd db '188.6',0 ljmp st a137: cjne a,#0afh,a138 lcall prtlcd db '189.5',0 ljmp st a138: cjne a,#0b0h,a139 lcall prtlcd db '190.4',0 ljmp st a139: cjne a,#0b1h,a140 lcall prtlcd db '191.3',0 ljmp st a140: cjne a,#0b2h,a141 lcall prtlcd db '192.2',0 ljmp st a141: cjne a,#0b3h,a142 lcall prtlcd db '193.1',0 ljmp st a142: cjne a,#0b4h,a143 lcall prtlcd db '194.0',0 ljmp st a143: cjne a,#0b5h,a144 lcall prtlcd db '194.9',0 ljmp st a144: cjne a,#0b6h,a145 lcall prtlcd db '195.8',0 ljmp st a145: cjne a,#0b7h,a146 lcall prtlcd db '196.7',0 ljmp st a146: cjne a,#0b8h,a147 lcall prtlcd db '197.6',0 ljmp st a147: cjne a,#0b9h,a148 lcall prtlcd db '198.5',0 ljmp st a148: cjne a,#0bah,a149 lcall prtlcd db '199.4',0 ljmp st a149: cjne a,#0bbh,a150 lcall prtlcd db '200.3',0 ljmp st a150: cjne a,#0bch,a151 lcall prtlcd db '201.2',0 ljmp st a151: cjne a,#0bdh,a152 lcall prtlcd db '202.1',0 ljmp st a152: cjne a,#0beh,a153 lcall prtlcd db '203.0',0 ljmp st a153: cjne a,#0bfh,a154 lcall prtlcd db '203.9',0 ljmp st a154: cjne a,#0c0h,a155 lcall prtlcd db '204.8',0 ljmp st a155: cjne a,#0c1h,a156 lcall prtlcd db '205.7',0 ljmp st a156: cjne a,#0c2h,a157 lcall prtlcd db '206.6',0 ljmp st a157: cjne a,#0c3h,a158 lcall prtlcd db '207.5',0 ljmp st a158: cjne a,#0c4h,a159 lcall prtlcd db '208.4',0 ljmp st a159: cjne a,#0c5h,a160 lcall prtlcd db '209.3',0 ljmp st a160: cjne a,#0c6h,a161 lcall prtlcd db '210.2',0 ljmp st a161: cjne a,#0c7h,a162 lcall prtlcd db '211.1',0 ljmp st a162: cjne a,#0c8h,a163 lcall prtlcd db '212.0',0 ljmp st a163: cjne a,#0c9h,a164 lcall prtlcd db '212.9',0 ljmp st a164: cjne a,#0cah,a165 lcall prtlcd db '213.8',0 ljmp st a165: cjne a,#0cbh,a166 lcall prtlcd db '214.7',0 ljmp st a166: cjne a,#0cch,a167 lcall prtlcd db '215.6',0 ljmp st a167: cjne a,0cdh,a168 lcall prtlcd db '216.5',0 ljmp st a168: cjne a,0ceh,a169 lcall prtlcd db '217.4',0 ljmp st a169: cjne a,0cfh,a170 lcall prtlcd db '218.3',0 ljmp st a170: cjne a,#0d0h,a171 lcall prtlcd db '219.2',0 ljmp st a171: cjne a,#0d1h,a172 lcall prtlcd db '220.1',0 ljmp st a172: cjne a,#0d2h,a173 lcall prtlcd db '221.0',0 ljmp st a173: cjne a,#0d3h,a174 lcall prtlcd db '221.9',0 ljmp st a174: cjne a,#0d4h,a175 lcall prtlcd db '222.8',0 ljmp st a175: cjne a,#0d5h,a176 lcall prtlcd db '223.7',0 ljmp st a176: cjne a,#0d6h,a177 lcall prtlcd db '224.6',0 ljmp st a177: cjne a,#0d7h,a178 lcall prtlcd db '225.5',0 ljmp st a178: cjne a,#0d8h,a179 lcall prtlcd db '226.4',0 ljmp st a179: cjne a,#0d9h,a180 lcall prtlcd db '227.3',0 ljmp st a180: cjne a,#0dah,a181 lcall prtlcd db '228.2',0 ljmp st a181: cjne a,#0dbh,a182 lcall prtlcd db '229.1',0 ljmp st a182: cjne a,#0dch,a183 lcall prtlcd db '230.0',0 ljmp st a183: cjne a,#0ddh,a184 lcall prtlcd db '230.9',0 ljmp st a184: cjne a,#0deh,a185 lcall prtlcd db '231.8',0 ljmp st a185: cjne a,#0dfh,a186 lcall prtlcd db '232.7',0 ljmp st a186: cjne a,#0e0h,a187 lcall prtlcd db '233.6',0 ljmp st a187: cjne a,#0e1h,a188 lcall prtlcd db '234.5',0 ljmp st a188: cjne a,#0e2h,a189 lcall prtlcd db '235.4',0 ljmp st a189: cjne a,#0e3h,a190 lcall prtlcd db '236.3',0 ljmp st a190: cjne a,#0e4h,a191 lcall prtlcd db '237.4',0 ljmp st a191: cjne a,#0e5h,a192 lcall prtlcd db '238.1',0 ljmp st a192: cjne a,#0e6h,a193 lcall prtlcd db '239.0',0 ljmp st a193: cjne a,#0e7h,a194 lcall prtlcd db '239.9',0 ljmp st a194: cjne a,#0e8h,a195 lcall prtlcd db '240.8',0 ljmp st a195: cjne a,#0e9h,a196 lcall prtlcd db '241.7',0 ljmp st a196: cjne a,#0eah,a197 lcall prtlcd db '242.6',0 ljmp st a197: cjne a,#0ebh,a198 lcall prtlcd db '243.5',0 ljmp st a198: cjne a,#0ech,a199 lcall prtlcd db '244.4',0 ljmp st a199: cjne a,#0edh,a200 lcall prtlcd db '245.3',0 ljmp st a200: cjne a,#0eeh,a201 lcall prtlcd db '246.2',0 ljmp st a201: cjne a,#0efh,a202 lcall prtlcd db '247.1',0 ljmp st a202: cjne a,#0f0h,a203 lcall prtlcd db '248.0',0 ljmp st a203: cjne a,#0f1h,a204 lcall prtlcd db '248.9',0 ljmp st a204: cjne a,#0f2h,a205 lcall prtlcd db '249.8',0 ljmp st a205: cjne a,#0f3h,a206 lcall prtlcd db '250.7',0 ljmp st a206: cjne a,#0f4h,a207 lcall prtlcd db '251.6',0 ljmp st a207: cjne a,#0f5h,a208 lcall prtlcd db '252.5',0 ljmp st a208: cjne a,#0f6h,a209 lcall prtlcd db '253.4',0 a209: cjne a,#0f7h,a210 lcall prtlcd db '254.3',0 ljmp st a210: cjne a,#0f8h,a211 lcall prtlcd db '255.2',0 ljmp st a211: cjne a,#0f9h,a212 lcall prtlcd db '256.1',0 ljmp st a212: cjne a,#0fah,a213 lcall prtlcd db '257.0',0 a213: ljmp st ; MAX CHIP TEMP = 257 DEG F. ; start of Serial communications routine with the 1620. out_cmd: clr p3.2 ; reset ds1620 setb p3.2 ; out_data: mov sbuf,a ; move data 'out' to ds1620 oops: jnb ti,oops ; loop here until all data is out clr ti ; clear ti bit 'transmit interupt' ret ; Now go back. in_data: setb ren ; enable receiver to clock in data wait_up: jnb ri,wait_up ; loop here until all data is received mov a,sbuf ; move data too ACC clr ren ; dissable receiver, prevent ; another reception clr ri ; clear ri 'receive interupt' ret ; Finished here , go back. resetlcd: clr lcd_rs ; reset LCD routine clr lcd_rw clr lcd_e mov r4,#30h setb lcd_e clr lcd_e mov a,#4 lcall delay mov lcd_data,#30h setb lcd_e clr lcd_e mov a,#1 lcall delay mov lcd_data,#30h setb lcd_e clr lcd_e mov a,#1 lcall delay mov r4,#config lcall wrlcdcom mov r4,#08h lcall wrlcdcom mov r4,#01h lcall wrlcdcom mov r4,#entrymode lcall wrlcdcom ret initlcd: clr lcd_rs ; initialize LCD routine. clr lcd_rw clr lcd_e mov r4,#38h lcall wrlcdcom mov r4,#0eh lcall wrlcdcom mov r4,#06h lcall wrlcdcom mov r4,#01h lcall wrlcdcom ret big_delay: mov r0,#1 ; delay routine. x0b: mov r2,#0ffh ; Crude But Effective! x1b: mov r5,#0ffh x2b: djnz r5,x2b djnz r2,x1b djnz r0,x0b ret wrlcdcom: clr lcd_e ; write 'command data' to LCD routine. clr lcd_rs clr lcd_rw mov lcd_data,r4 lcall pulseEwait ret pulseEwait: lcall delay ; delay needed for slower LCD's. clr lcd_e ; routine to see if LCD is still busy. setb lcd_e clr lcd_e mov lcd_data,#0ffh setb lcd_rw push acc pew: inc b setb lcd_e mov a,lcd_data clr lcd_e jb acc.7, pew pop acc ret prtlcd: pop dph ; prtlcd is our main display printing routine pop dpl ; this routine will print the information ; located directly below the calling routine. okee_doke: clr a ; the information after the ( DB ) statement. movc a,@a+dptr cjne a,#0,its_ok sjmp retprtlcd its_ok: mov r4,a lcall wrlcddata inc dptr ljmp okee_doke ret wrlcddata: clr lcd_e setb lcd_rs clr lcd_rw mov lcd_data,r4 lcall pulseEwait ret retprtlcd: mov a,#1h jmp @a+dptr placecur: dec acc ; this routine will place the cursor at a jnz line2 ; specific place : A holds the line, and mov a,b ; B holds the column locations ; when this routine is called. add a,#80h sjmp setcur line2: cjne a,#1,line3 mov a,b add a,#0c0h sjmp setcur line3: cjne a,#2,line4 mov a,b add a,#94h sjmp setcur line4: mov a,b add a,#0d4h setcur: mov r4,a lcall wrlcdcom ret delay: dec a d_olp: push acc mov a,#0a6h d_ilp: inc a nop nop nop nop nop nop nop nop pop acc djnz acc,d_olp mov a,#0a6h d_lp2: inc a nop nop nop nop nop nop nop nop jnz d_lp2 nop nop nop nop nop ret ; Begin routine to accept user entry of device programming setpoints. up1: mov p2,#0ffh lcall big_delay mov r6,#2ah ; starting value of 69.8 deg F. lcall resetlcd lcall initlcd mov a,#1 mov b,#0 lcall placecur lcall prtlcd db '* SELECT SETPOINTS *',0 mov a,#2 mov b,#0 lcall placecur lcall prtlcd db 'HIGH TEMP =>',0; set up for high temp entry up2: mov a,#2 ; line #2 on lcd mov b,#12 ; position #12 for temp entry lcall placecur mov a,r6 ; get high temp setting mov r1,#00h lcall look_up mov a,#2 mov b,#18 lcall placecur lcall prtlcd db 11011111b,01000110b,0 mov r4,#offcur lcall wrlcdcom lcall big_delay sjmp up_or_down up22: mov a,#2 mov b,#12 lcall placecur mov a,r6 lcall look_up lcall big_delay ; This is a ( KEY ) Routine here if we are going to use the Full Range ; of th DS1620. Some values will be the same Below & Above 32 deg. ; This routine sorts out whether or not it is below or above 32 deg F. ; From here to routine dn2a is kinda tricky. We need to load R1 with a 1 ; each time the temp display goes BELOW 32 deg F. When above or = to 32 ; R1 will be loaded with 0,s to indicate that we are ABOVE 32 ; Look carefully and you can see how its being done. up_or_down: jnb p2.0,up ; Is Up ( UP ) Key pressed? jnb p2.1,down ; Is Down ( DN ) key pressed? jnb p2.2,enter ; Is Enter ( EN ) Key pressed? sjmp up_or_down ; No Key Pressed, Wait Here. up: cjne r1,#00h,up1b cjne r6,#0FAh,up1a ; FAh = 257.0 deg F or 26.60 ; depending on R1 status. ljmp up22 up1a: inc r6 ljmp up22 up1b: cjne r6,#0ffh,up3 ; 0FFh = 31.10 deg F. mov r1,#00h inc r6 ljmp up22 up3: inc r6 ljmp up22 down: cjne r6,#00h,dn1 ; Is R6 = 32 deg F ? mov r1,#01h ; If it is load R1 with a 1 dn1: cjne r1,#01h,dn2 cjne r6,#92h,dn2 ; 92h = -67.0 or 163.4 Deg F ljmp up22 ; depending on the status of R1. ; dn2: dec r6 ; Dec R6 to next lowest value sjmp up22 ; Now go lookup that value for ; display on LCD. enter: jnb p2.2,enter ; Wait for Key to be let up. lcall big_delay ; Hey! it WORKS...... mov th_lsb,r6 ; Load TH LSB into storage. mov th_msb,r1 ; Load TH MSB into storage. mov r7,#2ah ; starting value of 69.8 deg F. mov a,#3 ; goto line #2. mov b,#0 ; position #0 lcall placecur ; lcall prtlcd db 'LOW TEMP =>',0; set up for Low Temp entry. check: mov a,#3 mov b,#12 lcall placecur mov a,r7 ; 69.8 deg F for initial display mov r1,#00h ; load R1 with 0,s cause we know lcall look_up ; the first value to be displayed mov a,#3 ; is gonna be above 32 deg, 69.8. mov b,#18 ; we establish a refference point lcall placecur ; by beginning with 69.8. lcall prtlcd db 11011111b,01000110b,0 mov r4,#offcur lcall wrlcdcom lcall big_delay sjmp sty check2: mov a,#3 mov b,#12 lcall placecur mov a,r7 lcall look_up lcall big_delay mov p2,#0ffh sty: jnb p2.0,increment ; UP keypress ? jnb p2.1,decrement ; DOWN ? jnb p2.2,pgm_ds1620 ; ENTER ? sjmp sty ; Wait here if ( NO KEYPRESS ). increment: cjne r1,#00h,inc2 cjne r7,#0FAh,inc1 ljmp check2 inc1: inc r7 ljmp check2 inc2: cjne r7,#0FFh,inc3 ; Is R7 = 31.10 deg F ? mov r1,#00h ; if it is load R1 with 0,s inc r7 ; inc R7 to 00H or 32 deg F ljmp check2 ; inc R7 from below 32 to 32. inc3: inc r7 sjmp check2 decrement: cjne r7,#00h,dn1a ; Check for 32 deg F. mov r1,#01h ; if it is then load R1 with 1. ; If R1 = 1 our temp is below 32. dn1a: cjne r1,#01h,dn2a cjne r7,#92h,dn2a ; if R1=1 & R7=92H cant go lower ljmp check2 ; so display our lowest temp with ; no more decrementing. dn2a: dec r7 ljmp check2 ; Here we begin the actual Programming Sequence of ; user selected setpoints. pgm_ds1620: jnb p2.2,pgm_ds1620 lcall big_delay mov tl_lsb,r7 ; Load stored temp values. mov tl_msb,r1 ; mov r4,#clrdsp lcall wrlcdcom mov a,#2 mov b,#0 lcall placecur lcall prtlcd db ' PROGRAMMING DS1620 ',0 lcall big_delay2 mov a,#0ch ; write config register command lcall out_cmd ; send it mov a,#02h ; CPU Mode, Continuous Convert lcall out_data lcall big_delay mov a,#01h ; issue write TH command lcall out_cmd mov a,th_lsb ; load LSB of High Temp lcall out_data ; send LSB of High Temp lcall big_delay mov a,th_msb ; load MSB of High Temp lcall out_data ; send MSB of High Temp lcall big_delay mov a,#02h ; issue write TL command lcall out_cmd ; send write TL command mov a,tl_lsb ; load LSB of Low Temp lcall out_data ; send LSB of Low Temp lcall big_delay mov a,tl_msb ; load MSB of Low Temp lcall out_data ; send MSB of Low Temp lcall big_delay ; delay after EEPROM write. clr p3.2 ; end communications with ds1620 lcall big_delay ljmp comin_back ; Re-initialize LCD. ; And start over. big_delay2: mov r0,#15 ; delay for message's xa1: mov r2,#0ffh ; I know , I know its prehistoric xb2: mov r5,#0ffh ; But it works. xc3: djnz r5,xc3 djnz r2,xb2 djnz r0,xa1 ret ; Display DS1620 setpoints for user verification on display. isr2: lcall resetlcd ; reset lcd lcall initlcd ; init lcd mov a,#2 mov b,#0 lcall placecur lcall prtlcd db ' FETCHING SETPOINTS ',0 mov r4,#offcur lcall wrlcdcom lcall big_delay2 lcall resetlcd lcall initlcd mov a,#2 mov b,#0 lcall placecur lcall prtlcd db 'HIGH SET =',0 ; print @ line #2 position #0 mov a,#3 ; line #3 mov b,#0 ; position #0 lcall placecur lcall prtlcd db 'LOW SET =',0 lcall get_temp ; Fetch setpoints. mov a,#2 ; select lcd line #2 mov b,#11 ; position #11 begin ; print high tmp lcall placecur mov a,r6 ; fetch high temp setting ; from R6 mov r1,th_msb lcall look_up ; print high setting mov a,#2 mov b,#17 lcall placecur ; print deg F after temp lcall prtlcd db 11011111b,01000110b,0 ; Data for deg F symbol mov a,#3 ; line #3 on lcd mov b,#11 ; position #11 lcall placecur mov a,r7 ; fetch low temp setting ; from R7 mov r1,tl_msb lcall look_up ; print low set temp mov a,#3 ; line #3 mov b,#17 ; position #17 lcall placecur lcall prtlcd db 11011111b,01000110b,0 ; deg F symbol mov r4,#offcur lcall wrlcdcom lcall big_delay2 hold_it: jnb p2.4,hold_it ; Key still down?, if so stay here. lcall big_delay ; Key up then De-Bounce and return. ret ; Establish communications with 1620, and fetch High & Low memory settings ; from EEprom on device. get_temp: mov a,#0a1h ; Load ( READ TH ) instruction. lcall out_cmd ; Issue instruction. lcall in_data ; Read in data mov r6,a ; Move data to R6 lcall in_data ; mov th_msb,a ; TH MSB mov a,#0a2h ; Load ( READ TL ) instruction. lcall out_cmd ; Issue instruction. lcall in_data mov r7,a ; TL LSB lcall in_data mov tl_msb,a ; TL MSB mov a,#0fh lcall delay clr p3.2 ; terminate comm with ds1620 ret ; return to calling routine. ; WHEW ! ; That's all folks. END