This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

pulse dialing detection code

can the following code be used with 8051 to detect pulse dialing from 100 to 110, if yes , please explain something about this code.
;
;===================================================
;
; EIGHT NUMBER
; TELEPHONE DIALER
;
; 6/2/92
;
;===================================================
; DIALER.ASM ---------------- is a program
; that stores 8 preselected telephone numbers
; inside EPROM memory. When selected by the
; grounding of any PORT1 pin, pulses out
; the chosen number with a normally closed
; 5V relay (driven by a 2N4402 transistor) connected
; to PORT3.2. Relay contacts are connected IN
; SERIES with either the RED or GREEN wires
; of an incoming telephone line.
;
; Dialer.Asm was designed around Suncoast Technologies'
; inexpensive 8031/51 based Single Board Computer.
; The 70691C can be purchased Assembled/Tested for
; $38.00 Or in kit form for only $27.00 (plus $3.00
; to cover the cost of US Priority Mail).
;
; Suncoast Technologies
; P.O. Box 5835
; Spring Hill, Florida 34606
; Voice/Fax (904) 596-7599
;
; VISA/MASTERCARD Accepted
;
; Use the A51 program to assembly the Dialer.Asm
; program. Type "A51 Dialer" <Enter>. Dialer.Obj
; will be created. Then take this .OBJ file and
; further convert it to .BIN using HEXBIN.COM
; Type "Hexbin Dialer.Obj" <Enter>. Dialer.Bin will
; be created. Take this .BIN file and "Burn" it into
; a standard 2764 EPROM. Place the now programmed
; 2764 EPROM into the IC3 location on the 70691C
; Single Board Computer. Install the relay, spring
; return switches ans 2N4402 Xsistor. Apply power.
; Short and PORT1 pin to ground; relay will Pulse
; Out the pre-programmed telephone number.
;
; --------------------------------------------------
;
.ORG h'0000
.EQU ESC,h'1B
MOV PSW,#h'0
MOV SCON,#h'5A
MOV TMOD,#h'10
MOV TCON,#h'54
SETB TR1
START: CLR A
MOV P1,#d'255
SETB P3.2
SETB P3.3
LP1: MOV A,P1
CJNE A,#d'255,HOLD
SJMP LP1
HOLD: MOV R5,#d'50
LCALL DELAY
AA: CJNE A,#d'254,BB
LJMP DIAL_1
BB: CJNE A,#d'253,CC
LJMP DIAL_2
CC: CJNE A,#d'251,DD
LJMP DIAL_3
DD: CJNE A,#d'247,EE
LJMP DIAL_4
EE: CJNE A,#d'239,FF
LJMP DIAL_5
FF: CJNE A,#d'223,GG
LJMP DIAL_6
GG: CJNE A,#d'191,HH
LJMP DIAL_7
HH: CJNE A,#d'127,II
LJMP DIAL_8
II: LJMP START
;
DIAL_1: LCALL XSTRING
;
; Place first tel. # in line JJ
;
; Format "x-xxx-xxx-xxxx OR
; "xxx-xxxx"
;
JJ: .DB "1-800-562-5725"
.DB ESC
LJMP START
DIAL_2: LCALL XSTRING
;
; Place second # in line KK
;
KK: .DB "1-714-259-7733"
.DB ESC
LJMP START
DIAL_3: LCALL XSTRING
;
; Place third # in line LL
;
LL: .DB "1-214-271-5546"
.DB ESC
LJMP START
DIAL_4: LCALL XSTRING
; Place fourth # in line MM
;
MM: .DB "596-8830"
.DB ESC
LCALL START
DIAL_5: LCALL XSTRING
;
; Place fifth # in line NN:
;
NN: .DB "1-313-744-1330"
.DB ESC
LCALL START
DIAL_6: LCALL XSTRING
;
; Place sixth # in line PP
;
PP: .DB "1-800-344-4539"
.DB ESC
LCALL START
DIAL_7: LCALL XSTRING
;
; Place seventh # in line QQ
;
QQ: .DB "1-800-826-5432"
.DB ESC
LCALL START
DIAL_8: LCALL XSTRING
;
; Place eight # in line SS
;
SS: .DB "596-6632"
.DB ESC
LCALL START
;
; Read Each Number
;
XSTRING:
CLR P3.3
POP DPH
POP DPL
XSTR_1: CLR A
MOVC A,@A+DPTR
XSTR_2: LJMP CONVERT
;
; Pulse out number
;
DIAL: CLR P3.2
MOV R5,#d'2
LCALL DELAY
SETB P3.2
MOV R5,#d'2
LCALL DELAY
DJNZ R0,DIAL
MOV R5,#d'15
LCALL DELAY
NEXT: INC DPTR
CLR A
MOVC A,@A+DPTR
CJNE A,#ESC,XSTR_2
MOV A,#1
JMP @A+DPTR
;
; Jump to read next digit
;
CONVERT:
;
; Convert Port1 ASCII character
; to decimal number & stroe in R0
;
CJNE A,#'-',DIGIT_1
LJMP NEXT
DIGIT_1:
CJNE A,#'1',DIGIT_2
MOV R0,#d'1
DIGIT_2:
CJNE A,#'2',DIGIT_3
MOV R0,#d'2
DIGIT_3:
CJNE A,#'3',DIGIT_4
MOV R0,#d'3
DIGIT_4:
CJNE A,#'4',DIGIT_5
MOV R0,#d'4
DIGIT_5:
CJNE A,#'5',DIGIT_6
MOV R0,#d'5
DIGIT_6:
CJNE A,#'6',DIGIT_7
MOV R0,#d'6
DIGIT_7:
CJNE A,#'7',DIGIT_8
MOV R0,#d'7
DIGIT_8:
CJNE A,#'8',DIGIT_9
MOV R0,#d'8
DIGIT_9:
CJNE A,#'9',DIGIT_0
MOV R0,#d'9
DIGIT_0:
CJNE A,#'0',RETURN
MOV R0,#d'10
RETURN: LJMP DIAL

END: SJMP END
;
; Delay loop for Pulse Train
; duration
;
DELAY: NOP
LOOP1: DJNZ R5,LOOP2
RET
LOOP2: MOV R6,#d'240
LOOP3: MOV R7,#d'90
DJNZ R7,*
DJNZ R6,LOOP3
LJMP LOOP1
.END

  • No, the comments clearly state that the program is for pulse dialing. Dialing is not the same as detecting.

    Also, you direct questions about 8051 code and tools to the C51 forum, not the C166 forum.

  • Dear Sir,

    Firstly objective of asking these questions:-

    1) My planning to do an experiment in which when ever a telephone set not connected to main exchange line but cannot to a 18 Volts Dc & 330 Ohms Resistor goes off-hook my 8051 controller detects off-hook.

    2) Then in controller the programming should be such that controller can detect pulse only pulse dialing range , and when ever digit "0" is pressed, a 5 volts Dc relay connected to another pin of 8051 connects to a LED and it LIghts Up and similary when "122" is pressed from the pulse dialing telephone set the LED is turn out.

    i think the code i mentioned can compare the pulses coming in and then do the task corresponding to that digit. isn't.

    Problems:-

    1) Now can i use the circuit present on the following website to sent a Logic High Signal to controller pin , letting the controller know that the set is off-hooked

    http://home.att.net/~theremin1/circuitlibrary/offhookdcindicator.html

    can the above same circuit be use for sending pulses of digit dialing..

    Now let say that if i only have to press "0" can make the controller do what i need when "o" is pressed can i use the code i mentioned if yes please guide me how?

  • "i think the code i mentioned can compare the pulses coming in and then do the task corresponding to that digit.

    I, on the other hand, think the code you mention can generate the pulses going out, but that's just my opinion and as such, should be ignored if you think otherwise.

  • Sir,
    so tell me one thing...

    1) If some how i want that when ever a pulse comes on P1.0 controller checks whether this pulse is equal to digit "0" or not , if it is equal then do the task other wise do nothing... how i can write a code only for this....?

    Like in pulse dailing they say that when we press 1 = one time is telephone disconnects and conects , similary when 0 is pressed 10 pulse per second are generated ...i don't know if am on the right path or not coz there is no datasheet for this and also i am trying to do every thing to understand how to sent telephone dail pulse on the controller as i cannot just connect the tip or ring of telephone with pin 1.0.

    your suggestions

  • This guy has been creating havoc on 8052.com. Please ignore his posts.

    Stefan

  • i think people should help rather then saying that igrnore those who r asking for help.

  • Dear Wagar,
    Dan got angry because you plainly disregarded what he was telling you.
    I am going to give you the benefit of assuming that you do not understand English very well, and did not understand what he said.

    To re-state Dan's point. The code you have posted is only able to output pulse dialling, it is not able to detect it, so it is useless for your purpose.

    It also appears from your message that you do not yet understand how to detect the pulses output by a phone handset.
    A pulse dial phone passes between 20-60mA when it is in the "off-hook" condition.
    When it performs pulse dialling, this current is interrupted once per pulse. The current drops to much less than 1mA during the pulse condition. I would guess the pulse is around 50ms wide, but it would be best to test your intended device.
    So, you need some sort of circuit to translate the "conducting" and "not-conducting" states into a TTL level digital signal to connect to your micro. A common way to do this is to pass the current via an opto-coupler.
    You then need some software to count the pulses. You need to determine the elapsed time between each pulse. A short delay indicates that this is another pulse of the same digit. A longer gap indicates the pause between digits.
    Once you have the hardware sorted out, this really is a trivial programming exercise.

  • I just checked the circuit on the website you mentioned.
    You can use this circuit to detect the "off-hook" condition, and also to receive the dialing pulses.
    (your use of the word "send" in that message was confusing.)

  • Now that's what i call help. Thankyou , iam very greatful to you for providing such help.

    Now should i connect the off-hook out put logic high at poin 1.0.?

    Next basically i not was askinhg the question in the right way.

    Let say that if i want that the telephone connected with the off-hook circuit dial "1" , the controller lights up an LED attached at pin2.0. and when the telephone dials "2" the led is turned off.

    For this software i don't want to detect all the pulses coming from the telephone set but only the pulse which represent "1" and "2"

    so the program should be something like.

    ORG 00H
    JNB P1.0,$
    (Checking whether logical low signal comes showing that a digit is pressed)
    when the bit is set:-

    Since when digit "0" is pressed = telephone sents 10 pulses per second so if digit "1" is pressed then 1/10 = 0.1 pulse per second. So i think the program should be:-

    1) Check if any digit is pressed , if the bit P1.0 is set then,

    2) compare whether the bit is set once digit "1" is pressed then jump to light up condition other wise if bit is set and then cleared then it means "2" is pressed to jump to that condition .. i think this may work but i have to write some delay for the pulse check...

    can any one suggest any thing.



  • "This guy has been creating havoc on 8052.com."

    Thanks Stefan. Yes, I see now. Kindly put, he's losing a lot of friends over there!

  • This is not a general programming forum, it is a forum for fixing problems with Keil tools.
    Obviously this thread is way off topic, so I will try to settle some confusion in your mind, but this will be my last post on this thread.

    >For this software i don't want to detect
    >all the pulses coming from the telephone
    >set but only the pulse which represent "1"
    >and "2"
    ...
    >Since when digit "0" is pressed = telephone
    >sents 10 pulses per second so if digit "1"
    >is pressed then 1/10 = 0.1 pulse per
    >second.

    You have to detect all the pulses.
    When 1 is pressed, the phone sends one<\b> pulse.
    When 2 is pressed, the phone sends two<\b> pulses.
    When 0 is pressed, the phone sends ten<\b> pulses.

    You have to count all the pulses, then wait for a longer pause between pulses to know that you have received them all.

    >can any one suggest any thing.
    If you are still confused, find a friend to help who is a better programmer. If you continue to post this sort of question on this forum, you will make a lot of enemies.