Previous in Forum: Automations (remote -home automation)   Next in Forum: On Linear Scales
Close
Close
Close
12 comments
Rating: Comments: Nested
Anonymous Poster

Counter/Timer basics

10/10/2006 3:47 AM

Hey everyone -

I need help. I am trying to set up a system to electronically record a race. I have a photoelectric sensor at the start and finish, and when the beam projected by the sensor is broken, the sensor sends a 5v pulse. I'm looking at this piece of equipment:

http://www.accesio.com/go.cgi?p=../usb/usb-ctr-15.html


My question is this: how does the wiring work? When my sensors send a signal, how does the counter know when to start and stop? I assume I can read the results through the computer, but where should the sensor signal be wired to in order to get results?

Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.
Guru
Engineering Fields - Electrical Engineering - New Member

Join Date: Sep 2006
Location: El Lago, Texas, USA
Posts: 2639
Good Answers: 65
#1

Re: Counter/Timer basics

10/10/2006 2:03 PM

Your link is bad so it's kind of hard to know what equipment you're talking about.

Reply
Anonymous Poster
#2

Re: Counter/Timer basics

10/11/2006 1:15 AM
Reply
Power-User

Join Date: Aug 2006
Location: Adirondacks of NYS
Posts: 136
Good Answers: 7
#3

Re: Counter/Timer basics

10/11/2006 3:58 AM

I might look at a small PLC and text display for an operator interface. Check Automation Direct. You didn't say if you needed portablity or battery powered but a PLC could do both. Need a Printout too?

__________________
If I hear hoofbeats, why don't I ever think a Zebra might be around?
Reply
Guru
Australia - Member - New Member Fans of Old Computers - H316 - New Member Hobbies - Model Rocketry - New Member

Join Date: Jun 2006
Location: Port Noarlunga, South Australia, AUSTRALIA (South of Adelaide)
Posts: 3048
Good Answers: 75
#4

Re: Counter/Timer basics

10/11/2006 8:04 AM

From the quick read of the manual that I did you are going to need to build some interfacing circuitry.

Basically the box you have specified has a stack of 10 bit counters and a clock that supplies pulses at 10MHz. The idea is that you use the counters to count the clock pulses and hence give you a time. Firstly you need to connect the internal clock to the Clock Input of the first Timer. Secondly you need to build a piece of circuitry so that when the first beam is broken it gives a high to the Timer Gate input. This need to stay high till the second beam is broken at which time it needs to go low. This is fairly easy to do as all you need is a flip flop with the first sensor connected to the set input of the flip flop and the second to the reset input.

There is however something else to consider and that is what sort of interval you wish to time. The counters in this unit are 10 bit counters which means that they can only count to 1024 and this means that with the internal clock they will over run in about 100 μs. What you need is to cascade the clocks together by connecting the output of the first timer to the Clock Input of the second and so on. With two counters you can time up to 100 ms with 3 about 107 seconds and 4 about 30 hours.

Unfortunately its not a case of just connecting it but you only need 1 extra component to make it work.

I hope that helps.

__________________
An elephant is a mouse built to government specifications.
Reply
Anonymous Poster
#5

Re: Counter/Timer basics

10/11/2006 10:20 AM

If you are using a computer to record the data why not use software to track the timing. Instead of a piece of equipment write a short program will that activate with the high input i.e. key stroke or input on a port and then go low. Yes a flip-flop will control the state but the computer will track the timing, plus any additional data as to indentification etc. can be added to the array.

Reply
Anonymous Poster
#6

Re: Counter/Timer basics

10/12/2006 12:02 AM

OK, to be more specific -

I need to time accurately to .001 seconds. There is a system already in place, and I am looking to replace the system. I will be using software to read from the counter/timer after if establishes a time.

I assume I can set the clock interval to work with bigger intervals than 10mhz, no?

The engineer (a real old timer using 30 year old equipment for the original system) doesn't want to use to the internal clock of the computer because he is concerned about the reliability.

Reply
Anonymous Poster
#7

Re: Counter/Timer basics

10/12/2006 12:13 AM

Just another point - the counters are 16 bit, not 10 bit.

Reply
Guru
Australia - Member - New Member Fans of Old Computers - H316 - New Member Hobbies - Model Rocketry - New Member

Join Date: Jun 2006
Location: Port Noarlunga, South Australia, AUSTRALIA (South of Adelaide)
Posts: 3048
Good Answers: 75
#8
In reply to #7

Re: Counter/Timer basics

10/12/2006 5:27 AM

Sorry about that. I don't know where I got the 10 bits from. The 16 bit counters will allow you to measure times up to about 6.5 ms so you will still need to cascade the counters. Two counters will give you about 430 seconds or 7 minutes.

If you don't need the accuracy of a 10 MHz clock you could always put in a divider and slow this down but that would mean adding more circuitry.

__________________
An elephant is a mouse built to government specifications.
Reply
Guru
India - Member - Sensors Technology Popular Science - Cosmology - Dream, Think and Act United Kingdom - Member - New Member United States - Member - New Member Canada - Member - New Member

Join Date: Aug 2006
Location: AM-51, Deen Dayal Nagar, Gwalior, Madhya Pradesh, MP 474001, India
Posts: 3418
Good Answers: 32
#9

Re: Counter/Timer basics

10/14/2006 12:25 AM

I have a pulse rate / frequency counter board that can count slow signals 0-10kHz (30kHz may be possible in new version) frequency for TTL inputs and can transmit data to PC serially which you can see on screen and can also read in C++ or VB programs. It is single channel device.

This counts frequency automatically for each second and transmits data, hence you need not worry too much on how it starts or stops. I can also give some demo programs to capture data. It operates from small 9V battery and has standard RS232 serial output.

If you need this then perhaps I can send it to you by FedEx. Give me your address and are you willing to pay for the cost US$150?

__________________
Prof. (Dr.) Shyam, Managing Director for Sensors Technology Private Limited. Gwalior, MP474001, India.
Reply
Anonymous Poster
#10

Re: Counter/Timer basics

10/31/2006 1:46 AM

Update:

Just to recap, I am using two photoelectric sensors for the start and finish of a race. I need to send a steady high to the gate input of the counter when I receive a high from the start sensor, and drop to a steady low when I receive a high from the finish sensor.

ACCESIO makes this product as well:

http://www.accesio.com/go.cgi?p=../usb/usb-dio-32.html

In addition to 3 counter chips (for a total of 9 counters), this product has 32 lines of digital i/o, will this handle my logic needs? Can I set up the logic through software?

Is there a better name for the flip-flop type logic I would need?

Can I cascade the first 10mhz counter to all 8 other counters, giving the others the ability to count to 7 min?

Thanks for everyone's help.

Chris

Reply
Guru
Australia - Member - New Member Fans of Old Computers - H316 - New Member Hobbies - Model Rocketry - New Member

Join Date: Jun 2006
Location: Port Noarlunga, South Australia, AUSTRALIA (South of Adelaide)
Posts: 3048
Good Answers: 75
#12
In reply to #10

Re: Counter/Timer basics

11/04/2006 1:34 AM

Dear Guest

In post #10 you asked

"I need to send a steady high to the gate input of the counter when I receive a high from the start sensor, and drop to a steady low when I receive a high from the finish sensor"

and this is exactly correct. This is called a SET RESET or SR FLIP FLOP.. To find out more about the SR flip flop follow this link.

http://isweb.redwoods.cc.ca.us/INSTRUCT/CalderwoodD/diglogic/srflip.htm

The easiest way to get a SR Flip Flop it to use something like a 74xx00 Quad Dual Input NAND gate chip to construct it and you could construct two flip flops from a single chip. The xx in the number refers to the type of electronics used to construct the chip. Since this unit uses CMOS the best one to use would be a 74C00. This link has a list of all the types of 74 series chips that are available and links to the data sheets

http://rabbit.eng.miami.edu/info/datasheets/

You also asked this about the USB-DIO-32

"In addition to 3 counter chips (for a total of 9 counters), this product has 32 lines of digital i/o, will this handle my logic needs? Can I set up the logic through software?"

From what I read you can use the four 8 bit buffers as either inputs or outputs and they can be either read or written to. I as I understand you can drive this via software on the PC and get them to do anything you wish like drive a display to show how long it took for the race.

You went on further and asked

"Is there a better name for the flip-flop type logic I would need?"

Flip flop is actually the technical name for this circuit and there are t several types of flip flops D, SR and JK. You need a SR flip flop and the easiest way to get one is use 2 dual input NAND gates as described earlier.

Finally you asked

"Can I cascade the first 10mhz counter to all 8 other counters, giving the others the ability to count to 7 min?"

The time you can measure depends on the number of bits and the clock frequency and the formula for calculating how long a period you can count is

Time = 2n ÷ f where n is the number of bits and f is the frequency of the clock

So if you use a single 16 bit counter on it own you could measure

216 ÷ 10,000,000 ≈ 6.5ms

If you used 3 counters cascaded together as they are in the USB-DIO-32 then the length of time you could measure would be

2(3 x 16 ) ÷ 10MHz = 248 ÷ 10Mhz = 28,147498 ≈ 11 months.

If you cascaded all 9 counters you could measure times up to

2(9 x 16) ÷10Mhz = 2144 ÷ 10MHz ≈ 2.2 x 1036 Seconds ≈ 7 x 1019 years

Which is a bit silly because it something like 4 billion billion times as old as the universe

As to what Vulcan said in post #11 he is absolutely correct they are down counters. They count backwards from a preset value till the reach zero and then stop counting. This is not a great problem since the outputs of the counters is going to be interpreted by software on the PC. What you need to do is to get each counter to start from 216 -1 or 65,535. Then when the timer has finished timing the race you use this formula to calculate the number of pulses counted.

Pulses = 65,235 – Counter Value

Put simply you just subtract the value in each counter from the starting value to get the number of pulses counted. You then divide this by the clock frequency and that gives you the time it took for the race.

In conclusion both devices with some simple extra circuitry can do what you want but personally I would use the USB-DIO-32 with the optional two extra 82C54 counters. This would allow you to time three thing simultaneously for up to almost a year and you could then use the four 8 bit registers to drive a large display with the results.

I hope this has helped and have fun with the racing.

__________________
An elephant is a mouse built to government specifications.
Reply
Guru
Philippines - Member - New Member Engineering Fields - Instrumentation Engineering - New Member Engineering Fields - Control Engineering - Who am I?

Join Date: Oct 2006
Location: Northern Mindanao, Philippines
Posts: 2147
Good Answers: 53
#11

Re: Counter/Timer basics

11/03/2006 8:59 PM

First off, I read the manual (thought I could use it also) and discovered that it provides you with 15 DOWN counters. If you're going to use it to time a race, I'd expect you'd rather use UP counters instead.

There are two ways to go about this. You could buy an off-the-shelf race timer (I believe there may be a few out there) or you could build your own. If you want to record the time in a computer, building your own means it's going to be a bit more complex but still possible.

If you go with the simple (no computer) way, you probably need about 5 decade-type up counters. If you time down to 0.001, 5 counters will give you 99,999 maximum counts for a maximum time of 99.999 seconds. If you need longer times, just add more counters.

__________________
Miscommunication: when what people heard you say differs from what you said. Make yourself understood.
Reply
Reply to Forum Thread 12 comments
Copy to Clipboard

Users who posted comments:

Anonymous Poster (5); bhankiii (1); masu (3); Shyam (1); Sparkchaser (1); Vulcan (1)

Previous in Forum: Automations (remote -home automation)   Next in Forum: On Linear Scales
You might be interested in: Counter and Timer Boards, USB Connectors, USB Products

Advertisement