I already make an example of using temperature sensor with ADC0831 connect to 8051 .When you give heat at the temperature sensor and the LCD display data temperature will be increase...
The ADC0831 series are 8-bit successive approximation A/D converters with a serial I/O and configurable input multiplexers with up to 8 channels. The serial I/O is configured to comply with the NSC MICROWIRE™ serial data exchange standard for easy interface to the COPS™ family of processors, and can interface with standard shift registers or µPs. The 2-, 4- or 8-channel multiplexers are software configured for single-ended or differential inputs as well as channel assignment. The differential analog voltage input allows increasing the common-mode rejection and offsetting the analog zero input voltage value. In addition, the voltage reference input can be adjusted to allow encoding any smaller analog voltage span to the full 8 bits of resolution.
List of equipment
IMPORTANT: ANY CONNECTION SHOULD FOLLOW THE SCHEMATIC DIAGRAM TO AVOID THE COMPONENTS FROM DAMAGE.
In ADC0831 interfacing, the Vin(+) is connect to analog pin data from sensor used and pin Vin (-) to ground. Three main pin CS, CLK and DO are connect to I/O microcontroller and Vref can be directly connect to VCC supply (+5VDC). The basic program for ADC0831 with 8051 is show below by according the timing pulse graph above. The data from ADC0831 only transfer to P1 as an output.
CLK BIT P1.1
CS BIT P1.0
DO BIT P1.2
ORG 00H
MOV P2,#00H
SENS1: MOV R0,#8
CLR CS
UP: CLR CLK
ACALL DELAY
SETB CLK
ACALL DELAY
MOV C,DO
RLC A
DJNZ R0,UP
SETB CS
MOV P2,A
MOV R7,A
AJMP SENS1
END
First of all I made a schematic circuit in Proteus and write program in Keil Uvision3 and perform simulation.You can see circuit that i have make.After finish and record the value of display i build circuit on bredboard.
Circuit
Program
CLK BIT P1.1
CS BIT P1.0
DO BIT P1.2
ORG 00H
MOV A,#38H
ACALL COMNWRT
ACALL DELAY
MOV A,#0EH
ACALL COMNWRT
ACALL DELAY
MOV A,#01
ACALL COMNWRT
ACALL DELAY
MOV A,#06H
ACALL COMNWRT
ACALL DELAY
MOV P2,#00H
SENS1: MOV R0,#8
CLR CS
UP: CLR CLK
ACALL DELAY
SETB CLK
ACALL DELAY
MOV C,DO
RLC A
DJNZ R0,UP
SETB CS
MOV P2,A
MOV R7,A
ACALL CONVT
AJMP SENS1
CONVT: MOV A,#84H
ACALL COMNWRT
ACALL DELAY
MOV A,R7
MOV B,#10
DIV AB
MOV R3,B
MOV B,#10
DIV AB
MOV R2,B
MOV R1,A
CLR A
MOV A,#30H
ADD A,R1
MOV R1,A
CLR A
MOV A,#30H
ADD A,R2
MOV R2,A
CLR A
MOV A,#30H
ADD A,R3
MOV R3,A
MOV A,#"T"
ACALL DATAWRT
MOV A,#"E"
ACALL DATAWRT
MOV A,#"M"
ACALL DATAWRT
MOV A,#"P"
ACALL DATAWRT
MOV A,#":"
ACALL DATAWRT
MOV A,R1
ACALL DATAWRT
MOV A,R2
ACALL DATAWRT
MOV A,R3
ACALL DATAWRT
MOV A,#"'"
ACALL DATAWRT
MOV A,#"C"
ACALL DATAWRT
RET
COMNWRT:MOV P2,A
CLR P3.5
CLR P3.6
SETB P3.7
ACALL DELAY
CLR P3.7
RET
DATAWRT:MOV P2,A
SETB P3.5
CLR P3.6
SETB P3.7
ACALL DELAY
CLR P3.7
RET
DELAY: MOV 40H,#120
HERE1: MOV 41H,#250
TERUS: DJNZ 41H,TERUS
DJNZ 40H,HERE1
RET
END
3 Ulasan
maaf pak, adc 0831 bisa beli dimana? thanks
BalasPadamKlau mau beli brg komponen blehlah melayari laman web elements14.com atau electroniccomponents.com
PadamKlo cara program 0838 bisa bntu
BalasPadam