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

Controller as Pulse Counter

Sir,
I have used all my small brain cells but unable to find any way..please provide some hint if not the code or some logic to peform the following:


1) I have a 8051 Controller , A pulse Dialing Telephone Set, a off-hook indicator Circuit using optical coupler 4N25 and a LED. using 12 Mhz crsytal.


2) I need to use 8051 as a pulse counter,

3) From the Off-hook indicator the wire which gives logical High Signal when ever the telephone set goes off-hook is connected at P1.0.

4) At Pin 2.0 a LED is connected.

5) Controller should keep on monitoring Pin1.0

ORG 00H
MONITORING:
JNB,P1.0,$

6) When ever the telephone set goes off-hook a logical high signal will come at Pin1.0 , the controller turn on the LED and come back to P1.0 Port Monitoring.


SETB P2.0
JMP MONITORING


7) Now the problem starts.... now when when the telephone dial digit "1" , pulses will come at Pin1.0, now the controller should move to next instruction which can count pulses and display the LED with the corresponding pulses ..


e.g. if "1" is pressed LED should turn off and turn on again,
if "2" is pressed LED should turn off and On two times...

A pulse dialing telephone set sents 10 Pulses Per Second when a "0" is pressed, it means if the user press "1" then LED should Blink 10 Times in a second...

Swear i have tried but i don't even able to develop a logic...

May i have to input delay for each digit and when ever a Pulse comes the controller should compare those pulse with the delay and then if they matches perform the function..

CJNE commands..

Or the Controller should be able to count the pulses and then generate same amount of pulses out.

I need some example code at least for one digit pulse e.g. how the controller will count or compare for digit "0".

Thankyou.

Parents Reply Children
No data