giordano
Newbie level 5
- Joined
- Nov 28, 2012
- Messages
- 8
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- Indonesia
- Activity points
- 1,376
I have build a project using AT89S51 and comparator LM324. The input to uC is from comparator that the inverting input is connected to infrared sensor and the non-inverting input set as the voltage reference (Vr). For certain distance the output voltage from infrared sensor is higher than the Vr so that the output from comparator is low and otherwise. This output is connected to P1.0, and a led is connected to P3.0. My intention is to make the led on when the output from comparator is low and led off when the output from comparator is high. However, when I test it the led is only on or off for once after I power on my uC even I already made loop in source code. Can anybody help me to fix this problem?
The circuit is
The circuit is
Code:
ORG 0H
START:
MOV A,P1
CJNE A,#0FEH,LED_OFF
LED_ON:
CLR P3.0
SJMP START
LED_OFF:
SETB P3.0
SJMP START
END