Archive for 2013
traffic lights with 7 segment using 8051 microcontroller
It is a nice project. It is easy to understand and implement. I have implemented it on Proteus not on hardware but its easy when you will implement on hardware.
toggle program in assembly
Toggling using timer:
org 00h
mov p3,#00h
mov p2,#00h
again: acall delay
mov p2,#0feh
mov p3,#7fh
acall delay
mov p2,#0fch
mov p3,#3fh
acall delay
mov p2,#0f8h
mov p3,#1fh
acall delay
mov p2,#0f0h
mov p3,#0fh
acall delay
mov p2,#0e0h
mov p3,#07h
acall delay
mov p2,#0c0h
mov p3,#03h
acall delay
mov p2,#80h
mov p3,#01h
acall delay
mov p2,#00h
mov p3,#00h
acall delay
mov p2,#80h
mov p3,#01h
acall delay
mov p2,#0c0h
mov p3,#03h
acall delay
mov p2,#0e0h
mov p3,#07h
acall delay
mov p2,#0f0h
mov p3,#0fh
acall delay
mov p2,#0f8h
mov p3,#1fh
acall delay
mov p2,#0fch
mov p3,#3fh
acall delay
mov p2,#0feh
mov p3,#7fh
sjmp again
delay:mov tmod,#01h
mov th0,#00h
mov tl0,#00h
setb tr0
here: jnb tf0,here
clr tr0
clr tf0
ret
end
Tag :
Timer
toggle using timer using 8051 microcontroller
It is a good practice to toggle the pins using timer. We just provide exact delay using timer. Pins automatically changes its state after a given time delay.
This is the circuit diagram to check the toggled pins of microcontroller. We have connected LED to check the status of microcontroller.
CLICK HERE TO SEE THE TOGGLE PROGRAM
This is the circuit diagram to check the toggled pins of microcontroller. We have connected LED to check the status of microcontroller.
CLICK HERE TO SEE THE TOGGLE PROGRAM
Tag :
Timer
temperature sensor program
A digital temperature sensor
Temperature detector:
ORG 0000H
ADC_RD EQU P2.0
ADC_WR EQU P2.1
ADC_INTR EQU P2.2
MYDATA EQU P0
RAM_ADDR EQU 30H
ASCI_RSULT EQU 50H
MOV P0,#0FFH
MOV P1,#00H
MOV P3,#00H
ACALL LCD_INIT
SETB ADC_INTR
ACALL WRITE
BACK: CLR ADC_WR
SETB ADC_WR
HERE: JB ADC_INTR,HERE
CLR ADC_RD
MOV A,MYDATA
SETB ADC_RD
MOV A,MYDATA
MOV P1,A
ACALL CONVERSION
ACALL DELAY
SJMP BACK
DELAY: MOV R1,#05H
A1: MOV R2,#55H
A2: DJNZ R2,A2
DJNZ R1,A1
RET
LCD_INIT: MOV A,#38H
ACALL COMMAND
ACALL DELAY
MOV A,#0CH
ACALL COMMAND
ACALL DELAY
MOV A,#01H
ACALL COMMAND
ACALL DELAY
MOV A,#06H
ACALL COMMAND
ACALL DELAY
MOV A,#80H
ACALL COMMAND
ACALL DELAY
RET
WRITE:
MOV A,#'T'
ACALL DATA_DISPLAY
ACALL DELAY
MOV A,#'E'
ACALL DATA_DISPLAY
ACALL DELAY
MOV A,#'M'
ACALL DATA_DISPLAY
ACALL DELAY
MOV A,#'P'
ACALL DATA_DISPLAY
ACALL DELAY
MOV A,#':'
ACALL DATA_DISPLAY
ACALL DELAY
MOV A,#88h
ACALL COMMAND
ACALL DELAY
MOV A,#0DFH
ACALL DATA_DISPLAY
ACALL DELAY
MOV A,#89h
ACALL COMMAND
ACALL DELAY
MOV A,#'C'
ACALL DATA_DISPLAY
ACALL DELAY
RET
COMMAND:ACALL READY
MOV P1,A
CLR P2.3
CLR P2.4
SETB P2.5
NOP
NOP
NOP
CLR P2.5
RET
DATA_DISPLAY:ACALL READY
MOV P1,A
SETB P2.3
CLR P2.4
SETB P2.5
NOP
NOP
NOP
CLR P2.5
RET
READY: SETB P1.7
CLR P2.3
SETB P2.4
BACK1: CLR P2.5
ACALL DELAY
SETB P2.5
JB P1.7,BACK1
RET
CONVERSION:
mov r0,#RAM_ADDR
mov a,p1
mov b,#10
div ab
mov @r0,b
inc r0
mov b,#10
div ab
mov @r0,b
inc r0
mov @r0,a
MOV R0,#RAM_ADDR
MOV R1,#ASCI_RSULT
MOV R2,#3
BACKk: MOV A,@R0
ORL A,#30H
MOV @R1,A
INC R0
INC R1
DJNZ R2,BACKk
MOV A,#85H
ACALL COMMAND
ACALL DELAY
MOV A,52H
ACALL DATA_DISPLAY
ACALL DELAY
MOV A,51H
ACALL DATA_DISPLAY
ACALL DELAY
MOV A,50H
ACALL DATA_DISPLAY
ACALL DELAY
RET
END
CLICK HERE TO SEE CIRCUIT DIAGRAM