Displays temperature measurement through a proteus program in combination with an adc that can be applied on a computer

in #utopian-io7 years ago (edited)

What Will I Learn?

  • You will learn understand the adc function in telemetry
  • You will learn understand the working principle of controlled adc
  • You will learn understand the working principle of temperature sensors that can be applied to the computer

Requirements

  • Make the program as ordered
  • Note any character writing
  • Measure each input voltage adc
  • Measure the outgoing voltage from the adc

Difficulty

  • Intermediate

Tutorial Contents

What is adc?

Analog to Digital Converter (ADC) is a device designed to convert analog signals into digital signals. IC ADC 0804 is considered to meet the needs of the series to be made. This type of IC works closely by adding a few components according to the specifications that must be provided and can quickly convert a voltage input. Matters that also need attention in the use of this ADC are the maximum voltage ADC can convert from the signal conditioning circuit, resolution, external timer ADC, output type, accuracy and conversion time. There are many ways that can be used to convert analog signals into digital signals whose value is proportional. The type of ADC commonly used in design is the Successive Approximation Convertion (SAR) type or multilevel approach which has a much shorter conversion time and is independent of the analog input value or the signal to be changed. Here's an example of an adc image
adc.jpg
Briefly the working principle of the A / D converter is that all the bits are set and then tested, and when necessary in accordance with the conditions specified. With the fastest circuit, the conversion will be completed after 8 clocks, and the D / A output is an analog value equivalent to the SAR register value. When a conversion has been executed, the reset signal sends a low-conversion finish. The down side of this signal will produce equivalent digital data into the buffer register. Thus, the digital output will remain stored even though new conversion cycles will begin.
ic adc.jpg
IC ADC 0804 has two analog inputs, Vin (+) and Vin (-), so it can accept differential input. The actual analog input (Vin) is equal to the difference between the voltages connected to the two input pins Vin = Vin (+) - Vin (-). If the analog input is a single voltage, it must be connected to Vin (+), while Vin (-) is grounded. For normal operation, ADC 0804 uses Vcc = + 5 Volt as the reference voltage. In this case the range of analog input ranges from 0 Volts to 5 Volts (full scale), since this IC is an 8-bit SAC, the resolution will be equal to resolution
ic adc rumus.jpg
The ADC 0804 IC has an internal clock generator which must be activated by connecting an external resistor R between the CLK OUT and CLK IN pins and an external capacitor (C) between CLK IN and the digital ground. The clock frequency obtained at the CLK OUT pin
ic adc rumus 1.jpg
For this clock signal can also be used an external signal connected to the CLK IN pin. ADC 0804 has 8 digital outputs that can be directly connected to the microcomputer data channel. Chip Select input (active LOW) is used to enable ADC 0804. If HIGH logic, ADC 0804 is off (disabled) and all outputs are in high impedance state. Input Write or Start Convertion is used to start the conversion process. For it must be given a pulse logic 0. While the output interrupt or end of convertion declare the end of the conversion. At the start of a conversion, it will change to logic 1. At the end of the conversion will return to logic 0.

PIN LCD

LCD is discussed on this lab is LCD type 2x16 digit has 14 pin plus 2 pin for backligth. The picture below shows the 2x16 digit LCD pin configuration.
lcd.jpg

List of tools and materials

  1. Proteus Simulator 7.4
  2. MIDE-51
  3. Computer Units

Drawing circuit work

diagram percobaan.jpg

Run the program that has been written below

ORG 0h
dataadc equ 60h

call init_lcd
call pre_disp
call pre_disp2

start: call channel
call baca_ADC
call display
ljmp start

channel:
clr p2.3 ;selektor A
clr p2.4 ;selektor B
clr p2.5 ;selektor C
ret
baca_ADC:
setb p3.6;wr
setb p3.7;rd
call delay
clr p3.6
call delay
setb p3.6
jb p3.2,$
call delay
clr p3.7
acall delay

mov a,p0
mov dataadc,a
acall   delay
ret

display:
mov dptr,#ratusan
mov a,dataadc
movc a,@a+dptr
mov 32h,a ;

mov     dptr,#puluhan
mov     a,dataadc
movc    a,@a+dptr
mov     31h,a 

mov dptr,#satuan
mov a,dataadc
movc a,@a+dptr
mov     30h,a 

mov     r1,#0cch ;pesan tempat di kolom 12 di baris 2
acall   write_inst
mov a,30h
add a,#30h ;ascci dari satuan
mov r1,a 
acall   write_data


mov     r1,#0cbh ;pesan tempat di kolom 11 di baris 2
acall   write_inst
mov a,31h
add a,#30h ;ascci dari puluhan
mov r1,a 
acall   write_data


mov     r1,#0cah ;pesan tempat di kolom 10

Line 2
acall write_inst
mov a,32h
add a,#30h ;ascci dari ratusan
mov r1,a
acall write_data
ret

pre_disp: mov dptr,#baris_1
mov r6,#0eh
ulangi1: clr a
movc a,@a+dptr
inc dptr
mov r1,a
call write_data
DJNZ R6,ulangi1
ret

pre_disp2: mov r1,#0c0h
call write_inst
mov dptr,#baris_2
mov r6,#0fh
ulangi2: clr a
movc a,@a+dptr
inc dptr
mov r1,a
call write_data
djnz r6,ulangi2
ret

Init_lcd: mov r1,#01H ;Display clear
call write_inst
mov r1,#38H ;Function set, Data 8 bit,2 line font 5x7
call write_inst
mov r1,#0CH ;Display on, cursor off,cursor blink off
call write_inst
mov r1,#06H ;Entry mode, Set increment
call write_inst

    ret

Write_inst: clr P2.0 ; = RS =0
clr P2.1
mov P1,R1 ; P0 = D7 s/d D0 = R1
setb P2.2 ; =EN = 1
call delay ; call delay time
clr P2.2 ; =EN = 0
ret

Write_data: setb P2.0 ; = RS =1
clr P2.1 ; R/W = 0
mov P1,R1 ; P0 = D7 s/d D0 = R1
setb P2.2 ; =EN = 1
call delay ; call delay time
clr p2.2 ; =EN = 0
ret

delay: mov R0,#50
delay1:mov R7,#0fh
djnz R7,$
djnz R0,delay1
ret

baris_1: DB "TELEMETRI SUHU "
baris_2: DB "DATA ADC= ",0DFH,"C"

satuan:
db 0,0,0,1,1,2,2,2,3,3,3,4,4,5,5,5,6,6,7,7,7,8,8,9,9,9,0,0,1,1,1,2,2,2,3,3,4,4
db 4,5,5,6,6,6,7,7,8,8,8,9,9,0,0,0,1,1,2,2,2,3,3,3,4,4,5,5,5,6,6,7,7,7,8,8,9,9
db 9,0,0,1,1,1,2,2,2,3,3,4,4,4,5,5,6,6,6,7,7,8,8,8,9,9,0,0,0,1,1,2,2,2,3,3,3,4
db 4,5,5,5,6,6,7,7,7,8,8,9,9,9,0,0,1,1,1,2,2,2,3,3,4,4,4,5,5,6,6,6,7,7,8,8,8,9
db 9,0,0,0,1,1,2,2,2,3,3,3,4,4,5,5,5,6,6,7,7,7,8,8,9,9,9,0,0,1,1,1,2,2,2,3,3,4
db 4,4,5,5,6,6,6,7,7,8,8,8,8,9,9,0,0,0,1,1,2,2,2,3,3,4,4,5,5,5,6,6,7,7,7,8,8,9
db 9,0,0,0,1,1,2,2,2,3,3,3,4,4,5,5,5,6,6,7,7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,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1

end

From the results of the program that has been made then can be followed the results obtained in the table below.

hasil adc.jpg

Calculations that can be obtained

Vx = VR [b12-1 + b22- 2 + b32-3 + b42 - 4 + b52-5 + b62-6 + b72-7 + b82-8]

Temperature 00
Vx = 5 [0 × 2-1 + 0 × 2- 2 + 0 × 2-3 + 0 × 2 - 4 + 0 × 2-5 + 0 × 2-6 + 0 × 2-7 + 1 × 2- 8]
= 5 [1 × 2-8]
= 5 [0.0039]
= 0.01V

Percentage
= 100%

Temperature 50
Vx = 5 [0 × 2-1 + 0 × 2- 2 + 0 × 2-3 + 0 × 2 - 4 + 1 × 2-5 + 1 × 2-6 + 0 × 2-7 + 1 × 2- 8]
= 5 [1 × 2-5 + 1 × 2-6 + 1 × 2-8]
= 5 [0.0508]
= 0.253V

Percentage
= 97.3%

Temperature 100
Vx = 5 [0 × 2-1 + 0 × 2- 2 + 0 × 2-3 + 1 × 2 - 4 + 1 × 2-5 + 0 × 2-6 + 1 × 2-7 + 0 × 2- 8]
= 5 [1 × 2 - 4 + 1 × 2-5 + 1 × 2-7]
= 5 [0.1016]
= 0.507V

Percentage
= 99.4%

Temperature 200
Vx = 5 [0 × 2-1 + 0 × 2- 2 + 1 × 2-3 + 1 × 2 - 4 + 0 × 2-5 + 0 × 2-6 + 1 × 2-7 + 1 × 2- 8]
= 5 [1 × 2-3 + 1 × 2- 4 + 1 × 2-7 + 1 × 2-8]
= 5 [0.199]
= 0.996V

Percentage
= 99.6%

Temperature 300
Vx = 5 [0 × 1 × 2- 2-1 + 2 + 0 + 0 × 2-3 × 2-4 + 1 × 1 × 2-5 + 2-6 + 2-7 + 0 × 0 × 2- 8]
= 5 [1 × 2- 2 + 1 × 2-5 + 1 × 2-6]
= 5 [0.296]
= 1.48V

Percentage
= 95.4%

Temperature 400
Vx = 5 [0 × 1 × 2- 2-1 + 2 + 1 + 0 × 2-3 × 2-4 + 2-5 + 0 × 1 × 1 × 2-6 + 2-7 + 0 × 2- 8]
= 5 [1 × 2- 2 + 1 × 2-3 + 1 × 2-6 + 1 × 2-7]
= 5 [0398]
= 1.992V

Percentage
= 97.5%

Temperature 500
Vx = 5 [1 × 2-1 + 0 × 2- 2 + 0 × 2-3 + 0 × 2 - 4 + 0 × 2-5 + 0 × 2-6 + 1 × 2-7 + 0 × 2- 8]
= 5 [1 × 2-1 + 1 × 2-7]
= 5 [0.507]
= 2.53V

Percentage
= 99.6%

Temperature 600
Vx = 5 [1 × 2-1 + 0 × 2- 2 + 0 × 1 × 2-3 + 2-4 + 2-5 + 0 × 1 × 1 × 2-6 + 2-7 + 1 × 2- 8]
= 5 [1 × 2-1 + 1 × 2 - 4 + 1 × 2-5 + 1 × 2-7 + 1 × 2-8]
= 5 [0.605]
= 3.02V

Percentage
= 99.3%

Temperature 700
Vx = 5 [1 × 2-1 + 0 × 2- 2 + 1 × 1 × 2-3 + 2-4 + 0 × 1 × 2-5 + 2-6 + 2-7 + 0 × 0 × 2- 8]
= 5 [1 × 2-1 + 1 × 2-3 + 1 × 2 - 41 × 2-6]
= 5 [0.7031]
= 3.51V

Percentage
= 99.4%

Temperature 800
Vx = 5 [1 × 1 × 2- 2-1 + 2 + 0 + 0 × 2-3 × 2-4 + 1 × 1 × 2-5 + 2-6 + 2-7 + 0 × 1 × 2- 8]
= 5 [1 × 2-1 + 1 × 2-2 + 1 × 2 - 5 + 1 × 2-6 + 1 × 2-8]
= 5 [08008]
= 4.00V

Percentage
= 99.2%

Temperature 900
Vx = 5 [1 × 2-1 + 1 × 2- 2 + 1 × 2-3 + 0 × 2 - 4 + 0 × 2-5 + 1 × 2-6 + 1 × 2-7 + 1 × 2- 8]
= 5 [1 × 2-1 + 1 × 2- 2 + 1 × 2-3 + 1 × 2-6 + 1 × 2-7 + 1 × 2-8]
= 5 [0.902]
= 4.51V

Percentage.
= 99.7%

Temperature 1000
Vx = 5 [1 × 2-1 + 1 × 2- 2 + 1 × 2-3 + 0 × 2 - 4 + 0 × 2-5 + 1 × 2-6 + 1 × 2-7 + 1 × 2- 8]
= 5 [0.996]
= 4.98V

Percentage
= 99.2%



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Your contribution cannot be approved because it does not follow the Utopian Rules.

  • The tutorial doesn’t seem to be well written. Also, many of the infos are available in the software help.

  • The codes are copy paste.

You can contact us on Discord.

[utopian-moderator]

Hey @manishmike10, I just gave you a tip for your hard work on moderation. Upvote this comment to support the utopian moderators and increase your future rewards!

Coin Marketplace

STEEM 0.25
TRX 0.20
JST 0.038
BTC 94129.96
ETH 3496.79
USDT 1.00
SBD 3.78