> > Hi, there is a friend that needs a special circuit to attach > to a PIC, but I can't find a single chip solution for him. > > He needs a 2^8 bits counter, 8 stages, easy solution, > but it needs to have a serial output, not parallel, so > he could read the actual counter 8 bits using a 2 wire > serial transfer. > > He can not use a microcontroller to count it because the > signal high frequency involved, around 15MHz. This is where I get confused. Just because PICs do not run in the 15 Mhz range doesn't mean that the hardware counters can't. IIRC I read a thread here a couple of weeks ago stating that the hardware counters could accept signals in the 50 Mhz range with no problems. > > In real this chip could be so dump and silly, with just > 8 jk flipflops, a 8 bits shift register, and a couple > of gates, it could be built with only 6 pins: > Ground, Vcc, Pulses In, Reset, SDA + SCLK (2 wire comm). > A 7th pin could control counting in BCD or Binary, and > just to be snob, the 8th pin would be a bold "NC", or > then, used to signal zero count (carry bit). > > A solution like that could use 8, 12, 16, 24 flipflops, > so a high speed counting could be easily read by a PIC > simply issuing RESET up/down, wait time for counting, > reset up to hold count and enable serial transfer, > and them issuing SCLKs to receive SDA data bits, then > reset down to clear counter and repeat again. Again I'm confused. Presuming the signal is in the 15 Mhz range (67 ns period) and a PIC is running with a 5Mhz instruction clock (200 ns period), then even if such a chip existed, the finest resolution that the PIC could control the counter is at 3 count intervals, which is the number of ticks the counter would clock inbetween instructions. Right? Is the exact count necessary? Then you need something quite more complex that could be programmed with the amount of time to gate the incoming pulses along because the PIC isn't fast enough. If an exact count isn't necessary, then you simply prescale the count and let the PIC count it. But in any case the PIC's prescaler and count hardware is fast enough to handle the signal.... BAJ