Counter chips

I’ve seen numerous references here and other places to some chips that count pulses and output their count (serially, I hope). I’d love to have one of these, but I can’t find them. I’ve hunted all through the digikey catalog, and I found counters, but they’re just panel display things. I need an IC that counts on/off toggles and will give my PIC chip the current total. Can anyone supply a digikey part number(s)?

You should be able to program the PIC chip to count the pulses by using an interupt. The PICs are fast enough to detect the pulse rates that you should require on the robot.

What is your max frequency that you are trying to detect? I may be able to send you example code

Tim Tedrow

here’s the simplest idea in the world:

555 timer chip.

There are examples all over the net on how to wire one up, just hook it up to an input pin and you’re set. the main advantage to this is:

a) very simple
b) all the counting can be controlled using software

Ok… well, I think you’re saying what I’ve already thought of and discarded, but perhaps not. I program my pic chips using PicBasic. There are two foreseeable problems with interrupts: 1) I don’t know how to create them, and once created, I’d have to dust off my ASM skills in order to use them; 2) if there was an interrupt while the PIC was in the process of executing a SEROUT, it would likely screw up the serial stream, wouldn’t it? Then I get a crashed RC.

As for a 555 timer, in my original post, I’d been intending on using that as the source of the pulses. I’ve used them before. I just need a dedicated pulse counter with serial output. If parallel is the only option, I suppose I could be persuaded to dedicate a PIC to translating the parallel to serial :stuck_out_tongue:

Ohhhh… you already thought of that… lol. yeah,im great at interpreting this stuff… :smiley:

What we did was hook the 555 into one of the digital inputs and just stuck this into the main program loop…

timer_in VAR rc_sw1
timer VAR byte
last_time VAR misc_varible.bit0

if timer_in <> last_time then
timer = timer + 1
last_time = timer_in

Hmm… im sure you can do that in a PIC too somehow…

Hmm… I hadn’t considered that solution. I’ve been trying to jump through hoops so I can read frequincies in kHz or MHz, when I could make it 10s of Hz… Horrible precision, but perhaps good enough. Any thoughts on a higher-precision counter chip? Some teams have talked of using them to count wheel revolutions, which would be too fast for the stamp.

how do you plan on using the serial output of the chip? to input into one of the digital inputs on the rc? I suggest using two / 16 counters (74191) cascaded to give you 255 combinations input those into a seperate stamp then use resistors to weight the outputs of that stamp 1-2-4-5-16-32-64-128 and input that to an analog input. Toggle a relay (make sure you regulate it (7805)) so you can reset the counter (load all 0’s). Use the stamp to create a pulse for a reset. The seperate stamp needs to output the total counts since the last reset because there will be a difference in time between the rc input and the toggle on the relay (your reset pulse). It’s possible to do this in a similar fashion using serial inputs but I think it would be far too slow based on the rc timing.

dude… people are reading my mind! im so scared… :yikes:

yeah, thats kinda what we were planning for our wheel revolution counters… , but using a D-A chip instead… and I haven’t had time to play with it yet so it probably wont end up on the robot this year… oh well. Probably we’ll just end up using our wheel revolution thingies to see if the robot is moving or not…

You can track wheel rotation directly with an optical sensor, as long as your speed does not overrun the roughly 40 HZ poll rate of the PBASIC stamp. We have done this, putting reflective tape on the shaft that drives a chain to the wheels, making it half reflective and half black, and tracking the on/off and off/on transitions. You can track moderate speeds with no counters at all, counting into a variable in the program.

Wanting to track with high precision at high speed, we are trying 4 bit counters using the “7394” chip, a 4 bit binary counter. A viable digikey part is the low power shottky version, SN73LS94N on page 348 of the pdf catalog. The part is easy to use, and you could quickly put it together with a “solder breadboard.” Students on our team did artwork for a PC card, and exposed and etched printed circuit boards for the counter. Your program, in this case, must invert the bits, and detect and handle overflow. You should be able to measure inches, or less, at full speed, using this part.

ok theres 3 simple soulutions i just wanted to throw out; ill crack open the bible (digikey cataloge) tomorow but just consider this:

  1. use a freq --> volt converter, either a RC circut or a chip. If your using the 16f/c84a then youll need an external AD.

  2. get a divider (basicly a bunch of flipflops) that goes by, say /100, and then take it from there. that might make it more managable.

  3. err and if im not mistaken, picbasic has the COUNT command, and if you have it counting for a specified amount of time then you can figure it out… if you have 2 drive motors, you do one and then the other, output and repeat. the count command, if you are running a 16f84a at 4mhz (NEED CRYSTAL FOR ACCURACY), should let you go up to about 500,000 hz. theres no motor first gives us that goes anywhere near that speed…

feel free to email me, and if i remember (hey ive got a robot to build) ill look up parts and play with code for ya. -jacob