Title: Timing alarm ckt using at89c2051...interfacing it with lan Post by: sinner on March 22, 2010, 04:36:36 16:36 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...i saw ic ENC28J60 ethernetcontroller...but dont know how to program and wht its range to carry data signal....im not using serial communication bcoz it has distance limit too short......can anyone help me in programming this micro controller and ethernet controller... Title: Re: Timing alarm ckt using at89c2051...interfacing it with lan Post by: rentau on March 23, 2010, 01:50:08 01:50 at89c2051? 2k flash with 128bytes of RAM. you can do something like driving relay, some buzzer and a SIMPLE RS232 communication with easy to use wireless communication to your PC. or wire it XD
Title: difficulty facing in 89c2051 based alarm Post by: sinner on March 24, 2010, 06:06:58 18:06 difficulty facing in 89c2051 based alarm....ckt is intended to alarm after every 30 minutes..and after a key is pressed ,alarm should be stop,,the ckt should communicate serially via rs232....
Title: Re: difficulty facing in 89c2051 based alarm Post by: sam_des on March 24, 2010, 07:21:59 19:21 Hi sinner,
You forgot to tell us about problem you are facing :P It will be easier to help you if ask questions correctly. I just looked (not very carefully :-X), & it seems to have few problems. Is this your first program ? I suggest that you handle one task at a time. Just do alram logic first & then worry about serial interface. And use C if you can. There are many excellent compilers for 8051, some are even free like sdcc. BTW, don't start new topic unnecessarily. Continue with old topic if subject is same. reagrds, sam_des Title: Re: Timing alarm ckt using at89c2051...interfacing it with lan Post by: sinner on March 25, 2010, 08:50:16 20:50 above was 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..
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 Title: Re: Timing alarm ckt using at89c2051...interfacing it with lan Post by: sam_des on March 25, 2010, 09:39:43 21:39 Hi,
You still did NOT tell us what problem you are actually facing >:( Is your program running at all ? or running just once ? or doing alarm but not serial output ? or vice versa ? You don't even bother to mention what your crystal freq is in either your ckt or your code >:( Or do you expect others to write that program down for you ? >:( If you are testing your code on trainer, note that 8051 trainers usually have ROM monitor, which in turn downloads & runs your program from RAM & also provide additional functions to you, like keypad, 7-segment display. It's first & foremost rule of software developement to simplify problem at hand & here you are increasing it now by adding 7-segment & switches to set time while your program isn't functioning in the first place without it. :P As I told you in previous post, divide your task & test them independently and once you got them working integrating them together is an easy task. Run each part in simulator independently, step through your code & see if it's working. Try changing few inputs such as clock, delay desired etc & see how this affects your code. Does it holds or breaks down ? This is how reusable blocks of code are written. Now burn your code into actual CPU, use few dummy/debug outputs to checkpoint your code. It is nice to have ICE like tools, but surely we can do without them. Once you're satisfied, go onto next task. There is no main-line loop in your program. Since you want your code to run indefinitely until power is removed, your code should have a infinite loop. That's why asked you if this your first program or not !!! Secondly, it seems you're pretty poor coder. Your comments aren't telling us anything other than what each statement line does. Purpose of commenting the code is not just telling 'what' but also 'how' & 'why'. Develop this skill early in your career or you will be always figihting with your code & collegues later. Remember there will be v2.0, and you will definitely wish to use code from v1.0. Also, using assembly over HLL, require even more care, since it is now even less clear what code does just by looking at code. There is nothing wrong with doing mistakes but unwillingness learn & to hardwork certainly is :-X regards, sam_des Title: Re: Timing alarm ckt using at89c2051...interfacing it with lan Post by: DreamCat on April 11, 2010, 03:11:19 15:11 2051 with LAN? maybe it is a little difficult, though you use 28j60.
I think your means that he need a circuit, general alarm once every 30 minutes. when time is up, wait worker press the button to restart the timer count, and send data(or message) to computer? oh sorry , I just saw the image you post. you only want (or need) to extend distance between the computer and your device. if distance less than 1000m, why not try rs485? it is very simple and low cost. |