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

📄 temp_adc.lst

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

                       1    
                       2    ;***Temperature measurement system***
                       3            $MOD51 ;variables declaration
  00A2                 4            aux1            equ 0a2h                                
  0010                 5            count           equ 10h
  0011                 6            disp_data       equ 11h ;lcd data variable
  0012                 7            lcdcom          equ 12h ;lcd command variable
  0013                 8            counter         equ 13h
  0014                 9            scroll          equ 14h                                 
  0018                10            sampleno2       equ 18h ;3 digit sample no variables
  0019                11            sampleno1       equ 19h
  001A                12            sampleno0       equ 1ah
  0021                13            interval1       equ 21h ;2 digit recording interval
  0022                14            interval0       equ 22h
  0023                15            threshold1      equ 23h ;2 digit threshold value in degree celcius
  0024                16            threshold0      equ 24h
  0025                17            tval1           equ 25h ;2 digit temperature value in degree celcius
  0026                18            tval0           equ 26h
  0029                19            temp            equ 29h
  0038                20            t3              equ 38h ;temperory variables
  0039                21            t2              equ 39h
  003A                22            t11             equ 3ah
  003B                23            t00             equ 3bh
  003C                24            hex1            equ 3ch
  003D                25            hex0            equ 3dh
  003E                26            m641            equ 3eh
  003F                27            m640            equ 3fh
  0040                28            out7            equ 40h                         
  0041                29            out6            equ 41h
  0042                30            out5            equ 42h
  0043                31            out4            equ 43h
  0044                32            out3            equ 44h
  0045                33            out2            equ 45h
  0046                34            out1            equ 46h
  0047                35            out0            equ 47h
  0048                36            TMP_3           equ 48h
  0049                37            TMP_2           equ 49h
  004A                38            TMP_1           equ 4ah
  004B                39            TMP_0           equ 4bh
  004C                40            rem1            equ 4ch
  004D                41            rem0            equ 4dh
  00A0                42            Ekey            equ 0a0h ;input keys address location
  00A1                43            dkey            equ 0a1h
  00A2                44            ukey            equ 0a2h
  00A3                45            led1            equ 0a3h
  00A4                46            buzzer          equ 0a4h ;buzzer location
  00A5                47            intr            equ 0a5h ;ADC handle shake signals address location
  00A6                48            wrr             equ 0a6h                                
  00A7                49            rdd             equ 0a7h
  0080                50            adc_data        equ 80h  ;ADC data 1 byte bus address
0000                  51            org 0000h       
0000                  52    start_program:
0000 758150           53            mov sp,#50h
0003 C2A3             54            clr led1        ;reset leds and buzzer
0005 C2A4             55            clr buzzer
0007 751000           56            mov count,#00h
000A 751300           57            mov counter,#00h
000D 12050F           58            lcall lcd_initialize ;initialize lcd
TEMP_ADC                                                                                                      PAGE 2

0010 120592           59            lcall delay14m
0013 120244           60            lcall welcome_msg ;welcome strings display
0016 120534           61            lcall clear_lcd
0019 900730           62            mov dptr,#0730h ;string "Enter parameters" display on LCD 
001C 1204F7           63            lcall display_text
001F 1205A4           64            lcall delay1sec
0022 12054B           65            lcall cursoron  ;display cursor on LCD 
0025 C298             66            clr ri
0027 752130           67            mov interval1,#30h
002A 752231           68            mov interval0,#31h ;Initialize recording interval to 01 sec
002D 120534           69            lcall clear_lcd ;clear the LCD
0030 900740           70            mov dptr,#0740h ;string "measuring interval" display on lcd"
0033 1204F7           71            lcall display_text 
0036 120592           72            lcall delay14m
0039 7512C5           73            mov lcdcom,#0c5h ;set cursor position
003C 120552           74            lcall command   ;routine to command the LCD
003F 852111           75            mov disp_data,interval1
0042 12056F           76            lcall data_routine ;routine to display a ASCII character on the current LCD cursor p
                                                                               osition
0045 852211           77            mov disp_data,interval0
0048 12056F           78            lcall data_routine
004B 751120           79            mov disp_data,#' '
004E 12056F           80            lcall data_routine
0051 751173           81            mov disp_data,#'s'
0054 12056F           82            lcall data_routine                              
0057 751165           83            mov disp_data,#'e'
005A 12056F           84            lcall data_routine      
005D 751163           85            mov disp_data,#'c'
0060 12056F           86            lcall data_routine
0063                  87    again_keyi:
0063 7512C6           88            mov lcdcom,#0c6h
0066 120552           89            lcall command
0069 D2A2             90            setb ukey ;Scanning the input keys
006B D2A1             91            setb dkey
006D D2A0             92            setb Ekey               
006F 20A207           93    upi:    jb ukey,downi   ;UP key         
0072 7401             94            mov a,#01h
0074 1204A0           95            lcall intfound  ;routine to keep measuring interval in range from 01 to 99 secs
0077 8008             96            sjmp Enteri
0079 20A105           97    downi:  jb dkey,Enteri  ;DOWN key
007C 7402             98            mov a,#02h
007E 1204A0           99            lcall intfound
0081 20A0DF          100    Enteri: jb Ekey,again_keyi ;Enter key
0084 12059B          101            lcall delay140m  ;debouncing delay
0087 12059B          102            lcall delay140m
008A C298            103            clr ri
008C 752332          104            mov threshold1,#32h ;initialize threshold value of temperature to 20 degree celcius
                                                                               
008F 752430          105            mov threshold0,#30h
0092 120534          106            lcall clear_lcd
0095 900750          107            mov dptr,#0750h ;string "threshold value" display on LCD
0098 1204F7          108            lcall display_text
009B 7512C5          109            mov lcdcom,#0c5h
009E 120552          110            lcall command
00A1 852311          111            mov disp_data,threshold1
00A4 12056F          112            lcall data_routine
00A7 852411          113            mov disp_data,threshold0
00AA 12056F          114            lcall data_routine
TEMP_ADC                                                                                                      PAGE 3

00AD 751120          115            mov disp_data,#' '
00B0 12056F          116            lcall data_routine
00B3 751143          117            mov disp_data,#'C'
00B6 12056F          118            lcall data_routine              
00B9 00              119            nop
00BA                 120    again_keyt:
00BA 7512C6          121            mov lcdcom,#0c6h
00BD 120552          122            lcall command
00C0 D2A2            123            setb ukey
00C2 D2A1            124            setb dkey
00C4 D2A0            125            setb Ekey               
00C6 20A207          126    upt:    jb ukey,downt
00C9 7401            127            mov a,#01h
00CB 120449          128            lcall thfound ;routine to  keep threshold value from 20 to 49 degree celcius
00CE 8008            129            sjmp Entert
00D0 20A105          130    downt:  jb dkey,Entert
00D3 7402            131            mov a,#02h
00D5 120449          132            lcall thfound
00D8 20A0DF          133    Entert: jb Ekey,again_keyt
00DB 12059B          134            lcall delay140m 
00DE 12059B          135            lcall delay140m
00E1 120534          136            lcall clear_lcd
00E4 900760          137            mov dptr,#0760h ;string "Parameter saved" display on LCD
00E7 1204F7          138            lcall display_text
00EA 1205A4          139            lcall delay1sec
00ED                 140    start_sample:   
00ED 751A30          141            mov sampleno0,#30h ;initializing no of samples to zero
00F0 751930          142            mov sampleno1,#30h
00F3 751830          143            mov sampleno2,#30h
00F6 120534          144            lcall clear_lcd                                         
00F9 900770          145            mov dptr,#0770h ;string "temperature" display on LCD
00FC 1204F7          146            lcall display_text                              
00FF 7512C0          147            mov lcdcom,#0c0h
0102 120552          148            lcall command   ;string "samples no." dispaly on LCD
0105 900780          149            mov dptr,#0780h
0108 1204F7          150            lcall display_text
010B 120544          151            lcall cursoroff ;make cursor off
010E 00              152    sample_again: nop       
010F 120127          153    no_Ser: lcall start_adc ;start the adc to measure temp
0112 120133          154            lcall read_adc  ;read adc byte
0115 120146          155            lcall get_temp  ;convert adc byte into temperature and record into the flash
0118 120150          156            lcall update_sample ;increase no of samples by one
011B 12018E          157            lcall show_temp  ;display temp on lcd 
011E 1201D1          158            lcall check_thsold ;compare the temperature with the threshold value
0121 1201F9          159            lcall wait_time ;waiting time according to recording interval
0124 02010E          160            ljmp sample_again
                     161    ;***SUBROUTINES*** start the conversion of ADC.
0127                 162    start_adc: ;conversion frequency is around 640KHz
0127 C2A3            163            clr led1
0129 C2B6            164            clr wr
012B 120592          165            lcall delay14m
012E D2B6            166            setb wr
0130 D2A5            167            setb intr                               
0132 22              168            ret
0133                 169    read_adc: ;read the digital output from ADC
0133 7580FF          170            mov adc_data,#0ffh
0136 120592          171    adc_not:lcall delay14m
0139 D2A7            172            setb rdd
TEMP_ADC                                                                                                      PAGE 4

013B C2A7            173            clr rdd
013D E580            174            mov a,adc_data
013F D2A5            175            setb intr
0141 D2A7            176            setb rdd
0143 F529            177            mov temp,a
0145 22              178            ret
0146                 179    get_temp:;convert adc digital output into temperature 
0146 12029D          180            lcall calculations ;and store its 2 digit value into flash
0149 854525          181            mov tval1,out2  ;current temp value in tval1 and tval0
014C 854626          182            mov tval0,out1
014F                 183            gett_over:
014F 22              184            ret
0150                 185    update_sample: ;routine increase number of samples by one
0150 531A0F          186            anl sampleno0,#0fh
0153 53190F          187            anl sampleno1,#0fh
0156 53180F          188            anl sampleno2,#0fh
0159 753800          189            mov t3,#00h
015C 851839          190            mov t2,sampleno2
015F 85193A          191            mov t11,sampleno1
0162 851A3B          192            mov t00,sampleno0
0165 1203B2          193            lcall dec_to_hex ;convert decimal to hexadecimal value
0168 C3              194            clr c
0169 E53D            195            mov a,hex0 ;add one to hex value of no of samples
016B 2401            196            add a,#01h
016D F53D            197            mov hex0,a
016F E53C            198            mov a,hex1
0171 3400            199            addc a,#00h
0173 F53C            200            mov hex1,a
0175 753800          201            mov t3,#00h
0178 753900          202            mov t2,#00h
017B 853C3A          203            mov t11,hex1
017E 853D3B          204            mov t00,hex0                            
0181 120323          205            lcall hex_to_dec ;convert hex value to decimal number 
0184 854518          206            mov sampleno2,out2
0187 854619          207            mov sampleno1,out1
018A 85471A          208            mov sampleno0,out0
018D 22              209            ret
018E                 210    show_temp: ;routine to display 2 digit temperature to LCD
018E 75128B          211            mov lcdcom,#8bh
0191 120552          212            lcall command
0194 75113A          213            mov disp_data,#':'
0197 12056F          214            lcall data_routine
019A 852511          215            mov disp_data,tval1
019D 12056F          216            lcall data_routine
01A0 852611          217            mov disp_data,tval0
01A3 12056F          218            lcall data_routine
01A6 751120          219            mov disp_data,#' '
01A9 12056F          220            lcall data_routine
01AC 751143          221            mov disp_data,#'C'
01AF 12056F          222            lcall data_routine
01B2 7512CB          223            mov lcdcom,#0cbh
01B5 120552          224            lcall command
01B8 75113A          225            mov disp_data,#':'
01BB 12056F          226            lcall data_routine
01BE 851811          227            mov disp_data,sampleno2
01C1 12056F          228            lcall data_routine
01C4 851911          229            mov disp_data,sampleno1

⌨️ 快捷键说明

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