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.
sir continuning from my previous email... i can use 8-bit or 16 bit timer for pulse counting but the problem is of if i have to connect more than 2 or 3 inputs and have to treat all in the same way... Pulse counting using timer 0. using 16 bit timer mode and Timer 0 1) Now i will connect the logical high input wire at P3.4 2) Now when the telephone set will go off-hook TLO will increment, 3) next instruction will clear the TF0 , 4) Now lets suppose that if "0" is pressed then TLO will count upto 9 starting from 0. 5) After the pulse are counted by the timer the value will be moved in Accumular and from a Lookup table comparing the value and the sending that amount of pulses to the LED. 6) I can sent the pulses directly to the LED once counted by the timer but i need to write the program in such a way that the program stores the numeric value of the digit pressed... will this work....but in case if attach 4 or five inputs how i can use the timer in that case...
Maybe you should drop this course and try rocket science instead?