I am giving the output of IR rxers to P2.0 to P2.3 of the uC 89C51..and programming the output from P1.6 to 0 or 1 according to state of IR rxers o/p...this i am giving to a 1k resistor and then to BC547 transistor...and to 12v spdt relay...
all the voltage levels on the i/p pins of uC are accurately varying according to IR beam being detected or broken but the output from P1.6 stays constant at 0.65 volts...don't know why.. and the drop across the 1k resistor is 0v...
can someone pls help?
all the voltage levels on the i/p pins of uC are accurately varying according to IR beam being detected or broken but the output from P1.6 stays constant at 0.65 volts...don't know why.. and the drop across the 1k resistor is 0v...
can someone pls help?
Rich (BB code):
Program to monitor status of Infrared Receiver according
;to occupancy in classroom and switch ON/OFF supply
org 0000h ;
mov P2,#00h ;clear the other pins other than i/p pins
mov P2,#0Fh ;make P2.0 to P2.3 input port
;if the IR beam is not blocked i.e. nobody is present in
;class so relay is OFF,o/p is low
;if the IR beam is blocked i.e.
;someone present so relay must energize,o/p is high
back:mov A,P2 ;copy input in ACC
JNZ relay1 ;if ACC is 1,somebody is present in class so relay must switch ON supply
acall delay ;
;Using Timer 0 in mode 1 for 10 sec delay
delay: mov tmod,#01h ;use timer0 in mode1
mov R0,#1680 ;
back2: mov th0,#00h ;load the delay in high byte of timer reg
mov tl0,#00h ;load the delay in lower byte of timer reg
setb tr0 ;start the timer0
back1: jnb tf0,back1 ;till time has elapsed stay here
clr tf0 ;
clr tr0 ;
djnz R0,back2 ;
;Now using timer 1 in mode 1 for another 10 sec delay
mov tmod,#10h ;use timer1 in mode1
mov R1,#1680 ;
back3: mov th1,#00h ;load the delay in high byte of timer reg
mov tl1,#00h ;load the delay in lower byte of timer reg
setb tr1 ;start the timer0
back4: jnb tf1,back4 ;till time has elapsed stay here
clr tf1 ;
clr tr1 ;
djnz R1,back3 ; do nothing if nobody present
sjmp back ;continue monitoring the status of the receiver
RET ;
relay1: setb P1.6 ;give base drive to transistor to energize the relay
sjmp back ;continue monitoring the status of the receiver
end ;