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

📄 dvm.lst

📁 A Digital Thermometer Using the AT89C2051 MCU
💻 LST
📖 第 1 页 / 共 3 页
字号:
MCS-51 MACRO ASSEMBLER    DVM                                                                       07/31/95   PAGE    1


DOS 5.0 (038-N) MCS-51 MACRO ASSEMBLER, V2.3
OBJECT MODULE PLACED IN DVM.OBJ
ASSEMBLER INVOKED BY:  C:\LANG\ASM51\ASM51.EXE DVM.ASM
                       

LOC  OBJ            LINE     SOURCE

                       1                     NAME    DVM
                       2     
                       3     ; This program implements a simple two-digit voltmeter, utilizing an
                       4     ; AT89Cx051 microcontroller, two resistors, a capacitor and two HP5082-7300
                       5     ; decimal LED displays. The code is compatible with both the AT89C1051 and
                       6     ; AT89C2051 when operating with a 12 MHz clock. Code modifications may be
                       7     ; required for operation at a different clock rate.
                       8     ;
                       9     ; The voltmeter application demonstrates the RC analog-to-digital conversion
                      10     ; method. The microcontroller uses an output pin, which swings from ground to
                      11     ; Vcc, to alternately charge and discharge the capacitor through a resistor.
                      12     ; Utilizing the internal comparator, the microcontroller measures the time
                      13     ; required for the voltage on the capacitor to match the unknown voltage and
                      14     ; uses the result as an index into a table. The table contains display values
                      15     ; corresponding to the capacitor voltage. Each display value is encoded in
                      16     ; one byte as two BCD digits, which are displayed as volts and tenths of a
                      17     ; volt on the two decimal displays. There is no software hysteresis, so the
                      18     ; display may oscillate at a transition voltage.
                      19     ;
                      20     ; The conversion routine, ADC, is general purpose, returning the entry in
                      21     ; the table which corresponds to the measured time. The table contents may
                      22     ; be modified to any data format required by an application.
                      23     ;
                      24     ; The NOP instructions in the conversion routine are used to delay the first
                      25     ; sample in the charge and discharge portions of the measurement cycle.
                      26     ; The amount of delay has an effect on measurement accuracy, and the number
                      27     ; of NOPs may be adjusted (slightly) for best results.
                      28     ;
                      29     ; SCOUNT is defined as the minimum number of samples which must be taken to
                      30     ; guarantee that the voltage on the capacitor has reached Vcc/2. TCHARGE and
                      31     ; TDISCHARGE are defined as the minimum time required for the voltage on the
                      32     ; capacitor to approach within 1/2 delta V of Vcc and ground, respectively.
                      33     ; The minimum conversion time is approximately TCHARGE + TDISCHARGE, or
                      34     ; six milliseconds. The maximum conversion time is approximately TCHARGE +
                      35     ; TDISCHARGE + 2 * (5 microseconds * SCOUNT), or seven milliseconds.
                      36     ;
                      37     ; For additional information refer to the application note.
                      38     
                      39     
  004F                40     SCOUNT          EQU     79              ; minimum samples to reach Vcc/2
  0003                41     TCHARGE         EQU     3               ; cap charge time, in milliseconds
  0003                42     TDISCHARGE      EQU     3               ; cap discharge time, in milliseconds
                      43     
                      44     
----                  45                     DSEG AT 0020H
                      46     
0020                  47                     ORG     0020H           ; stack origin
0020                  48     stack:          DS      0020H           ; stack depth
                      49     
                      50     
MCS-51 MACRO ASSEMBLER    DVM                                                                       07/31/95   PAGE    2


LOC  OBJ            LINE     SOURCE

----                  51                     CSEG
                      52     
0000                  53                     ORG     0000H           ; power on/reset vector
0000 0200E0           54                     jmp     on_reset
                      55     
0003                  56                     ORG     0003H           ; external interrupt 0 vector
0003 32               57                     reti                    ; undefined
                      58     
000B                  59                     ORG     000BH           ; timer 0 overflow vector
000B 32               60                     reti                    ; undefined
                      61     
0013                  62                     ORG     0013H           ; external interrupt 1 vector
0013 32               63                     reti                    ; undefined
                      64     
001B                  65                     ORG     001BH           ; timer 1 overflow vector
001B 32               66                     reti                    ; undefined
                      67     
0023                  68                     ORG     0023H           ; serial I/O interrupt vector
0023 32               69                     reti                    ; undefined
                      70     
0040                  71                     ORG     0040H           ; begin constant data space
                      72     
                      73 +1  $INCLUDE(vtable.asm)                    ; get lookup table
                =1    74     ; Table of display values for two-digit DVM. Display values are stored in
                =1    75     ; packed BCD form, two digits per byte. The most significant digit is Volts,
                =1    76     ; the least significant is tenths of a Volt. The comment at the end of each
                =1    77     ; line shows the number of the table entry and the corresponding voltage.
                =1    78     ;
                =1    79     ; The number of entries in the table is 158, which is twice the number of
                =1    80     ; samples per half cycle (79).
                =1    81     ; For the first half of the table, the voltages are obtained by solving:
                =1    82     ;                       V = 5(1-e^(-N(9.3633*10^-3)))
                =1    83     ; for sample N = 0..78.
                =1    84     ; For the second half of the table, the voltages are obtained by solving:
                =1    85     ;                       V = 5*e^(-N(9.3633*10^-3)).
                =1    86     ; for sample N = 0..78.
                =1    87     ; The values used to create the equations: sample interval = 5 microseconds;
                =1    88     ; resistor = 267 kilohms; capacitor = 2 nanofarads; Vcc = 5.00 Volts.
                =1    89     ; For additional information refer to the text of the application note.
                =1    90     
                =1    91     VoltTable:
0040 00         =1    92                     DB      00h     ; 0    0.000
0041 01         =1    93                     DB      01h     ; 1    0.047
0042 01         =1    94                     DB      01h     ; 2    0.093
0043 02         =1    95                     DB      02h     ; 3    0.138
0044 02         =1    96                     DB      02h     ; 4    0.184
0045 03         =1    97                     DB      03h     ; 5    0.229
0046 03         =1    98                     DB      03h     ; 6    0.273
0047 03         =1    99                     DB      03h     ; 7    0.317
0048 04         =1   100                     DB      04h     ; 8    0.361
0049 04         =1   101                     DB      04h     ; 9    0.404
004A 05         =1   102                     DB      05h     ; 10   0.447
004B 05         =1   103                     DB      05h     ; 11   0.489
004C 06         =1   104                     DB      06h     ; 12   0.531
004D 06         =1   105                     DB      06h     ; 13   0.573
MCS-51 MACRO ASSEMBLER    DVM                                                                       07/31/95   PAGE    3


LOC  OBJ            LINE     SOURCE

004E 06         =1   106                     DB      06h     ; 14   0.614
004F 07         =1   107                     DB      07h     ; 15   0.655
0050 07         =1   108                     DB      07h     ; 16   0.696
0051 08         =1   109                     DB      08h     ; 17   0.736
0052 08         =1   110                     DB      08h     ; 18   0.776
0053 08         =1   111                     DB      08h     ; 19   0.815
0054 09         =1   112                     DB      09h     ; 20   0.854
0055 09         =1   113                     DB      09h     ; 21   0.893
0056 10         =1   114                     DB      10h     ; 22   0.931
0057 10         =1   115                     DB      10h     ; 23   0.969
0058 10         =1   116                     DB      10h     ; 24   1.006
0059 11         =1   117                     DB      11h     ; 25   1.044
005A 11         =1   118                     DB      11h     ; 26   1.080
005B 11         =1   119                     DB      11h     ; 27   1.117
005C 12         =1   120                     DB      12h     ; 28   1.153
005D 12         =1   121                     DB      12h     ; 29   1.189
005E 12         =1   122                     DB      12h     ; 30   1.224
005F 13         =1   123                     DB      13h     ; 31   1.260
0060 13         =1   124                     DB      13h     ; 32   1.295
0061 13         =1   125                     DB      13h     ; 33   1.329
0062 14         =1   126                     DB      14h     ; 34   1.363
0063 14         =1   127                     DB      14h     ; 35   1.397
0064 14         =1   128                     DB      14h     ; 36   1.431
0065 15         =1   129                     DB      15h     ; 37   1.464
0066 15         =1   130                     DB      15h     ; 38   1.497
0067 15         =1   131                     DB      15h     ; 39   1.530
0068 16         =1   132                     DB      16h     ; 40   1.562
0069 16         =1   133                     DB      16h     ; 41   1.594
006A 16         =1   134                     DB      16h     ; 42   1.626
006B 17         =1   135                     DB      17h     ; 43   1.657
006C 17         =1   136                     DB      17h     ; 44   1.688
006D 17         =1   137                     DB      17h     ; 45   1.719
006E 18         =1   138                     DB      18h     ; 46   1.750

⌨️ 快捷键说明

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