⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 temp_adc.lst

📁 it is temperature display using 89c51 which has asm language and hex files good to try
💻 LST
📖 第 1 页 / 共 4 页
字号:
01C7 12056F          230            lcall data_routine
TEMP_ADC                                                                                                      PAGE 5

01CA 851A11          231            mov disp_data,sampleno0
01CD 12056F          232            lcall data_routine
01D0 22              233            ret
01D1                 234    check_thsold:;routine compare temp value with threshold values
01D1 E525            235            mov a,tval1
01D3 540F            236            anl a,#0fh
01D5 75F00A          237            mov b,#0ah
01D8 A4              238            mul ab
01D9 F8              239            mov r0,a
01DA E526            240            mov a,tval0
01DC 540F            241            anl a,#0fh
01DE 28              242            add a,r0
01DF F9              243            mov r1,a ;hex value of current temperature
01E0 E523            244            mov a,threshold1                                
01E2 540F            245            anl a,#0fh
01E4 75F00A          246            mov b,#0ah
01E7 A4              247            mul ab
01E8 F8              248            mov r0,a
01E9 E524            249            mov a,threshold0
01EB 540F            250            anl a,#0fh
01ED 28              251            add a,r0 ;hex value of threshold temperature 
01EE C3              252            clr c
01EF 99              253            subb a,r1
01F0 5004            254            jnc temp_notmore
01F2                 255    temp_more: 
01F2 D2A4            256            setb buzzer ;Buzzer on if current temperature more than threshold value
01F4 8002            257            sjmp check_over
01F6 C2A4            258    temp_notmore: clr buzzer ;Buzzer off if current temperature more than threshold value
01F8 22              259    check_over: ret
01F9                 260    wait_time: ;This routine is used to provide measuring interval delay
01F9 C2A6            261            clr wrr
01FB C298            262            clr ri
01FD D2A3            263            setb led1
01FF E521            264            mov a,interval1
0201 540F            265            anl a,#0fh
0203 B40002          266            cjne a,#00h,not_zero
0206 8018            267            sjmp lsb_digit          
0208 75F00A          268    not_zero: mov b,#0ah
020B A4              269            mul ab
020C F8              270            mov r0,a
020D D2A0            271            setb Ekey
020F 7B04            272    herer0: mov r3,#04h
0211 7CE0            273    here1_i1: mov r4,#0E0h
0213 7DFF            274    here2_i2: mov r5,#0ffh
0215 00              275    here3_i3: nop
0216 00              276              nop
0217 00              277              nop
0218 DDFB            278            djnz r5,here3_i3
021A DCF7            279            djnz r4,here2_i2
021C DBF3            280            djnz r3,here1_i1
021E D8EF            281            djnz r0,herer0
0220                 282    lsb_digit:
0220 E522            283            mov a,interval0
0222 540F            284            anl a,#0fh
0224 B40002          285            cjne a,#00h,not_zero1   
0227 8010            286            sjmp wait_over
0229 F8              287    not_zero1: mov r0,a
022A 7B04            288    herer01:mov r3,#04h
TEMP_ADC                                                                                                      PAGE 6

022C 7CE0            289    here1_ii1:mov r4,#0e0h
022E 7DFF            290    here2_ii2:mov r5,#0ffh
0230 00              291    here3_ii3: nop
0231 DDFD            292            djnz r5,here3_ii3
0233 DCF9            293            djnz r4,here2_ii2
0235 DBF5            294            djnz r3,here1_ii1
0237 D8F1            295            djnz r0,herer01
0239 C2A3            296    wait_over: clr led1
023B 12059B          297            lcall delay140m
023E 12059B          298            lcall delay140m
0241 D2A6            299            setb wrr
0243 22              300            ret
0244                 301    welcome_msg: ;This routine displays the welcome message at power on
0244 00              302            nop
0245                 303    scrolling: ;startting cursor position from where scrolling starts
0245 75148F          304            mov scroll,#8fh
0248                 305    scrollagain:
0248 120534          306            lcall clear_lcd         
024B 120544          307            lcall cursoroff 
024E 851412          308            mov lcdcom,scroll
0251 120552          309            lcall command
0254 900700          310            mov dptr,#700h  ;string "Major project" display on LCD
0257 1204F7          311            lcall display_text                      
025A E514            312            mov a,scroll
025C 14              313            dec a
025D F514            314            mov scroll,a
025F 12059B          315            lcall delay140m
0262 B47FE3          316            cjne a,#7fh,scrollagain                 
0265 1205A4          317            lcall delay1sec
0268 1205A4          318            lcall delay1sec
026B 120534          319            lcall clear_lcd
026E 7A00            320            mov r2,#00h
0270                 321    flash_again:
0270 900710          322            mov dptr,#710h  ;string "Data acquisition" dispaly on LCD
0273 1204F7          323            lcall display_text
0276 120592          324            lcall delay14m
0279 7512C0          325            mov lcdcom,#0c0h
027C 120552          326            lcall command
027F 900720          327            mov dptr,#0720h ;string "System" display on second line of LCD
0282 1204F7          328            lcall display_text
0285 1205A4          329            lcall delay1sec
0288 12059B          330            lcall delay140m
028B 120534          331            lcall clear_lcd
028E 12059B          332            lcall delay140m
0291 12059B          333            lcall delay140m
0294 12059B          334            lcall delay140m
0297 0A              335            inc r2
0298 EA              336            mov a,r2
0299 B402D4          337            cjne a,#02h,flash_again ;message on LCD blinks fro 2 times      
029C 22              338            ret
029D                 339    calculations: ;routine converts the adc 8 bit output to 2-digit temperature value in ASCII
029D E529            340            mov a,temp
029F 75F00A          341            mov b,#0ah
02A2 84              342            div ab
02A3 F545            343            mov out2,a
02A5 85F046          344            mov out1,b
02A8 434530          345            orl out2,#30h
02AB 434630          346            orl out1,#30h
TEMP_ADC                                                                                                      PAGE 7

02AE 22              347            ret     
02AF                 348    division_16: ;32 bit by 16 bit division 
02AF 7F00            349            MOV     R7,#0   ;msb remiander
02B1 7E00            350            MOV     R6,#0   ;lsb remiander  ;zero out partial remainder
02B3 754B00          351            MOV     TMP_0,#0
02B6 754A00          352            MOV     TMP_1,#0
02B9 754900          353            MOV     TMP_2,#0
02BC 754800          354            MOV     TMP_3,#0
02BF A93C            355            MOV     R1,hex1 ;load divisor
02C1 A83D            356            MOV     R0,hex0
02C3 7D20            357            MOV     R5,#32  ;loop count
02C5                 358    Div_loop:
02C5 1202F8          359            LCALL    Shift_D ;shift the dividend and return MSB in C
02C8 EE              360            MOV     A,R6 ;shift carry into LSB of partial remainder
02C9 33              361            RLC     A
02CA FE              362            MOV     R6,A
02CB EF              363            MOV     A,R7
02CC 33              364            RLC     A
02CD FF              365            MOV     R7,A
02CE C3              366            CLR     C
02CF EF              367            MOV     A,R7 ;subtract R1 from R7 to see if R1 < R7
02D0 99              368            SUBB    A,R1 ;A = R7 - R1, carry set if R7 < R1
02D1 4012            369            JC      Cant_sub
02D3 7005            370            JNZ     Can_sub ;jump if R7>R1
02D5 C3              371            CLR     C
02D6 EE              372            MOV     A,R6
02D7 98              373            SUBB    A,R0  ;A = R6 - R0, carry set if R6 < R0
02D8 400B            374            JC      Cant_sub
02DA C3              375    Can_sub:CLR     C
02DB EE              376            MOV     A,R6
02DC 98              377            SUBB    A,R0  ; A = R6 - R0
02DD FE              378            MOV     R6,A
02DE EF              379            MOV     A,R7
02DF 99              380            SUBB    A,R1  ; A = R7 - R1 - Borrow
02E0 FF              381            MOV     R7,A
02E1 D3              382            SETB    C     ; shift a 1 into the quotient
02E2 0202E6          383            ljmp     Quot
02E5 C3              384    Cant_sub: CLR     C
02E6 12030E          385    Quot:   LCALL    Shift_Q   ; Test for competion
02E9 DDDA            386            DJNZ    R5,Div_loop ; Now we are all done, move the TMP values back into OP
02EB 854B3B          387            MOV     t00,TMP_0
02EE 854A3A          388            MOV     t11,TMP_1
02F1 854939          389            MOV     t2,TMP_2
02F4 854838          390            MOV     t3,TMP_3
02F7 22              391            RET
02F8 C3              392    Shift_D:CLR     C
02F9 E53B            393            MOV     A,t00
02FB 33              394            RLC     A
02FC F53B            395            MOV     t00,A
02FE E53A            396            MOV     A,t11
0300 33              397            RLC     A
0301 F53A            398            MOV     t11,A
0303 E539            399            MOV     A,t2
0305 33              400            RLC     A
0306 F539            401            MOV     t2,A
0308 E538            402            MOV     A,t3
030A 33              403            RLC     A
030B F538            404            MOV     t3,A
TEMP_ADC                                                                                                      PAGE 8

030D 22              405            RET
030E E54B            406    Shift_Q:MOV     A,TMP_0
0310 33              407            RLC     A
0311 F54B            408            MOV     TMP_0,A
0313 E54A            409            MOV     A,TMP_1
0315 33              410            RLC     A
0316 F54A            411            MOV     TMP_1,A
0318 E549            412            MOV     A,TMP_2
031A 33              413            RLC     A
031B F549            414            MOV     TMP_2,A
031D E548            415            MOV     A,TMP_3
031F 33              416            RLC     A
0320 F548            417            MOV     TMP_3,A
0322 22              418            RET
0323                 419    hex_to_dec: ;Routine convert 4 byte hex into 8 digit decimal ascii
0323 754000          420            mov out7,#00h ;Input in t3,t2,t1,t0 and output in out7,out6,out5,out4,out3,out2,out1
                                                                               ,out0 variables
0326 754100          421            mov out6,#00h
0329 754200          422            mov out5,#00h
032C 754300          423            mov out4,#00h
032F 754400          424            mov out3,#00h
0332 754500          425            mov out2,#00h
0335 754600          426            mov out1,#00h
0338 754700          427            mov out0,#00h
033B 753C00          428            mov hex1,#00h
033E 753D0A          429            mov hex0,#0ah
0341 E539            430            mov a,t2
0343 B4002D          431            cjne a,#00h,xbn56
0346 E53A            432            mov a,t11
0348 B4000F          433            cjne a,#00h,xbn57                       
034B 1202AF          434            lcall division_16               
034E 8E47            435            mov out0,r6
0350 1202AF          436            lcall division_16
0353 8E46            437            mov out1,r6
0355 853B45          438            mov out2,t00
0358 803F            439            sjmp over56
035A 1202AF          440    xbn57:  lcall division_16
035D 8E47            441            mov out0,r6
035F 1202AF          442            lcall division_16   
0362 8E46            443            mov out1,r6
0364 1202AF          444            lcall division_16        
0367 8E45            445            mov out2,r6
0369 1202AF          446            lcall division_16         
036C 8E44            447            mov out3,r6
036E 853B43          448            mov out4,t00
0371 8026            449            sjmp over56
0373 1202AF          450    xbn56:  lcall division_16        
0376 8E47            451            mov out0,r6
0378 1202AF          452            lcall division_16       
037B 8E46            453            mov out1,r6
037D 1202AF          454            lcall division_16      
0380 8E45            455            mov out2,r6
0382 1202AF          456            lcall division_16      
0385 8E44            457            mov out3,r6
0387 1202AF          458            lcall division_16     
038A 8E43            459            mov out4,r6

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -