sush
Member level 4
hi,
I'm almost new to micro-controllers. I made this small project to switch on&off a
relay using 89c51, and Push-button. I've installed both switch and relay on port0.
and also added pullup resistors. The system is working fine, but, my problem is,
whenever i switch on the system the relay switches on and off for a fraction of a
second, how can i eliminate this one time chattering of relay? i tried adding a
condensor at the base of transistor, the chattering stopd but when i need to push
the switch to on the system the relay takes some time to switch on. I'm sending both diagram and code, please help!!!
every help would be appriciated, Thanks.
I'm almost new to micro-controllers. I made this small project to switch on&off a
relay using 89c51, and Push-button. I've installed both switch and relay on port0.
and also added pullup resistors. The system is working fine, but, my problem is,
whenever i switch on the system the relay switches on and off for a fraction of a
second, how can i eliminate this one time chattering of relay? i tried adding a
condensor at the base of transistor, the chattering stopd but when i need to push
the switch to on the system the relay takes some time to switch on. I'm sending both diagram and code, please help!!!
every help would be appriciated, Thanks.
Code:
;***************************************************************************
#INCLUDE "8051EQU.INC" ;include predefined constants
;
;**************************************************************************
; RESET ;reset routine
.ORG 0H ;locate routine at 00H
AJMP START ;jump to START
;
;**************************************************************************
;
; INTERRUPTS (not used) ;place interrupt routines at appropriate
;memory locations
.ORG 03H ;external interrupt 0
RETI
.ORG 0BH ;timer 0 interrupt
RETI
.ORG 13H ;external interrupt 1
RETI
.ORG 1BH ;timer 1 interrupt
RETI
.ORG 23H ;serial port interrupt
RETI
.ORG 25H ;locate beginning of rest of program
;
;**************************************************************************
;
INITIALIZE: ;set up control registers
;
MOV TCON,#00H
MOV TMOD,#00H
MOV PSW,#00H
MOV IE,#00H ;disable interrupts
RET
;
;**************************************************************************
;**************************************************************************
;
START:
ACALL INITIALIZE
LOOP:
JB P0.1, LOOP
HERE:
JNB P0.1, HERE ;WAIT FOR KEY RELEASE
CPL P0.2
AJMP LOOP
.END