Jump to content
Electronics-Lab.com Community

difficulty facing in 89c2051 based alarm


Recommended Posts

hi everyone...my friend give me a task to install a an alarm circuit i his little industry.....he gave me instructions that a circuit should alarm after every 30 minutes,and it must only stops when any worker press the button,and when button is pressed the timer must restart ...every time a button is pressed. ckt should acknowledge the computer (data logging) the time button is pressed..
so i thought to use at89c2051 for this purpose i have made the ckt prototype....but still some problems are there, i have to design a driver ckt to on the alarm.and i dont know how to do data logging on pc...by rs485...

this is the circuit i designed but it didnt run according to program....so modify my prog for other micro controller trainer i have....the program runs fine ....now the modifications i want in my hardware is seven segment display of timer and it wud be better if timer can be set by user inputs through switches... can u guide me what modifications i must do in my circuit..plz help i want to make this thing like professional.

ORG 00H
MOV SP,#60
MOV TMOD,#21H ;TIMER 1 MODE 2, TIMER 0 MODE 1
MOV TH1,#-3 ;9600 BAUD RATE
MOV SCON,#50H ; SERIAL MODE SPECIFIER
PROGR: MOV P1,#00H
MOV P3,#00H
ACALL DELAY
;---------------------------------------
CANB: MOV TMOD,#01H
SETB P1.7 ;BUZZER INDICATOR OFF
SETB P1.4 ;ATTENDANCE INDICATOR OFF
SETB P1.1 ;SYSTEM BUSY INDICATOR OFF
CLR P1.3 ;RELAY OFF
SETB P1.0 ;BUZZER ON
ACALL DELAY
CLR P1.0 ;BUZER OFF

;----------------------------------------
REPEAT: CLR P1.1 ;SYSYTEM BUSY ON
ACALL DELAY30M
SETB P1.1 ;SYSTEM BUSY LED OFF
SETB P1.0 ;BUZZER ON
SETB P1.3 ;RELAY ON
CLR P1.7 ;BUZZER INDIACTOR ON
SETB P1.2 ;MAKE P1.2 INPUT PORT

SWITCH: JNB P1.2,SWITCH
CLR P1.0 ; BUZZER OFF
CLR P1.3 ; RELAY OF
SETB P1.7; BUZZER INDICATOR OFF
;-----------------------------------------------
SERIAL: SETB TR1
MOV DPTR,#MYDATA
SER_1: CLR A
MOVC A,@A+DPTR
JZ REPEAT
ACALL TRANSMIT
INC DPTR
SJMP SER_1

TRANSMIT:
MOV SBUF,A
T_1: JNB TI,T_1
CLR TI
RET

;----------------------------------------
DELAY: MOV R4,#100
DL1: MOV R5,#200
DL2: MOV R6,#200
DL3: DJNZ R6,DL3
DJNZ R5,DL2
DJNZ R4,DL1
RET
;----------------------------------------
DELAY30M:

MAIN: MOV R1,#9
MAIN1: MOV R2,#200
MAIN2: ACALL TIMER
DJNZ R2,MAIN2
DJNZ R1,MAIN1
RET
TIMER:
BACK: MOV TH0,#4BH ; FOR 50MS
MOV TL0,#0FDH
SETB TR0
TIM: JNB TF0,TIM
CLR TR0
CLR TF0
RET

MTDATA : DB 'MACHINE ATTENDED',0
;----------------------------------------

END

post-50743-14279144128338_thumb.gif

Link to comment
Share on other sites


Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
  • Create New...