Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pulse Dialing software

Status
Not open for further replies.

lanceaustin

Programmer
May 5, 2003
23
DE
Is there any way to make mircocontroller detect pulse dialing..the hardware work is done the only thing needed to make the controller count the incoming pulses and convert them into decimal digit//

any idea
 
I don't exactly know what you want to achieve and what you already achieved, but I've done some looking up in a 1973 encyclopedia and this is how pulse dialing works:

Taking the horn off the hook closes the telephone circuit to the telephone central. A line finder is then activated and starts rotating until a connection with a free selector is established. When this connection is established, a dialing tone is sent to the telephone, indicating the user can start forming a number. When creating the first digit, a number of pulses are generated (1 -> 1 pulse, ... 0 -> 10 pulses). Each pulse makes the selector drop one step vertically; when the digit is formed, the selector starts acting like a line finder and rotates horizontally until the next free selector is found. Now another digit can be formed. This process goes on until the entire number is formed. The last selector (line selector) uses 2 digits: the first to move vertically, the next to rotate horizontally (finding the next selector is not necessary, since there isn't any). This line selector connects with another telephone which will then start ringing.

There are several variations on this principle, they are all of economical reasons (and technical advancement): the less line finders and selectors there are, the cheaper the central.

As for delays, each system can have it's own standard, but interconnected networks must use the same standard.
Between single pulses there is a short, fixed-length delay and series of pulses are separated by a somewhat longer delay. This last delay is formed by the "blank space" on the telephone's choosing disk (between the 1 and the stopper). This delay should be long enough for the central's line finders to search for and find a free selector.

I hope this explanation has clarified things a bit (read it a couple of times, I had to do that too ;-)). An image that may help understanding my explanations:
Regards,
Bert Vingerhoets
vingerhoetsbert@hotmail.com
Don't worry what people think about you. They're too busy wondering what you think about them.
 
Actually what i have made a small pbx with only internal lines no external lines involved so its just a intercom at this stage. Now with this exchange DTMF i.e. tone based telephone sets can be connected as i have used MT3271, I have made my own SLIC circuits, iam using At89c52, MT8816 analog switch.

Now microcontroller detects the Off-Hook through its bit. Now if i want to connect the pulse dialing telephone sets also than instead of using any Pulse Dialer IC which can decode the pulse dialing into a digit we can make use of microcontroller .

So in order to make controller count no. of pulses from a Pulse dialing telephone set it is necessary to count the pulses from the bit where the off hook signal is coming.

Now for this iam doing firstly a experiment to see if controller is detecting pulses correctly or not.


Now one thing to note is this that the pulse dialing telephone sets are key-pad type not the rotary type.

I have made a program which can detect signal digit dialing from a pulse dialing telephone set and if the dialed number is correct then controller perform certain tasks like if digit "1" is dialed a relay starts to connect and disconnect after 0.2 seconds interval.

now the program i have made works on the theory :-

1) controller monitor bit P2.0 for a high signal means off hook,

2) as soon as telephone goes off hook, high signal comes at P2.0,

3) Next controller waits for low signal which shows that any digit is pressed, (here we arte not considering that the telephone may go on hook also)

4) Now it is known fact that the low signal which comes due to digit pressed will stay there for more than 5 milli seconds and similary the high signal will not be less then 5 milli seconds which comes after the low signal.

5) say if digit "1" is pressed then firstly a low signal comes and then after some time which we don;t know high signal comes and then remain high , similarly if digit "2" is pressed , low to high to low to high and remains high signal comes.

6) as a complete pulse that is low and high is received a Register is increment and then this register holds the decimal no. representing the digit dialed...

so am i on the right track is there any other way any one can suggest to detect pulse dialing.


ORG 00H
LJMP MAIN

ORG 030H
MAIN:
MOV P0,#00000000D ;RING RELAY RESET
MOV P2,#00000000D ;off hook port set to receive high signal
MOV R3,#00D ;PULSE COUNTER
JNB P2.0,$ ;WAITING FOR OFF-HOOK
JB P2.0,$ ;WAIT FOR DIALING

LOW_TIME:
CALL DELAY_4MILLI
JB P2.0,HIGH_TIME ;GOTO HIGHPULSE WIDTH CALCULATION
INC R1 ;R1 IS THE LOW PULSE WIDTH COUNTER
MOV A,R1
CJNE A,#20D,LOW_TIME
LJMP ENGAGE

HIGH_TIME:
CALL DELAY_4MILLI
JNB P2.0,PULSE_COUNTER ;GO TO HIGH PULSES CALCULATION
INC R2 ;R2 IS THE HIGH PULSE WIDTH COUNTER
MOV A,R2
CJNE A,#20D,HIGH_TIME

PULSE_COUNTER:
INC R3 ;PULSE COUNTER REGISTAR
MOV R1,#00D ;RESETING LOW PULSE WIDTH COUNTER
MOV R2,#00D ;RESETING HIGH PULSE WIDTH COUNTER
JNB P2.0,LOW_TIME
COMPARE:
MOV A,R3
CJNE A,#01D,DIGIT_2
AGAIN: SETB P0.1
CALL DELAY2 ;0.2 SECOND RELAY ON AND OFF ROUNTINE
CLR P0.1
CALL DELAY2
JMP AGAIN

DIGIT_2:
CJNE A,#02D,DIGIT_3
AGAIN1: SETB P0.2
CALL DELAY2
CLR P0.2
CALL DELAY2
JMP AGAIN1

DIGIT_3:
CJNE A,#03D,DIGIT_4
AGAIN2:
SETB P0.3
CALL DELAY2
CLR P0.3
CALL DELAY2
JMP AGAIN2

DIGIT_4:
CJNE A,#04D,DIGIT_5
AGAIN3:
SETB P0.4
CALL DELAY2
CLR P0.4
CALL DELAY2
JMP AGAIN3


DIGIT_5:
CJNE A,#05D,DIGIT_6



DIGIT_6:
CJNE A,#06D,DIGIT_7



DIGIT_7:
CJNE A,#07D,DIGIT_8



DIGIT_8:
CJNE A,#08D,DIGIT_9



DIGIT_9:
CJNE A,#09D,DIGIT_0



DIGIT_0:
CJNE A,#00D,ENGAGE




ENGAGE:
JB P2.0,LOW_TIME ;in correct digit dialed
LJMP MAIN


DELAY2:
MOV R4,#04D
K1: MOV R5,#10D
K2: MOV R6,#50D
DJNZ R6,$
DJNZ R5,K2
DJNZ R4,K1
RET

DELAY_4MILLI:
MOV R4,#04D
L1: MOV R5,#10D
L2: MOV R6,#100D
DJNZ R6,$
DJNZ R5,L2
DJNZ R4,L1
RET
END
 
I would not perform a delay between receiving Hi/Lo or Lo/Hi signals, but count the milliseconds between them. If the number of milliseconds are within a predefined boundary, one can say the signals belong together, once they exceeded the defined period, you can assume that they belong to different digits. The best value for this boundary should be determined experimentally.

Regards,
Bert Vingerhoets
vingerhoetsbert@hotmail.com
Don't worry what people think about you. They're too busy wondering what you think about them.
 
thanks for the helpful thoughts but i have tried many things many approached but none worked properly.

I know using Delay is not the right way but firstly i have to make sure how to the software decode pulse dialing .


As per specifications most of the pulse dialing has:-

High Time = 60 milli seconds

Low Time = 40 Milli seconds.

now using this i have made the program but it was only able to detect digit "1".

I have tried using the digital scope for many telephone sets to get some exact value , the scope also showed some what 100milli seconds for most of the telephone sets.

But i cannot believe one thing that iam searching the Internet for last 2 months ,putting this question of decoding pulse dialing on several forum but no one has able to give any answer and people say that internet has every thing not even a clue is avaiable.

But i hope to get some hints or sample code or some kind of specifications which can enable me to make controller detect pulse dialing.

I mean there has to be some specifications or specific method which may be iam not able to find.

But one thing is for sure this pulse dialing is done before its not a new thing that iam trying.

 
Take a look at the following Pascal-like pseudocode. I think it should work. P represents the input where 0 means low and 1 means hi. The receive_number routine must be called when a connection is established (i.e. when the caller's telephone goes off hook).

Code:
 minhitime = 55
 maxhitime = 65
 minlotime = 35
 maxlotime = 45
 max = 9                        ;number of digits to receive
 digits : array[1..max] of byte ;place in which to store the dialed number

FUNCTION read_digit : byte
 bcounter : byte
 time : word
begin
  bcounter:=0
  while P = 1 do nothing        ; ignore hi time due to:
                                ;  - user waiting before dialing first digit
                                ;  - user waiting between dialing digits
  repeat                        ; loop forever
    time := 0
    while P = 0 do              ; count miliseconds elapsing while P low
     begin
       wait 1 millisecond
       inc(time)
     end
    if time >= minlotime
     then if time > maxlotime
           then halt('connection interrupted')
                                ; P stays low: user has hung up
           else inc(bcounter)   ; first pulse read
     else halt('bad connection')
                                ; low time was too short, recalibrate pulse delays

    time := 0
    while P = 1 do              ; count milliseconds elapsing while P hi
     begin
       wait 1 millisecond
       inc(time);
       if time > maxhitime then ; time between pulses has exceeded maximum:
                                ; previous and next pulse don't belong together
        return bcounter
     end
    if time < minhitime         ; hi time was too short, recalibrate pulse delays
     then halt('bad connection')
  until false
end

PROCEDURE receive_number
 dcounter : 0..max
 digit : byte
begin
  dcounter := 0
  repeat                        ; loop until we have the desired number of digits
    inc(dcounter)               ; will receive next digit
    digit := read_digit         ; read the digit
    case digit of
      1..9 : digits[dcounter] := digit
      10   : digits[dcounter] := 0
                                ; 10 pulses indicates 0
      else halt('too many pulses per digit')
    end
  until dcounter = max
end

Regards,
Bert Vingerhoets
vingerhoetsbert@hotmail.com
Don't worry what people think about you. They're too busy wondering what you think about them.
 
thanks a lot for so much time on my question.. like you are first one in last 6 months who have tried to answer this question...

but one problem is that i don't understand the language you have written in coding :( that's my bad luck i guess

but still you can tell me the theory which i can use to implement on my assembly coding...
 
I used pseudocode, not an existing language, normally it should be rather easy to convert it to any existing structured language such as assembly. Since I don't understand the assembly language you are using, I can't translate it for you; but I'll explain a few things:

Code:
Minhitime
,
Code:
maxhitime
,
Code:
minlotime
and
Code:
maxlotime
are constants denoting the valid hi- and low time intervals.
Code:
Max
is a constant denoting the number of digits a telephone number consists of. The number 02 555 46 03 would require
Code:
max = 9
.
Code:
Digits
is an array (or vector) of bytes (i.e. a succession of byte-sized values) in which each member can be accessed by calculating a memory offset, relative to the start location of the first element in the array.
Code:
Read_digit
is a function that returns a byte-sized value, denoting the number of pulses that are counted in a certain group. The function works as follows:
Code:
________    ___    ___    _______
        |__|   |__|   |__|       
   a    bc d e f
a) initial hi time is ignored (
Code:
while P = 1 do nothing
)
b) hi switches to lo, the ingnoring loop ends and the reading loop starts.
c) The first part of the reading loop counts the number of milliseconds that pass during lo.
d) lo switches to hi, 3 conditions are checked: was the interval shorter than the minimum required lo time interval, either the minlotime constant has a wrong value, or there must be a corrupt connection; in this case, the routine should end and the connection be closed. The second condition is that the lo time exceeds the maximum lo time; in this case you can assume that the line remains lo thus indicating that the user must have hung up. The last case is the one where the measured time lies within the preset interval, so one correct pulse has been received; the pulse counter is then increased with 1.
e) The second part of the reading loop counts the number of milliseconds that pass during hi. Again, there are three conditions: time elapsed is too short, in bound or too long. In the latter case, we cannot wait until the signal becomes lo again, because that would mean that the dialing of the next digit has started, so we exit the function, returning the number of pulses that we counted. If the elapsed time was too short, the connection may be bad or the user may have hung up; in both cases the routine ends and the connection should be closed. In the third case (elapsed time lies in bounds) nothing special has to happen and the reading loop should continue.
f) Restart the whole procedure from c, with the difference that the pulse counter has now been increased by 1.

The
Code:
receive_number
routine reads as many digits as are specified in the max constant. The loop starts and the first digit is read. If the read digit has one of the values in the interval 1..9, this digit is stored in the array; if the digit is 10 (i.e. there are 10 pulses received), a 0 is stored; if any other value is received, it must be invalid since telephone numbers consist of digits in the interval 0..9 and an error is generated (the connection should also be closed).

This is how I would receive pulse dialed numbers.
If you still have questions, be specific to which part they are related. Also, are you familiar with other programming languages? Is this a kind of school assignment? Exactly how familiar are you with the assembly language you're using?

Regards,
Bert Vingerhoets
vingerhoetsbert@hotmail.com
Don't worry what people think about you. They're too busy wondering what you think about them.
 
thanks for such help.
i will be implementing it on software , lets pray it works for detecting pulse dialing. hope to get future help .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top