The digital thermometer application is done by converting temperature into digital data so that it can be processed by the microcontroller. The conversion process is first done by converting temperature into analog voltage and continued by converting analog voltage into digital data.
Figure 1 System Block Diagram
Conversion of temperature to analog voltage is done by using LM35 type temperature sensor where this sensor can operate using source voltage between 4 -- 30 volts DC. The output of this sensor will increase by 10 mV for every degree Celsius so that the following equation is obtained:
VLM35 = Temperature * 10 mV
The ADC-0809 module is an analog to digital voltage conversion module with the following specifications:
- 8 bit digital conversion
- 1 LSB Resolution
- Maximum input voltage 5Volt
Therefore the accuracy of this module in voltage units is:
With an accuracy tolerance of 19.6 mV, the LM35 output which has a 10 mV increase for every degree Celsius cannot be directly connected to the ADC-0809 Module. An accuracy tolerance greater than the measured voltage increase level will cause errors in measurement. To avoid such errors, the measured voltage increase level must be amplified using an amplifier circuit so that the voltage increase level is above the accuracy tolerance.
Figure 2. Amplifier Circuit
The Non-Inverting Amplifier circuit in Figure 2 with a P1 potentiometer of 100K can be used to adjust the output of the LM35 to be 5 times larger so that the output of this amplifier can produce a voltage increase of 50 mV for every degree Celsius.
The LM358 in this amplifier circuit uses a voltage source of 12 volts so that the zener diode D1 and resistor R1 are used at the output of this amplifier to ensure that the maximum voltage limit reaches only 5 Volts and to protect the ADC-0809 Module from excessive voltage.
ADC-0809 module
ADC0809 is an IC that converts analog voltage to digital with input in the form of 8 selectable input channels. The ADC0809 IC can perform a controlled conversion process or free running. The AD-0809 module designed to be connected to the DST-51 Module is specifically designed to perform a controlled conversion process, namely a process of converting voltage changes from analog to digital based on commands from the microcontroller.
This ADC has an accuracy of 1 bit LSB, for more accurate accuracy of ½ bit LSB, this IC can be replaced with ADC0808 which has the exact same pin configuration as ADC0809. ADC0809 performs analog to digital voltage conversion using the SAR (successive approximation register) method with 8 bit resolution and 100 uS conversion time.
Figure 3. ADC Block Diagram (taken from National Semiconductor data sheet)
As seen in Figure 3, this ADC has 8 multiplex analog switch channels controlled by the Address Latch and Decoder where this multiplexer will forward the analog signal to the voltage conversion section. In controlled mode, the conversion process is carried out after the start command, namely logic 1 on the START leg, is given. The conversion speed depends on the clock frequency given by the external circuit. While the conversion results are sent to the Tri State Output Latch Buffer which is compatible with TTL levels, which is a three-level holding buffer where the first level occurs when the converted data enters the input of this section.
The second level when the data is latched (occurs automatically in this IC every time it is converted) into its internal buffer and the third level when the OE signal with logic 1 is given to the OE leg of this IC so that the data in the internal buffer is sent to the output section (D0...D7). As long as the OE leg is still logic 0, the output line (D0...D7) is high impedance so that in a complex system, this line can still be used by other components that have access capabilities using the bus system.
ADC0809 Input Channel Selection
ADC0809 has 8 input channels which are regulated by legs A0, A1 and A2 according to the following table:
ADC0809 Conversion Process
Figure 4. Timing Diagram of ADC0809 (taken from National Semiconductor data sheet)
In the timing diagram above, the conversion process appears to start when the ALE and Start signals appear. The analog signal in the channel as indicated by the A0, A1 and A2 pins will be converted to digital. The end of the conversion process occurs with a change from logic 0 to logic 1 on the EOC pin. The converted data will appear on the Data Bus (D0...D7) when the OE signal with logic 1 appears.
Figure 5. Connection of 2x16 LCD with DST-51 Module
Software
The core of this software section is actually the conversion of digital data from the ADC-0809 Module into temperature data in decimal form that can be displayed on the LCD.
The data taken by the ADC is in the form of voltage data in hexa form while the data that will be displayed on the LCD is in the form of temperature in decimal form. First of all, the software on the DST-51 Module converts the voltage data into temperature data. The conversion process is carried out with the following equation:
The ADC-0809 module converts into 8 bits of digital data. Therefore, by utilizing only 256 bytes of memory, the conversion process from ADC results to temperature can be done easily without going through the arithmetic process using the conversion table.
Table 2 ADC Data Conversion to Temperature
| Hasil ADC | Suhu (oC) | Pembulatan (oC) |
|-----------|-------------|-----------------|
| 01H | 0,392156863 | 0 |
| 02H | 0,784313725 | 1 |
| 03H | 1,176470588 | 1 |
| 04H | 1,568627451 | 2 |
| 05H | 1,960784314 | 2 |
| 06H | 2,352941176 | 2 |
| 07H | 2,745098039 | 3 |
| 05H | 1,960784314 | 2 |
| 06H | 2,352941176 | 2 |
| 07H | 2,745098039 | 3 |
| 08H | 3,137254902 | 3 |
| 09H | 3,529411765 | 4 |
| 0AH | 3,921568627 | 4 |
| 0BH | 4,31372549 | 4 |
| 0CH | 4,705882353 | 5 |
| 0DH | 5,098039216 | 5 |
| 0EH | 5,490196078 | 5 |
| 0FH | 5,882352941 | 6 |
| 10H | 6,274509804 | 6 |
| 11H | 6,666666667 | 7 |
| 12H | 7,058823529 | 7 |
| 13H | 7,450980392 | 7 |
| 14H | 7,843137255 | 8 |
| 15H | 8,235294118 | 8 |
| 16H | 8,62745098 | 9 |
| 17H | 9,019607843 | 9 |
| 18H | 9,411764706 | 9 |
| 19H | 9,803921569 | 10 |
| 1AH | 10,19607843 | 10 |
| 1BH | 10,58823529 | 11 |
| 1CH | 10,98039216 | 11 |
| 1DH | 11,37254902 | 11 |
| 1EH | 11,76470588 | 12 |
| 1FH | 12,15686275 | 12 |
| 20H | 12,54901961 | 13 |
| 21H | 12,94117647 | 13 |
| 22H | 13,33333333 | 13 |
| 23H | 13,7254902 | 14 |
| 24H | 14,11764706 | 14 |
| 25H | 14,50980392 | 15 |
| 26H | 14,90196078 | 15 |
| 27H | 15,29411765 | 15 |
| 28H | 15,68627451 | 16 |
| 29H | 16,07843137 | 16 |
| 2AH | 16,47058824 | 16 |
| 2BH | 16,8627451 | 17 |
| 2CH | 17,25490196 | 17 |
| 2DH | 17,64705882 | 18 |
| 2EH | 18,03921569 | 18 |
| 2FH | 18,43137255 | 18 |
| 30H | 18,82352941 | 19 |
| 31H | 19,21568627 | 19 |
| 32H | 19,60784314 | 20 |
| 33H | 20 | 20 |
| 34H | 20,39215686 | 20 |
| 35H | 20,78431373 | 21 |
| 36H | 21,17647059 | 21 |
| 37H | 21,56862745 | 22 |
| 38H | 21,96078431 | 22 |
| 39H | 22,35294118 | 22 |
| 3AH | 22,74509804 | 23 |
| 3BH | 23,1372549 | 23 |
| 3CH | 23,52941176 | 24 |
| 3DH | 23,92156863 | 24 |
| 3EH | 24,31372549 | 24 |
| 3FH | 24,70588235 | 25 |
| 40H | 25,09803922 | 25 |
| 41H | 25,49019608 | 25 |
| 42H | 25,88235294 | 26 |
| 43H | 26,2745098 | 26 |
| 44H | 26,66666667 | 27 |
| 45H | 27,05882353 | 27 |
| 46H | 27,45098039 | 27 |
| 47H | 27,84313725 | 28 |
| 48H | 28,23529412 | 28 |
| 49H | 28,62745098 | 29 |
| 4AH | 29,01960784 | 29 |
| 4BH | 29,41176471 | 29 |
| 4CH | 29,80392157 | 30 |
| 4DH | 30,19607843 | 30 |
| 4EH | 30,58823529 | 31 |
| 4FH | 30,98039216 | 31 |
| 50H | 31,37254902 | 31 |
| 51H | 31,76470588 | 32 |
| 52H | 32,15686275 | 32 |
| 53H | 32,54901961 | 33 |
| 54H | 32,94117647 | 33 |
| 55H | 33,33333333 | 33 |
| 56H | 33,7254902 | 34 |
| 57H | 34,11764706 | 34 |
| 58H | 34,50980392 | 35 |
| 59H | 34,90196078 | 35 |
| 5AH | 35,29411765 | 35 |
| 5BH | 35,68627451 | 36 |
| 5CH | 36,07843137 | 36 |
| 5DH | 36,47058824 | 36 |
| 5EH | 36,8627451 | 37 |
| 5FH | 37,25490196 | 37 |
| 60H | 37,64705882 | 38 |
| 61H | 38,03921569 | 38 |
| 62H | 38,43137255 | 38 |
| 63H | 38,82352941 | 39 |
| 64H | 39,21568627 | 39 |
| 65H | 39,60784314 | 40 |
| 66H | 40 | 40 |
| 67H | 40,39215686 | 40 |
| 68H | 40,78431373 | 41 |
| 69H | 41,17647059 | 41 |
| 6AH | 41,56862745 | 42 |
| 6BH | 41,96078431 | 42 |
| 6CH | 42,35294118 | 42 |
| 6DH | 42,74509804 | 43 |
| 6EH | 43,1372549 | 43 |
| 6FH | 43,52941176 | 44 |
| 70H | 43,92156863 | 44 |
| 71H | 44,31372549 | 44 |
| 72H | 44,70588235 | 45 |
| 73H | 45,09803922 | 45 |
| 74H | 45,49019608 | 45 |
| 75H | 45,88235294 | 46 |
| 76H | 46,2745098 | 46 |
| 77H | 46,66666667 | 47 |
| 78H | 47,05882353 | 47 |
| 79H | 47,45098039 | 47 |
| 7AH | 47,84313725 | 48 |
| 7BH | 48,23529412 | 48 |
| 7CH | 48,62745098 | 49 |
| 7DH | 49,01960784 | 49 |
| 7EH | 49,41176471 | 49 |
| 7FH | 49,80392157 | 50 |
| 80H | 50,19607843 | 50 |
| 81H | 50,58823529 | 51 |
| 82H | 50,98039216 | 51 |
| 83H | 51,37254902 | 51 |
| 84H | 51,76470588 | 52 |
| 85H | 52,15686275 | 52 |
| 86H | 52,54901961 | 53 |
| 87H | 52,94117647 | 53 |
| 88H | 53,33333333 | 53 |
| 89H | 53,7254902 | 54 |
| 8AH | 54,11764706 | 54 |
| 8BH | 54,50980392 | 55 |
| 8CH | 54,90196078 | 55 |
| 8DH | 55,29411765 | 55 |
| 8EH | 55,68627451 | 56 |
| 8FH | 56,07843137 | 56 |
| 90H | 56,47058824 | 56 |
| 91H | 56,8627451 | 57 |
| 92H | 57,25490196 | 57 |
| 93H | 57,64705882 | 58 |
| 94H | 58,03921569 | 58 |
| 95H | 58,43137255 | 58 |
| 96H | 58,82352941 | 59 |
| 97H | 59,21568627 | 59 |
| 98H | 59,60784314 | 60 |
| 99H | 60 | 60 |
| 9AH | 60,39215686 | 60 |
| 9BH | 60,78431373 | 61 |
| 9CH | 61,17647059 | 61 |
| 9DH | 61,56862745 | 62 |
| 9EH | 61,96078431 | 62 |
| 9FH | 62,35294118 | 62 |
| A0H | 62,74509804 | 63 |
| A1H | 63,1372549 | 63 |
| A2H | 63,52941176 | 64 |
| A3H | 63,92156863 | 64 |
| A4H | 64,31372549 | 64 |
| A5H | 64,70588235 | 65 |
| A6H | 65,09803922 | 65 |
| A7H | 65,49019608 | 65 |
| A8H | 65,88235294 | 66 |
| A9H | 66,2745098 | 66 |
| AAH | 66,66666667 | 67 |
| ABH | 67,05882353 | 67 |
| ACH | 67,45098039 | 67 |
| ADH | 67,84313725 | 68 |
| AEH | 68,23529412 | 68 |
| AFH | 68,62745098 | 69 |
| B0H | 69,01960784 | 69 |
| B1H | 69,41176471 | 69 |
| B2H | 69,80392157 | 70 |
| B3H | 70,19607843 | 70 |
| B4H | 70,58823529 | 71 |
| B5H | 70,98039216 | 71 |
| B6H | 71,37254902 | 71 |
| B7H | 71,76470588 | 72 |
| B8H | 72,15686275 | 72 |
| B9H | 72,54901961 | 73 |
| BAH | 72,94117647 | 73 |
| BBH | 73,33333333 | 73 |
| BCH | 73,7254902 | 74 |
| BDH | 74,11764706 | 74 |
| BEH | 74,50980392 | 75 |
| BFH | 74,90196078 | 75 |
| C0H | 75,29411765 | 75 |
| C1H | 75,68627451 | 76 |
| C2H | 76,07843137 | 76 |
| C3H | 76,47058824 | 76 |
| C4H | 76,8627451 | 77 |
| C5H | 77,25490196 | 77 |
| C6H | 77,64705882 | 78 |
| C7H | 78,03921569 | 78 |
| C8H | 78,43137255 | 78 |
| C9H | 78,82352941 | 79 |
| CAH | 79,21568627 | 79 |
| CBH | 79,60784314 | 80 |
| CCH | 80 | 80 |
| CDH | 80,39215686 | 80 |
| CEH | 80,78431373 | 81 |
| CFH | 81,17647059 | 81 |
| D0H | 81,56862745 | 82 |
| D1H | 81,96078431 | 82 |
| D2H | 82,35294118 | 82 |
| D3H | 82,74509804 | 83 |
| D4H | 83,1372549 | 83 |
| D5H | 83,52941176 | 84 |
| D6H | 83,92156863 | 84 |
| D7H | 84,31372549 | 84 |
| D8H | 84,70588235 | 85 |
| D9H | 85,09803922 | 85 |
| DAH | 85,49019608 | 85 |
| DBH | 85,88235294 | 86 |
| DCH | 86,2745098 | 86 |
| DDH | 86,66666667 | 87 |
| DEH | 87,05882353 | 87 |
| DFH | 87,45098039 | 87 |
| E0H | 87,84313725 | 88 |
| E1H | 88,23529412 | 88 |
| E2H | 88,62745098 | 89 |
| E3H | 89,01960784 | 89 |
| E4H | 89,41176471 | 89 |
| E5H | 89,80392157 | 90 |
| E6H | 90,19607843 | 90 |
| E7H | 90,58823529 | 91 |
| E8H | 90,98039216 | 91 |
| E9H | 91,37254902 | 91 |
| EAH | 91,76470588 | 92 |
| EBH | 92,15686275 | 92 |
| ECH | 92,54901961 | 93 |
| EDH | 92,94117647 | 93 |
| EEH | 93,33333333 | 93 |
| EFH | 93,7254902 | 94 |
| F0H | 94,11764706 | 94 |
| F1H | 94,50980392 | 95 |
| F2H | 94,90196078 | 95 |
| F3H | 95,29411765 | 95 |
| F4H | 95,68627451 | 96 |
| F5H | 96,07843137 | 96 |
| F6H | 96,47058824 | 96 |
| F7H | 96,8627451 | 97 |
| F8H | 97,25490196 | 97 |
| F9H | 97,64705882 | 98 |
| FAH | 98,03921569 | 98 |
| FBH | 98,43137255 | 98 |
| FCH | 98,82352941 | 99 |
| FDH | 99,21568627 | 99 |
| FEH | 99,60784314 | 100 |
| FFH | 100 | 100 |
The results of the conversion table that are visible in the rounding column are already in the form of temperature data, but the data is still in hexadecimal form, so it cannot be directly displayed on the LCD. Therefore, the results of the conversion table must still be converted again into BCD form.
Program snippet for converting 1 byte hexa data into BCD format
CSEG
Org $
;Subroutine Konversi Hexa 1 byte ke Desimal
;Bilangan yang dikonversi di Akumulator
;Jumlah digit yang dihasilkan disimpan di R6
;Hasil tersimpan di Tabel Desimal
Konversi1BDesimal:
Mov R6,#00H
Jz TidakKonversi ;Bila 0 tidak perlu konversi
LoopKonversi:
Mov B,#10 ;Bilangan yang dikonversi lebih besar
Push ACC ;dari 10?
Subb A,B ;
Pop ACC ;
Inc R6 ;Jumlah digit + 1
Jc KonversiSelesai ;Bila lebih kecil dari 10, konversi selesai
Div AB ;Bilangan yg dikonversi dibagi 10
Mov @R0,B ;Sisa disimpan di Tabel Desimal
Inc R0 ;
Ajmp LoopKonversi
KonversiSelesai:
Mov @R0,A
TidakKonversi:
Ret
R6 in this program excerpt shows the number of digits of the conversion result while the result of the conversion process is stored in the address indicated by R0.
The complete program for this digital thermometer can be downloaded at www.delta-electronic.com in the software section.
Figure 1 System Block Diagram
The digital thermometer application is done by converting temperature into digital data so that it can be processed by the microcontroller. The conversion process is first done by converting temperature into analog voltage and continued by converting analog voltage into digital data.
Conversion of temperature to analog voltage is done by using LM35 type temperature sensor where this sensor can operate using source voltage between 4 -- 30 volts DC. The output of this sensor will increase by 10 mV for every degree Celsius so that the following equation is obtained:
VLM35 = Temperature * 10 mV
The ADC-0809 module is an analog to digital voltage conversion module with the following specifications:
- 8 bit digital conversion
- 1 LSB Resolution
- Maximum input voltage 5Volt
Therefore the accuracy of this module in voltage units is:
With an accuracy tolerance of 19.6 mV, the LM35 output which has a 10 mV increase for every degree Celsius cannot be directly connected to the ADC-0809 Module. An accuracy tolerance greater than the measured voltage increase level will cause errors in measurement. To avoid such errors, the measured voltage increase level must be amplified using an amplifier circuit so that the voltage increase level is above the accuracy tolerance.
Figure 2. Amplifier Circuit
The Non-Inverting Amplifier circuit in Figure 2 with a P1 potentiometer of 100K can be used to adjust the output of the LM35 to be 5 times larger so that the output of this amplifier can produce a voltage increase of 50 mV for every degree Celsius.
The LM358 in this amplifier circuit uses a voltage source of 12 volts so that the zener diode D1 and resistor R1 are used at the output of this amplifier to ensure that the maximum voltage limit reaches only 5 Volts and to protect the ADC-0809 Module from excessive voltage.
ADC-0809 module
ADC0809 is an IC that converts analog voltage to digital with input in the form of 8 selectable input channels. The ADC0809 IC can perform a controlled conversion process or free running. The AD-0809 module designed to be connected to the DST-51 Module is specifically designed to perform a controlled conversion process, namely a process of converting voltage changes from analog to digital based on commands from the microcontroller.
This ADC has an accuracy of 1 bit LSB, for more accurate accuracy of ½ bit LSB, this IC can be replaced with ADC0808 which has the exact same pin configuration as ADC0809. ADC0809 performs analog to digital voltage conversion using the SAR (successive approximation register) method with 8 bit resolution and 100 uS conversion time.
Figure 3. ADC Block Diagram (taken from National Semiconductor data sheet)
As seen in Figure 3, this ADC has 8 multiplex analog switch channels controlled by the Address Latch and Decoder where this multiplexer will forward the analog signal to the voltage conversion section. In controlled mode, the conversion process is carried out after the start command, namely logic 1 on the START leg, is given. The conversion speed depends on the clock frequency given by the external circuit. While the conversion results are sent to the Tri State Output Latch Buffer which is compatible with TTL levels, which is a three-level holding buffer where the first level occurs when the converted data enters the input of this section.
The second level when the data is latched (occurs automatically in this IC every time it is converted) into its internal buffer and the third level when the OE signal with logic 1 is given to the OE leg of this IC so that the data in the internal buffer is sent to the output section (D0...D7). As long as the OE leg is still logic 0, the output line (D0...D7) is high impedance so that in a complex system, this line can still be used by other components that have access capabilities using the bus system.
ADC0809 Input Channel Selection
ADC0809 has 8 input channels which are regulated by legs A0, A1 and A2 according to the following table:
ADC0809 Conversion Process
Figure 4. Timing Diagram of ADC0809 (taken from National Semiconductor data sheet)
In the timing diagram above, the conversion process appears to start when the ALE and Start signals appear. The analog signal in the channel as indicated by the A0, A1 and A2 pins will be converted to digital. The end of the conversion process occurs with a change from logic 0 to logic 1 on the EOC pin. The converted data will appear on the Data Bus (D0...D7) when the OE signal with logic 1 appears.
Figure 5. Connection of 2x16 LCD with DST-51 Module
Software
The core of this software section is actually the conversion of digital data from the ADC-0809 Module into temperature data in decimal form that can be displayed on the LCD.
The data taken by the ADC is in the form of voltage data in hexa form while the data that will be displayed on the LCD is in the form of temperature in decimal form. First of all, the software on the DST-51 Module converts the voltage data into temperature data. The conversion process is carried out with the following equation:
The ADC-0809 module converts into 8 bits of digital data. Therefore, by utilizing only 256 bytes of memory, the conversion process from ADC results to temperature can be done easily without going through the arithmetic process using the conversion table.
Table 2 ADC Data Conversion to Temperature
| Hasil ADC | Suhu (oC) | Pembulatan (oC) |
|-----------|-------------|-----------------|
| 01H | 0,392156863 | 0 |
| 02H | 0,784313725 | 1 |
| 03H | 1,176470588 | 1 |
| 04H | 1,568627451 | 2 |
| 05H | 1,960784314 | 2 |
| 06H | 2,352941176 | 2 |
| 07H | 2,745098039 | 3 |
| 05H | 1,960784314 | 2 |
| 06H | 2,352941176 | 2 |
| 07H | 2,745098039 | 3 |
| 08H | 3,137254902 | 3 |
| 09H | 3,529411765 | 4 |
| 0AH | 3,921568627 | 4 |
| 0BH | 4,31372549 | 4 |
| 0CH | 4,705882353 | 5 |
| 0DH | 5,098039216 | 5 |
| 0EH | 5,490196078 | 5 |
| 0FH | 5,882352941 | 6 |
| 10H | 6,274509804 | 6 |
| 11H | 6,666666667 | 7 |
| 12H | 7,058823529 | 7 |
| 13H | 7,450980392 | 7 |
| 14H | 7,843137255 | 8 |
| 15H | 8,235294118 | 8 |
| 16H | 8,62745098 | 9 |
| 17H | 9,019607843 | 9 |
| 18H | 9,411764706 | 9 |
| 19H | 9,803921569 | 10 |
| 1AH | 10,19607843 | 10 |
| 1BH | 10,58823529 | 11 |
| 1CH | 10,98039216 | 11 |
| 1DH | 11,37254902 | 11 |
| 1EH | 11,76470588 | 12 |
| 1FH | 12,15686275 | 12 |
| 20H | 12,54901961 | 13 |
| 21H | 12,94117647 | 13 |
| 22H | 13,33333333 | 13 |
| 23H | 13,7254902 | 14 |
| 24H | 14,11764706 | 14 |
| 25H | 14,50980392 | 15 |
| 26H | 14,90196078 | 15 |
| 27H | 15,29411765 | 15 |
| 28H | 15,68627451 | 16 |
| 29H | 16,07843137 | 16 |
| 2AH | 16,47058824 | 16 |
| 2BH | 16,8627451 | 17 |
| 2CH | 17,25490196 | 17 |
| 2DH | 17,64705882 | 18 |
| 2EH | 18,03921569 | 18 |
| 2FH | 18,43137255 | 18 |
| 30H | 18,82352941 | 19 |
| 31H | 19,21568627 | 19 |
| 32H | 19,60784314 | 20 |
| 33H | 20 | 20 |
| 34H | 20,39215686 | 20 |
| 35H | 20,78431373 | 21 |
| 36H | 21,17647059 | 21 |
| 37H | 21,56862745 | 22 |
| 38H | 21,96078431 | 22 |
| 39H | 22,35294118 | 22 |
| 3AH | 22,74509804 | 23 |
| 3BH | 23,1372549 | 23 |
| 3CH | 23,52941176 | 24 |
| 3DH | 23,92156863 | 24 |
| 3EH | 24,31372549 | 24 |
| 3FH | 24,70588235 | 25 |
| 40H | 25,09803922 | 25 |
| 41H | 25,49019608 | 25 |
| 42H | 25,88235294 | 26 |
| 43H | 26,2745098 | 26 |
| 44H | 26,66666667 | 27 |
| 45H | 27,05882353 | 27 |
| 46H | 27,45098039 | 27 |
| 47H | 27,84313725 | 28 |
| 48H | 28,23529412 | 28 |
| 49H | 28,62745098 | 29 |
| 4AH | 29,01960784 | 29 |
| 4BH | 29,41176471 | 29 |
| 4CH | 29,80392157 | 30 |
| 4DH | 30,19607843 | 30 |
| 4EH | 30,58823529 | 31 |
| 4FH | 30,98039216 | 31 |
| 50H | 31,37254902 | 31 |
| 51H | 31,76470588 | 32 |
| 52H | 32,15686275 | 32 |
| 53H | 32,54901961 | 33 |
| 54H | 32,94117647 | 33 |
| 55H | 33,33333333 | 33 |
| 56H | 33,7254902 | 34 |
| 57H | 34,11764706 | 34 |
| 58H | 34,50980392 | 35 |
| 59H | 34,90196078 | 35 |
| 5AH | 35,29411765 | 35 |
| 5BH | 35,68627451 | 36 |
| 5CH | 36,07843137 | 36 |
| 5DH | 36,47058824 | 36 |
| 5EH | 36,8627451 | 37 |
| 5FH | 37,25490196 | 37 |
| 60H | 37,64705882 | 38 |
| 61H | 38,03921569 | 38 |
| 62H | 38,43137255 | 38 |
| 63H | 38,82352941 | 39 |
| 64H | 39,21568627 | 39 |
| 65H | 39,60784314 | 40 |
| 66H | 40 | 40 |
| 67H | 40,39215686 | 40 |
| 68H | 40,78431373 | 41 |
| 69H | 41,17647059 | 41 |
| 6AH | 41,56862745 | 42 |
| 6BH | 41,96078431 | 42 |
| 6CH | 42,35294118 | 42 |
| 6DH | 42,74509804 | 43 |
| 6EH | 43,1372549 | 43 |
| 6FH | 43,52941176 | 44 |
| 70H | 43,92156863 | 44 |
| 71H | 44,31372549 | 44 |
| 72H | 44,70588235 | 45 |
| 73H | 45,09803922 | 45 |
| 74H | 45,49019608 | 45 |
| 75H | 45,88235294 | 46 |
| 76H | 46,2745098 | 46 |
| 77H | 46,66666667 | 47 |
| 78H | 47,05882353 | 47 |
| 79H | 47,45098039 | 47 |
| 7AH | 47,84313725 | 48 |
| 7BH | 48,23529412 | 48 |
| 7CH | 48,62745098 | 49 |
| 7DH | 49,01960784 | 49 |
| 7EH | 49,41176471 | 49 |
| 7FH | 49,80392157 | 50 |
| 80H | 50,19607843 | 50 |
| 81H | 50,58823529 | 51 |
| 82H | 50,98039216 | 51 |
| 83H | 51,37254902 | 51 |
| 84H | 51,76470588 | 52 |
| 85H | 52,15686275 | 52 |
| 86H | 52,54901961 | 53 |
| 87H | 52,94117647 | 53 |
| 88H | 53,33333333 | 53 |
| 89H | 53,7254902 | 54 |
| 8AH | 54,11764706 | 54 |
| 8BH | 54,50980392 | 55 |
| 8CH | 54,90196078 | 55 |
| 8DH | 55,29411765 | 55 |
| 8EH | 55,68627451 | 56 |
| 8FH | 56,07843137 | 56 |
| 90H | 56,47058824 | 56 |
| 91H | 56,8627451 | 57 |
| 92H | 57,25490196 | 57 |
| 93H | 57,64705882 | 58 |
| 94H | 58,03921569 | 58 |
| 95H | 58,43137255 | 58 |
| 96H | 58,82352941 | 59 |
| 97H | 59,21568627 | 59 |
| 98H | 59,60784314 | 60 |
| 99H | 60 | 60 |
| 9AH | 60,39215686 | 60 |
| 9BH | 60,78431373 | 61 |
| 9CH | 61,17647059 | 61 |
| 9DH | 61,56862745 | 62 |
| 9EH | 61,96078431 | 62 |
| 9FH | 62,35294118 | 62 |
| A0H | 62,74509804 | 63 |
| A1H | 63,1372549 | 63 |
| A2H | 63,52941176 | 64 |
| A3H | 63,92156863 | 64 |
| A4H | 64,31372549 | 64 |
| A5H | 64,70588235 | 65 |
| A6H | 65,09803922 | 65 |
| A7H | 65,49019608 | 65 |
| A8H | 65,88235294 | 66 |
| A9H | 66,2745098 | 66 |
| AAH | 66,66666667 | 67 |
| ABH | 67,05882353 | 67 |
| ACH | 67,45098039 | 67 |
| ADH | 67,84313725 | 68 |
| AEH | 68,23529412 | 68 |
| AFH | 68,62745098 | 69 |
| B0H | 69,01960784 | 69 |
| B1H | 69,41176471 | 69 |
| B2H | 69,80392157 | 70 |
| B3H | 70,19607843 | 70 |
| B4H | 70,58823529 | 71 |
| B5H | 70,98039216 | 71 |
| B6H | 71,37254902 | 71 |
| B7H | 71,76470588 | 72 |
| B8H | 72,15686275 | 72 |
| B9H | 72,54901961 | 73 |
| BAH | 72,94117647 | 73 |
| BBH | 73,33333333 | 73 |
| BCH | 73,7254902 | 74 |
| BDH | 74,11764706 | 74 |
| BEH | 74,50980392 | 75 |
| BFH | 74,90196078 | 75 |
| C0H | 75,29411765 | 75 |
| C1H | 75,68627451 | 76 |
| C2H | 76,07843137 | 76 |
| C3H | 76,47058824 | 76 |
| C4H | 76,8627451 | 77 |
| C5H | 77,25490196 | 77 |
| C6H | 77,64705882 | 78 |
| C7H | 78,03921569 | 78 |
| C8H | 78,43137255 | 78 |
| C9H | 78,82352941 | 79 |
| CAH | 79,21568627 | 79 |
| CBH | 79,60784314 | 80 |
| CCH | 80 | 80 |
| CDH | 80,39215686 | 80 |
| CEH | 80,78431373 | 81 |
| CFH | 81,17647059 | 81 |
| D0H | 81,56862745 | 82 |
| D1H | 81,96078431 | 82 |
| D2H | 82,35294118 | 82 |
| D3H | 82,74509804 | 83 |
| D4H | 83,1372549 | 83 |
| D5H | 83,52941176 | 84 |
| D6H | 83,92156863 | 84 |
| D7H | 84,31372549 | 84 |
| D8H | 84,70588235 | 85 |
| D9H | 85,09803922 | 85 |
| DAH | 85,49019608 | 85 |
| DBH | 85,88235294 | 86 |
| DCH | 86,2745098 | 86 |
| DDH | 86,66666667 | 87 |
| DEH | 87,05882353 | 87 |
| DFH | 87,45098039 | 87 |
| E0H | 87,84313725 | 88 |
| E1H | 88,23529412 | 88 |
| E2H | 88,62745098 | 89 |
| E3H | 89,01960784 | 89 |
| E4H | 89,41176471 | 89 |
| E5H | 89,80392157 | 90 |
| E6H | 90,19607843 | 90 |
| E7H | 90,58823529 | 91 |
| E8H | 90,98039216 | 91 |
| E9H | 91,37254902 | 91 |
| EAH | 91,76470588 | 92 |
| EBH | 92,15686275 | 92 |
| ECH | 92,54901961 | 93 |
| EDH | 92,94117647 | 93 |
| EEH | 93,33333333 | 93 |
| EFH | 93,7254902 | 94 |
| F0H | 94,11764706 | 94 |
| F1H | 94,50980392 | 95 |
| F2H | 94,90196078 | 95 |
| F3H | 95,29411765 | 95 |
| F4H | 95,68627451 | 96 |
| F5H | 96,07843137 | 96 |
| F6H | 96,47058824 | 96 |
| F7H | 96,8627451 | 97 |
| F8H | 97,25490196 | 97 |
| F9H | 97,64705882 | 98 |
| FAH | 98,03921569 | 98 |
| FBH | 98,43137255 | 98 |
| FCH | 98,82352941 | 99 |
| FDH | 99,21568627 | 99 |
| FEH | 99,60784314 | 100 |
| FFH | 100 | 100 |
The results of the conversion table that are visible in the rounding column are already in the form of temperature data, but the data is still in hexadecimal form, so it cannot be directly displayed on the LCD. Therefore, the results of the conversion table must still be converted again into BCD form.
Program snippet for converting 1 byte hexa data into BCD format
CSEG
Org $
;Subroutine Konversi Hexa 1 byte ke Desimal
;Bilangan yang dikonversi di Akumulator
;Jumlah digit yang dihasilkan disimpan di R6
;Hasil tersimpan di Tabel Desimal
Konversi1BDesimal:
Mov R6,#00H
Jz TidakKonversi ;Bila 0 tidak perlu konversi
LoopKonversi:
Mov B,#10 ;Bilangan yang dikonversi lebih besar
Push ACC ;dari 10?
Subb A,B ;
Pop ACC ;
Inc R6 ;Jumlah digit + 1
Jc KonversiSelesai ;Bila lebih kecil dari 10, konversi selesai
Div AB ;Bilangan yg dikonversi dibagi 10
Mov @R0,B ;Sisa disimpan di Tabel Desimal
Inc R0 ;
Ajmp LoopKonversi
KonversiSelesai:
Mov @R0,A
TidakKonversi:
Ret
R6 in this program excerpt shows the number of digits of the conversion result while the result of the conversion process is stored in the address indicated by R0.
The complete program of this digital thermometer can be downloaded at www.delta-electronic.com in the software section.