This is the last post of pressure sensor project based on microcontroller 8051. The code is written in assembly language.Data Collection Analog to Digital Conversion and Communicating ,It uses an ADC0804 chip to convert from analog to digital and an AT89C2051 is interfaced with ADC and LCD.
Below is Assembly Language code for Microcontroller 8051 project; this code have all the features including, ADC interface with microcontroller 8051, getting data from ADC to microcontroller, controlling seven segment display with microcontroller, performing required calculation of pressure from measured voltages using formula described in previous post. And serial communication with microcontroller and PC through RS232 port.circuit diagram and assembly language program for interfacing of ADC Samples of 89c2051 interfacing with MAX 233/ ADC0804 an assembly language program and loading it into the microcontroller.
org 0000h
CALL INITILIZE_SERIAL
main: clr p3.7 ;this is for WR signal of ADC to give it a rising edge
call delay ;
setb p3.7 ;
call delay
call delay
clr p3.6 ; to clear the RD signal of ADC
mov a, p0 ; latches data at port A
setb p3.6 ; to set the RD of ADC
subb a,#50h ; received data is displaced by 80 so it is
mov r3, a
call TO_FORCE
call TO_PRESSURE
mov b,#10
div ab ; used to convert the two digit BCD to BINARY
mov r0,b
mov r1,a
mov dptr,#data_table ;to read the seven segment code against a Binary ;form the Code Memory
mov a, r0
movc a, @a+dptr
mov r0, a
mov a, r1
movc a, @a+dptr
mov r1, a
clr p3.5
clr p3.4
setb p3.4
mov p1,r0
call delay
clr p3.5
setb p3.5
mov p1,r1
call delay
clr p3.5
sjmp $
TO_FORCE: ; the pressure transducer having different parameters
mov r4, #1 ;1 is the spring constant (supposed)
mov b, r4
mul ab
ret
TO_PRESSURE: ; in this subroutine the pressure is calculated from the incoming data and using formula
mov r4, #1 ;1 is the Area of the cylinder ( supposed )
mov b, r4
div ab
ret
delay:
mov r0, #127
djnz r0, $
ret
data_table: db 7eh,30h,60h,79h,13h,5bh,5fh,70h,7fh,77h
INITILIZE_SERIAL:; In this subroutine the required initialization of the serial communication is done, ;different registers of microcontroller are initialized to get response from RS232
;intilize the timer 1 in auto reload mode
;and then set the baud rate 2400 in mode1 of
;serial port
MOV SCON,#01000000B; it is the serial control register of microcontroller 8051
MOV TMOD,#20H; timer mode of microcontroller 8051 is selected here
MOV TH1,#-12; upper byte of timer 1 is feed
SETB TR1
CLR RI
CLR TI
RET
SEND_TO_PC: This subroutine sends data to PC from Microcontroller 8051 using RS232 serial communication
MOV SBUF,A; serial buffer register SBUF is feed the data in register A
JNB TI,$
CLR TI
RET
end
Tags:-
Example Assembly language code/ program for microcontroller 8051, how to display results on seven segment, seven segment display controlling with microcontroller 8051, seven segment display controlling program in assembly language, Interfacing of ADC with microcontroller 8051 in assembly language, example program in assembly language for the control and interfacing of adc with 8051 microcontroller, serial communication with PC through RS232 in assembly language, how to have serial serial communication with PC and micro controller in assembly language, subroutine for RS232 serial communication,assembly language examples,assembly language tutorial,learn assembly language,assembly language pdf,high level language,machine language,low level language,assembler,seven segment data sheet,8051 interfacing with adc seven segment display datasheet,seven segment display interfacing,seven segment display decoder,seven segment display circuits,seven segment datasheet,seven segment led digit delphi,seven segment digital clock,microcontroller basics,microcontroller 8051,microcontroller applications,microcontroller tutorial,microcontroller projects,microcontroller vs microprocessor,pic Digital Voltmeter Using ADC0804, 8051, and 7 LED Display : 8051 microcontroller,microprocessor assembly language code, assembly code,assembly code help,assembly code projects,assembly code circuits,machine code
BACK to Content Page
.
. Previous Page
Below is Assembly Language code for Microcontroller 8051 project; this code have all the features including, ADC interface with microcontroller 8051, getting data from ADC to microcontroller, controlling seven segment display with microcontroller, performing required calculation of pressure from measured voltages using formula described in previous post. And serial communication with microcontroller and PC through RS232 port.circuit diagram and assembly language program for interfacing of ADC Samples of 89c2051 interfacing with MAX 233/ ADC0804 an assembly language program and loading it into the microcontroller.
org 0000h
CALL INITILIZE_SERIAL
main: clr p3.7 ;this is for WR signal of ADC to give it a rising edge
call delay ;
setb p3.7 ;
call delay
call delay
clr p3.6 ; to clear the RD signal of ADC
mov a, p0 ; latches data at port A
setb p3.6 ; to set the RD of ADC
subb a,#50h ; received data is displaced by 80 so it is
mov r3, a
call TO_FORCE
call TO_PRESSURE
mov b,#10
div ab ; used to convert the two digit BCD to BINARY
mov r0,b
mov r1,a
mov dptr,#data_table ;to read the seven segment code against a Binary ;form the Code Memory
mov a, r0
movc a, @a+dptr
mov r0, a
mov a, r1
movc a, @a+dptr
mov r1, a
clr p3.5
clr p3.4
setb p3.4
mov p1,r0
call delay
clr p3.5
setb p3.5
mov p1,r1
call delay
clr p3.5
sjmp $
TO_FORCE: ; the pressure transducer having different parameters
mov r4, #1 ;1 is the spring constant (supposed)
mov b, r4
mul ab
ret
TO_PRESSURE: ; in this subroutine the pressure is calculated from the incoming data and using formula
mov r4, #1 ;1 is the Area of the cylinder ( supposed )
mov b, r4
div ab
ret
delay:
mov r0, #127
djnz r0, $
ret
data_table: db 7eh,30h,60h,79h,13h,5bh,5fh,70h,7fh,77h
INITILIZE_SERIAL:; In this subroutine the required initialization of the serial communication is done, ;different registers of microcontroller are initialized to get response from RS232
;intilize the timer 1 in auto reload mode
;and then set the baud rate 2400 in mode1 of
;serial port
MOV SCON,#01000000B; it is the serial control register of microcontroller 8051
MOV TMOD,#20H; timer mode of microcontroller 8051 is selected here
MOV TH1,#-12; upper byte of timer 1 is feed
SETB TR1
CLR RI
CLR TI
RET
SEND_TO_PC: This subroutine sends data to PC from Microcontroller 8051 using RS232 serial communication
MOV SBUF,A; serial buffer register SBUF is feed the data in register A
JNB TI,$
CLR TI
RET
end
Tags:-
Example Assembly language code/ program for microcontroller 8051, how to display results on seven segment, seven segment display controlling with microcontroller 8051, seven segment display controlling program in assembly language, Interfacing of ADC with microcontroller 8051 in assembly language, example program in assembly language for the control and interfacing of adc with 8051 microcontroller, serial communication with PC through RS232 in assembly language, how to have serial serial communication with PC and micro controller in assembly language, subroutine for RS232 serial communication,assembly language examples,assembly language tutorial,learn assembly language,assembly language pdf,high level language,machine language,low level language,assembler,seven segment data sheet,8051 interfacing with adc seven segment display datasheet,seven segment display interfacing,seven segment display decoder,seven segment display circuits,seven segment datasheet,seven segment led digit delphi,seven segment digital clock,microcontroller basics,microcontroller 8051,microcontroller applications,microcontroller tutorial,microcontroller projects,microcontroller vs microprocessor,pic Digital Voltmeter Using ADC0804, 8051, and 7 LED Display : 8051 microcontroller,microprocessor assembly language code, assembly code,assembly code help,assembly code projects,assembly code circuits,machine code
BACK to Content Page
.
. Previous Page
No comments:
Post a Comment