32-bit counter
Volker-
Maybe Al Williams has a chip to handle this. Or you may be
interested in something I created which I call a "Pulse Machine"
(PM-1). I could run one off for you if you'd like. Here's a
summary of the (mutually exclusive) tasks it can perform:
"1. The PM-1 incorporates several pulse-related functions which may
be used to advantage with a Parallax BASIC Stamp II or other host
processor. A simple LCD interface is also provided. The PM-1
communicates with the Stamp via a single Stamp pin using half-duplex,
asynchronous 38400 baud serial transmissions. This allow the use of
simple SERIN and SEROUT commands to accomplish pulse and LCD
functions. The PM-1 is implemented in a Scenix SX18 microprocessor
and requires a 40 MHz clock source. The resolution of time-related
pulse functions is one microsecond (µsec). The timing accuracy is
determined by the clock source.
2. The following pulse generation and analysis functions are provided:
- 16-bit Pulse counter: Counts pulses occurring at up to 1 MHz rate.
High pulses appearing at the edge_1 input or low pulses appearing at
the edge_2 input are counted until receipt of any further Stamp
command. The pulse counter rolls over after 4,294,967,295 pulses. In
addition, the time elapsed while counting pulses is maintained to 1
µsec. The number of pulses and duration of pulse counting are
available for readback to the Stamp. As with all other functions, a
new command from the Stamp terminates the pulse and the new command
is executed.
- Interval pulse counter: For a designated interval (1 through
4,294,967,295 µsec), count the number of high pulses appearing at the
edge_1 input or low pulses appearing at the edge_2 input. When the
designated interval expires, the PM-1 pulls the serial line low for 50
msec to signal the Stamp. The time elapsed while counting pulses is
maintained to 1 µsec. The number of pulses and time duration are
available for readback to the Stamp.
- Report counters: The contents of the pulse and time counters are
sent to the Stamp.
- Pulse latch: The PM-1's pulse_out output is toggled upon a high
pulse occurring at the edge_1 input or low pulse occurring at the
edge_2 input. The pulse_out output remains at this level until reset
by the Stamp.
- Set pulse_out low/high: This function simply sets the pulse_out
output to the designated logic level. Its primary purpose is to
determine an initial pulse_out logic state for subsequent pulse
functions.
- One-shot: The PM-1's pulse_out output is switched to the opposite
logic level for a period of from 1 through 4,294,967,295 µsec. The
pulse begins upon receipt of the command from the Stamp.
- Edge-triggered one-shot: The one-shot pulse function occurs upon a
rising edge on the PM-1's edge_1 input, or a falling edge on the
edge_2 input.
- Pulse-triggered one-shot: The one-shot pulse function occurs upon a
high pulse on the edge_1 input or a low pulse on the edge_2 input.
- Clock generator (gated): A clock signal is generated on the
pulse_out output. The period and duty cycle are determined by
Stamp-specified values defining the high and low intervals of the
clock pulse train. Each interval may be from 1 through 4,294,967,295
µsec. The clock output is asserted only while the PM-1's active-low
gate* input is held low. Tie the gate* input low or apply the desired
logic level via software control.
- 38 KHz pulse source (gated): A 38 KHz pulse train appears at the
pulse_out output when the gate* input is low.
- 40 KHz pulse source (gated): A 40 KHz pulse train appears at the
pulse_out output when the gate* input is low.
- Pulse width modulation: A clock signal with duty cycle from 0%
through 100% is generated at the pulse_out output pin. Duty cycle is
specified as a value from 0 through 255.
- Servo pulse (gated): A clock is generated on the pulse_out output
with cycle period = 19.968 msec when the gate* input is low. The high
portion of the clock may be 1 through 2.02 msec, and is specified as a
value from 0 through 255.
- Clock divider: A clock signal appearing at the pulse_in input is
divided by 1 through 65,536 and appears at the pulse_out output pin.
The output clock signal has a 50% duty cycle regardless of the duty
cycle characteristic of the input clock."
I could modify the code to provide a rollover output and/or a
divide-by-2 output, but would have to give up LCD or other functions
to free up pins. Let me know if you'd like further details of
operation.
Regards,
Steve
Maybe Al Williams has a chip to handle this. Or you may be
interested in something I created which I call a "Pulse Machine"
(PM-1). I could run one off for you if you'd like. Here's a
summary of the (mutually exclusive) tasks it can perform:
"1. The PM-1 incorporates several pulse-related functions which may
be used to advantage with a Parallax BASIC Stamp II or other host
processor. A simple LCD interface is also provided. The PM-1
communicates with the Stamp via a single Stamp pin using half-duplex,
asynchronous 38400 baud serial transmissions. This allow the use of
simple SERIN and SEROUT commands to accomplish pulse and LCD
functions. The PM-1 is implemented in a Scenix SX18 microprocessor
and requires a 40 MHz clock source. The resolution of time-related
pulse functions is one microsecond (µsec). The timing accuracy is
determined by the clock source.
2. The following pulse generation and analysis functions are provided:
- 16-bit Pulse counter: Counts pulses occurring at up to 1 MHz rate.
High pulses appearing at the edge_1 input or low pulses appearing at
the edge_2 input are counted until receipt of any further Stamp
command. The pulse counter rolls over after 4,294,967,295 pulses. In
addition, the time elapsed while counting pulses is maintained to 1
µsec. The number of pulses and duration of pulse counting are
available for readback to the Stamp. As with all other functions, a
new command from the Stamp terminates the pulse and the new command
is executed.
- Interval pulse counter: For a designated interval (1 through
4,294,967,295 µsec), count the number of high pulses appearing at the
edge_1 input or low pulses appearing at the edge_2 input. When the
designated interval expires, the PM-1 pulls the serial line low for 50
msec to signal the Stamp. The time elapsed while counting pulses is
maintained to 1 µsec. The number of pulses and time duration are
available for readback to the Stamp.
- Report counters: The contents of the pulse and time counters are
sent to the Stamp.
- Pulse latch: The PM-1's pulse_out output is toggled upon a high
pulse occurring at the edge_1 input or low pulse occurring at the
edge_2 input. The pulse_out output remains at this level until reset
by the Stamp.
- Set pulse_out low/high: This function simply sets the pulse_out
output to the designated logic level. Its primary purpose is to
determine an initial pulse_out logic state for subsequent pulse
functions.
- One-shot: The PM-1's pulse_out output is switched to the opposite
logic level for a period of from 1 through 4,294,967,295 µsec. The
pulse begins upon receipt of the command from the Stamp.
- Edge-triggered one-shot: The one-shot pulse function occurs upon a
rising edge on the PM-1's edge_1 input, or a falling edge on the
edge_2 input.
- Pulse-triggered one-shot: The one-shot pulse function occurs upon a
high pulse on the edge_1 input or a low pulse on the edge_2 input.
- Clock generator (gated): A clock signal is generated on the
pulse_out output. The period and duty cycle are determined by
Stamp-specified values defining the high and low intervals of the
clock pulse train. Each interval may be from 1 through 4,294,967,295
µsec. The clock output is asserted only while the PM-1's active-low
gate* input is held low. Tie the gate* input low or apply the desired
logic level via software control.
- 38 KHz pulse source (gated): A 38 KHz pulse train appears at the
pulse_out output when the gate* input is low.
- 40 KHz pulse source (gated): A 40 KHz pulse train appears at the
pulse_out output when the gate* input is low.
- Pulse width modulation: A clock signal with duty cycle from 0%
through 100% is generated at the pulse_out output pin. Duty cycle is
specified as a value from 0 through 255.
- Servo pulse (gated): A clock is generated on the pulse_out output
with cycle period = 19.968 msec when the gate* input is low. The high
portion of the clock may be 1 through 2.02 msec, and is specified as a
value from 0 through 255.
- Clock divider: A clock signal appearing at the pulse_in input is
divided by 1 through 65,536 and appears at the pulse_out output pin.
The output clock signal has a 50% duty cycle regardless of the duty
cycle characteristic of the input clock."
I could modify the code to provide a rollover output and/or a
divide-by-2 output, but would have to give up LCD or other functions
to free up pins. Let me know if you'd like further details of
operation.
Regards,
Steve
Comments
I need a 32-bit counter connected to a BS2p. Of course, I can't use
all the inputs, so I need to read the count values through serial IO.
As far as I know there is no such IC available (other than one from
Dallas with a max input frequency of 1kHz, I need app. 1MHz).
Does anybody know of a 32-bit counter chip with serial out ?
Or other question, would it be possible to program a PIC to handle
this task ? My requirements are in specific :
- count up to 32 bit with input 5V, max. 1MHz (typ. 200kHz)
- reset count value to ZERO
- serial out of count value to BS2p
(- overflow output would ne nice !)
(- preload of count value not necessary !)
(- input signal/2 as extra output would be nice !)
(- rising or falling edge as counting edge doesn't matter !)
Can anybody help me here or do I have to spend the next week with a
soldering iron in my hand ?
Thanks in advance,
Volker
> ...You mentioned the 16 bit counter, counting up to 4,294,967,295
> pulses, which is 2^32 ! Which is correct ?
My apologies for the confusion. It's a 4-byte wide counter (32-bit),
0 to 4,294,967,295.
> Could you send me more information ?
I put some info on my web page:
http://home.earthlink.net/~parkiss/pm1summ.txt
http://home.earthlink.net/~parkiss/pm1bscod.txt
BTW, I leave in a few days for my semi-annual dose of dehydration,
sunburn, and blisters courtesy of the Grand Canyon backcountry. Pls
excuse any resultant delays in replies to email.
> How much is it ?
A programmed SX18 (18 pin DIP) plus Dale 40 MHz "can" oscillator by
priority mail to US addresses for $20.
Regards,
Steve
thanks for your response.
- Could you give me an Email or anything to contact Al Williams ?
- LCD is not necessary, I have already one connected to the BS2p.
- You mentioned the 16 bit counter, counting up to 4,294,967,295 pulses,
which is 2^32 ! Which is correct ?
If it actually is a 32-bit counter inside then this seems to be fine.
Could you send me more information ? How much is it ?
Thanks,
Volker
>
Original Message
> From: S Parkis [noparse]/noparse]SMTP:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=6OW6FsQkVykX7u6xbnXat2MTpUXWfKOJTTDc8O0zeHrcyahsvQpWZrPFac_PsHm8GklwMHsv-nMCwLXNIclF]parkiss@e...[/url
> Sent: Monday, May 07, 2001 3:57 AM
> To: Elmy; basicstamps@yahoogroups.com
> Subject: Re: [noparse][[/noparse]basicstamps] 32-bit counter
>
> Volker-
>
> Maybe Al Williams has a chip to handle this. Or you may be
> interested in something I created which I call a "Pulse Machine"
> (PM-1). I could run one off for you if you'd like. Here's a
> summary of the (mutually exclusive) tasks it can perform:
>
>
> "1. The PM-1 incorporates several pulse-related functions which may
> be used to advantage with a Parallax BASIC Stamp II or other host
> processor. A simple LCD interface is also provided. The PM-1
> communicates with the Stamp via a single Stamp pin using half-duplex,
> asynchronous 38400 baud serial transmissions. This allow the use of
> simple SERIN and SEROUT commands to accomplish pulse and LCD
> functions. The PM-1 is implemented in a Scenix SX18 microprocessor
> and requires a 40 MHz clock source. The resolution of time-related
> pulse functions is one microsecond (µsec). The timing accuracy is
> determined by the clock source.
>
> 2. The following pulse generation and analysis functions are provided:
>
> - 16-bit Pulse counter: Counts pulses occurring at up to 1 MHz rate.
> High pulses appearing at the edge_1 input or low pulses appearing at
> the edge_2 input are counted until receipt of any further Stamp
> command. The pulse counter rolls over after 4,294,967,295 pulses. In
> addition, the time elapsed while counting pulses is maintained to 1
> µsec. The number of pulses and duration of pulse counting are
> available for readback to the Stamp. As with all other functions, a
> new command from the Stamp terminates the pulse and the new command
> is executed.
>
> - Interval pulse counter: For a designated interval (1 through
> 4,294,967,295 µsec), count the number of high pulses appearing at the
> edge_1 input or low pulses appearing at the edge_2 input. When the
> designated interval expires, the PM-1 pulls the serial line low for 50
> msec to signal the Stamp. The time elapsed while counting pulses is
> maintained to 1 µsec. The number of pulses and time duration are
> available for readback to the Stamp.
>
> - Report counters: The contents of the pulse and time counters are
> sent to the Stamp.
>
> - Pulse latch: The PM-1's pulse_out output is toggled upon a high
> pulse occurring at the edge_1 input or low pulse occurring at the
> edge_2 input. The pulse_out output remains at this level until reset
> by the Stamp.
>
> - Set pulse_out low/high: This function simply sets the pulse_out
> output to the designated logic level. Its primary purpose is to
> determine an initial pulse_out logic state for subsequent pulse
> functions.
>
> - One-shot: The PM-1's pulse_out output is switched to the opposite
> logic level for a period of from 1 through 4,294,967,295 µsec. The
> pulse begins upon receipt of the command from the Stamp.
>
> - Edge-triggered one-shot: The one-shot pulse function occurs upon a
> rising edge on the PM-1's edge_1 input, or a falling edge on the
> edge_2 input.
>
> - Pulse-triggered one-shot: The one-shot pulse function occurs upon a
> high pulse on the edge_1 input or a low pulse on the edge_2 input.
>
> - Clock generator (gated): A clock signal is generated on the
> pulse_out output. The period and duty cycle are determined by
> Stamp-specified values defining the high and low intervals of the
> clock pulse train. Each interval may be from 1 through 4,294,967,295
> µsec. The clock output is asserted only while the PM-1's active-low
> gate* input is held low. Tie the gate* input low or apply the desired
> logic level via software control.
>
> - 38 KHz pulse source (gated): A 38 KHz pulse train appears at the
> pulse_out output when the gate* input is low.
>
> - 40 KHz pulse source (gated): A 40 KHz pulse train appears at the
> pulse_out output when the gate* input is low.
>
> - Pulse width modulation: A clock signal with duty cycle from 0%
> through 100% is generated at the pulse_out output pin. Duty cycle is
> specified as a value from 0 through 255.
>
> - Servo pulse (gated): A clock is generated on the pulse_out output
> with cycle period = 19.968 msec when the gate* input is low. The high
> portion of the clock may be 1 through 2.02 msec, and is specified as a
> value from 0 through 255.
>
> - Clock divider: A clock signal appearing at the pulse_in input is
> divided by 1 through 65,536 and appears at the pulse_out output pin.
> The output clock signal has a 50% duty cycle regardless of the duty
> cycle characteristic of the input clock."
>
>
> I could modify the code to provide a rollover output and/or a
> divide-by-2 output, but would have to give up LCD or other functions
> to free up pins. Let me know if you'd like further details of
> operation.
>
>
> Regards,
>
> Steve
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
I'm here. The PAK-VII acts as 8 16-bit counters. I was trying to think of a
clever way to cascade two of them. I'm fearful it would have to be in
software. Something like this (in make-believe code):
Read LowCounter
if LowCounterOld>LowCounter then update HighCounter
LowCounterOld=LowCounter
You'd have to call this more often than the counter wraps around (65K *
clock).
Also, I think you mentioned 1MHz. The PAK-VII can sample as quickly as 5uS
which is 200kHz (Nyquist limit of 100kHz). Of course, you could use the PAK
with a prescaler, but you'd lose resolution. I'm not sure if Steve's part
can run faster than that. Since you don't need 8 channels, it should be
possible to go faster.
If you need many of these, we could make a PAK-VII that had 4 32-bit
counters instead of 8 16-bit counters, but for just 1 or 2, it would
probably be too expensive to consider. Or even 1 32-bit counter operating at
a much faster rate.
Regards,
Al Williams
AWC
* Connect your Stamp to the Internet?
http://www.al-williams.com/awce/netporter.htm
>
Original Message
> From: Klocke Volker [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=Z7dzBZK22B6cN-i-LXbsJrcPGrR1Gq3AHu3-bbIsptKz-C6iymFIOV69hQkvoPJSbIMg7kFjlduK8CfNdlg4]Volker.Klocke@G...[/url
> Sent: Tuesday, May 08, 2001 12:23 PM
> To: 'basicstamps@yahoogroups.com'
> Subject: RE: [noparse][[/noparse]basicstamps] 32-bit counter
>
>
> Steve,
> thanks for your response.
> - Could you give me an Email or anything to contact Al Williams ?
> - LCD is not necessary, I have already one connected to the BS2p.
> - You mentioned the 16 bit counter, counting up to 4,294,967,295 pulses,
> which is 2^32 ! Which is correct ?
> If it actually is a 32-bit counter inside then this seems to be fine.
> Could you send me more information ? How much is it ?
>
> Thanks,
> Volker
>
> >
Original Message
> > From: S Parkis [noparse]/noparse]SMTP:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=_57RqQVGLq8Afd7CjzBc2-tZvyrO5-vb-s8GmvDbQ-2sYVOcC5Z_dWM_WgM-O2XTtFBKxmQ16H6uGKaw9_U]parkiss@e...[/url
> > Sent: Monday, May 07, 2001 3:57 AM
> > To: Elmy; basicstamps@yahoogroups.com
> > Subject: Re: [noparse][[/noparse]basicstamps] 32-bit counter
> >
> > Volker-
> >
> > Maybe Al Williams has a chip to handle this. Or you may be
> > interested in something I created which I call a "Pulse Machine"
> > (PM-1). I could run one off for you if you'd like. Here's a
> > summary of the (mutually exclusive) tasks it can perform:
> >
> >
> > "1. The PM-1 incorporates several pulse-related functions which may
> > be used to advantage with a Parallax BASIC Stamp II or other host
> > processor. A simple LCD interface is also provided. The PM-1
> > communicates with the Stamp via a single Stamp pin using half-duplex,
> > asynchronous 38400 baud serial transmissions. This allow the use of
> > simple SERIN and SEROUT commands to accomplish pulse and LCD
> > functions. The PM-1 is implemented in a Scenix SX18 microprocessor
> > and requires a 40 MHz clock source. The resolution of time-related
> > pulse functions is one microsecond (µsec). The timing accuracy is
> > determined by the clock source.
> >
> > 2. The following pulse generation and analysis functions are provided:
> >
> > - 16-bit Pulse counter: Counts pulses occurring at up to 1 MHz rate.
> > High pulses appearing at the edge_1 input or low pulses appearing at
> > the edge_2 input are counted until receipt of any further Stamp
> > command. The pulse counter rolls over after 4,294,967,295 pulses. In
> > addition, the time elapsed while counting pulses is maintained to 1
> > µsec. The number of pulses and duration of pulse counting are
> > available for readback to the Stamp. As with all other functions, a
> > new command from the Stamp terminates the pulse and the new command
> > is executed.
> >
> > - Interval pulse counter: For a designated interval (1 through
> > 4,294,967,295 µsec), count the number of high pulses appearing at the
> > edge_1 input or low pulses appearing at the edge_2 input. When the
> > designated interval expires, the PM-1 pulls the serial line low for 50
> > msec to signal the Stamp. The time elapsed while counting pulses is
> > maintained to 1 µsec. The number of pulses and time duration are
> > available for readback to the Stamp.
> >
> > - Report counters: The contents of the pulse and time counters are
> > sent to the Stamp.
> >
> > - Pulse latch: The PM-1's pulse_out output is toggled upon a high
> > pulse occurring at the edge_1 input or low pulse occurring at the
> > edge_2 input. The pulse_out output remains at this level until reset
> > by the Stamp.
> >
> > - Set pulse_out low/high: This function simply sets the pulse_out
> > output to the designated logic level. Its primary purpose is to
> > determine an initial pulse_out logic state for subsequent pulse
> > functions.
> >
> > - One-shot: The PM-1's pulse_out output is switched to the opposite
> > logic level for a period of from 1 through 4,294,967,295 µsec. The
> > pulse begins upon receipt of the command from the Stamp.
> >
> > - Edge-triggered one-shot: The one-shot pulse function occurs upon a
> > rising edge on the PM-1's edge_1 input, or a falling edge on the
> > edge_2 input.
> >
> > - Pulse-triggered one-shot: The one-shot pulse function occurs upon a
> > high pulse on the edge_1 input or a low pulse on the edge_2 input.
> >
> > - Clock generator (gated): A clock signal is generated on the
> > pulse_out output. The period and duty cycle are determined by
> > Stamp-specified values defining the high and low intervals of the
> > clock pulse train. Each interval may be from 1 through 4,294,967,295
> > µsec. The clock output is asserted only while the PM-1's active-low
> > gate* input is held low. Tie the gate* input low or apply the desired
> > logic level via software control.
> >
> > - 38 KHz pulse source (gated): A 38 KHz pulse train appears at the
> > pulse_out output when the gate* input is low.
> >
> > - 40 KHz pulse source (gated): A 40 KHz pulse train appears at the
> > pulse_out output when the gate* input is low.
> >
> > - Pulse width modulation: A clock signal with duty cycle from 0%
> > through 100% is generated at the pulse_out output pin. Duty cycle is
> > specified as a value from 0 through 255.
> >
> > - Servo pulse (gated): A clock is generated on the pulse_out output
> > with cycle period = 19.968 msec when the gate* input is low. The high
> > portion of the clock may be 1 through 2.02 msec, and is specified as a
> > value from 0 through 255.
> >
> > - Clock divider: A clock signal appearing at the pulse_in input is
> > divided by 1 through 65,536 and appears at the pulse_out output pin.
> > The output clock signal has a 50% duty cycle regardless of the duty
> > cycle characteristic of the input clock."
> >
> >
> > I could modify the code to provide a rollover output and/or a
> > divide-by-2 output, but would have to give up LCD or other functions
> > to free up pins. Let me know if you'd like further details of
> > operation.
> >
> >
> > Regards,
> >
> > Steve
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>Steve,
>thanks for your response.
>- Could you give me an Email or anything to contact Al Williams ?
>- LCD is not necessary, I have already one connected to the BS2p.
>- You mentioned the 16 bit counter, counting up to 4,294,967,295 pulses,
>which is 2^32 ! Which is correct ?
>If it actually is a 32-bit counter inside then this seems to be fine.
>Could you send me more information ? How much is it ?
>
>Thanks,
>Volker
Volker -
You can contact Al WIlliams at this web site: http://www.al-williams.com/awce
Regards,
Bruce