• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

counting pulses, comparing numbering digits

waqar

New Member
Hi all,
My question is about 8051 and asm programing although i know that this forum is for PIC programming...just want to get an idea how to perform this task...

1) how i can make the controller count the pulses and then compare it with a digit .

2) like if it receives 10 pulses per second it should count the pulses , then compare it with different digits from 1,2,3,4,5,6,7,8,9,0 and 10 pulses are equal to 0 so it compare it with all digits and perform it with 0.

how i can do this...
 

kinjalgp

Active Member
You can configer Timer0 in counter mode with external clock given from T0 pin. In the software you can access this count from TH0 and TL0 registers. Compare this registers with your digit using CJNE or XRL instructions. Like for example
Code:
; A contains low byte and B contains high byte
CJNE A, TL0, NOT_EQ
MOV A, B
CJNE A, TH0, NOT_EQ
SJMP EQUAL
NOT_EQ:
  your code

EQUAL:
  your code
The above code is for 16-bit comparison but if you want you can do it for 8-bits by just comparing your number TL0 register.
 

waqar

New Member
there is some problem with using timer i counting pulses

Thankyou for providing a help reply..but please bear with me on this:-


My objectve is to create communication between two normal pulse dialing telephone sets...

For this :-

1) Two Telephone No.10 and No.20 Set Pulse Dialing,
2) Controller AT89c52, using asm programming,
3) Simple SLIC circuit for sending off-hook and pulse dialing signals to controller.

Let say Telephone No.10 pick up his handset,

1) Signal goes to controller and controller sents a Dial Tone in this set for 20 seconds now for generating dial tone i have produce a square wave f 400 Hz using interrupts...


2) Now the user of telephone set no.10 press digit 20 , the controller counts these pulses and compare it with the digit already stored in any register say R1 and if the pulses are equal to that digit then controller do following two things:-
1) Sent a Ring Back tone to the telephone No.10 using 400 Hz frequency at the rate , 0.5 second On and ).5 Seconds Off,
2) Secondly at the same time sents signal to the power supply to sent 60 volts Ac signal to the telephone set no.20.

But if the user dial incorrect digit then controller sents 400 Hz wave at 0.2 second on and 0.2 off rate..

I need halp on programming side,,how to genarte these delays of tone and how to make controller count pulses and do the desired job...


COntroller will give on monitoring the two ports if any of the telephone set goes off hook.


Two Numbers are stored in the memory:-
20 and 10 the controller compare the pulses with these digits...

Now these pulse dialing works as:-

10 Pulses per second if digit 0 is pressed

with 60 microsecond ON and 40 micrcosecond Of ratio of mark and break,

And the inter digit time interval is 800milli second.

please guide me the programming stuff
 

Latest threads

EE World Online Articles

Loading

 
Top