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
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