![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | Thread Tools | Display Modes |
| | (permalink) |
| Experienced Member | Objective is when ever Telephone Set goes off hook , controller detects off hook and sents a Dial Tone to the telephone set for 20 Seconds and after 20 seconds program END. Using 12 MHz Crystal. Firstly the Program do nothing untill a logical high signal comes at P1.0. When a Logical high Signal somes at P1.0, Timer 0 interrupt comes in act 1000 Hz square wave is produced at P2.0. Now how I can make controller to sent this upto 20 seconds and, After that sents a Busy TONE type of Sound by generating the same square wave but with 0.1 second ON and 0.1 Second OFF. ORG 00H LJMP MAIN ORG 000BH CPL P2.0 RETI MAIN: JNB P1.0,$ JMP DIAL TONE DIAL TONE: MOV TMOD,#20H MOV TH0,,#-50 SETB TR0 MOV IE,#82H Upto 20 seconds DIAL TONE and after that BUSY TONE keeps on going. END |
| | |
| | (permalink) |
| Super Moderator | You need to count the time duration in interrupt. Since you are using timer to complement P2.0 at every interrupt, you can also increment pair of 8-bit registers (for 16-bit counting or more if you need)in your ISR. Now check this count for desired value from your main program and end it when you reach the desired value. I am using DPTR (16-bit) for following example. Code: ORG 00H LJMP MAIN ORG 000BH CPL P2.0 INC DPTR RETI MAIN: MOV DPH,#0 MOV DPL,#0 JNB P1.0,$ JMP DIAL TONE DIAL TONE: MOV TMOD,#20H MOV TH0,,#-50 SETB TR0 MOV IE,#82H NOT_EQ: MOV A,DPH CJNE A,#9Ch,NOT_EQ MOV A,DPL CJNE A,#40h,NOT_EQ CLR TR0 ;STOP TIMER 0 AND THEN END AJMP $ ;INFINITE LOOP i.e. END OF PROGRAM END
__________________ "There is no way to peace, peace is the way!" |
| | |
| | (permalink) |
| Experienced Member | thanks you sir... you reply has really helped me how to use timer to create delays without using DJNZ command.... really i have no words to thank you.. Hope to get future help on this also. |
| | |
| | (permalink) |
| Experienced Member | Hi all , I have tried to generate a square wave which can produce a Telephone Dial Tone Sound but following are few problems:- 1) Firstly iam using AVS51 simulator , L51 linker and X51 assembler , is there any free downloadable window based software any one can guide me or shareware? 2) For dial tone we have to generate a 400Hz Square Wave, 3) For this i have used 1250 micro-second delay , timer 0 in 16 Bit Mode, and output of square wave is at P2.0. 4) Now when i run this program on simulator , the simulator keeps pn going and going on with the program while i want that after 20 seconds program stops ...any reason why simultor shows this? 5) Next how i can see in the simulator that 400Hz Square is generated upto 20 seconds ...is there any way for this? 6) Can i use the same timer in such a way that after 20 seconds , 400 Hz Square Wave is generated again but with 0.5 seconds ON time and 0.5 Seconds OFF time...i know that you have indicated some hint for doing this in your post but please clear that how to perform this Like firstly controller bit P1.0 is set when ever telephone set goes off, At this stage controller sents a 400Hz continues Square Wave upto 20 seconds and if the telephone set does not go ON Hook then after 20 seconds controller sents 400Hz square wave with 0.5 seconds ON time and 0.5 Off-Time. Here's the program :- ORG 00H JMP MAIN ORG 000BH CPL P2.0 INC DPTR RETI MAIN: MOV DPH,#0 MOV DPL,#0 JNB P1.0,$ JMP DIAL DIAL: MOV TMOD,#01B CLR TR0 MOV TH0,#FBH MOV TL0,#1EH SETB TR0 SETB ET0 SETB EA MOV A,DPH CJNE A,#C8H,NOT MOV A,DPL CJNE A,#50H,NOT NOT: SJMP $ END |
| | |
| | (permalink) |
| Experienced Member | i have tried many times but unable to do this...please check my above mentioned codes and provide me some suggestion howt o perform this... |
| | |
| | (permalink) |
| Super Moderator | I think you have misplaced the "NOT" label. Look where it is in my code.
__________________ "There is no way to peace, peace is the way!" |
| | |
| | (permalink) |
| Experienced Member | the problem is continuining the 400hz tone for 20 seconds and then sending busy tone.... |
| | |
| | (permalink) |
| Super Moderator | Thats what I am saying. Look at the "NOT" label you have placed at. It should be at place where my "NOT_EQ" label is. By the way, where is the code for busy tone?
__________________ "There is no way to peace, peace is the way!" |
| | |
| | (permalink) |
| Experienced Member | ok..its clear now.... so now if i place a 8 ohms speaker and connect it at p2.0 i will hear these sounds...rights. can i generate these sounds using KA1458 dual operation amplifier... |
| | |
| | (permalink) |
| Super Moderator | Yes you can do it.
__________________ "There is no way to peace, peace is the way!" |
| | |
| | (permalink) |
| Experienced Member | Suppose if i have 8 ohms speaker connected to p2.0 how i can make use of KA1458 to sents dial tone , busy tone and ring tone to this speaker .... let say when i give supply to the controller.. dial tone starts to occur on the speaker for 20 seconds.... after that busy tone starts to appear untill power is disconnected... i have seen its datasheet but did not understand any thing how to use it for tone generation.. |
| | |