Shop OBEX P1 Docs P2 Docs Learn Events
counter! — Parallax Forums

counter!

yonibearyonibear Posts: 4
edited 2004-12-02 16:58 in Learn with BlocklyProp
Hi,

Can anyone tell me how to build a counter with my BS2?
This is the problem:
I give a START signal(switch), a few µ or n seconds later an output of an IC becomes HIGH or "1".
I only want to see what·the time is·between the START signal and becoming HIGH of the IC output.
Is this possible?
How do I have·to connect this construction on my "Board Of Eductation"?
If you have any information or an exampleprogram you can send it to "spycom2004@yahoo.com".


Sorry, but I'm a real beginner with BS2!



Greetings,

Yoni

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2004-12-02 15:11
    I think you need to use the 'PULSIN' signal.

    Read the 'start' signal on one pin, then start monitoring the other pin with PULSIN.

    Your time will be off by the amount of time it takes to read the PULSIN command -- but that offset should be relatively constant.

    Make sure you connect the ground of the IC to the ground (VSS) of the BS2, to insure the signal the BS2 reads has a good ground reference.
  • edited 2004-12-02 16:58
    It sounds like you have a start signal on a different I/O pin from the IC signal. Especially if you need to measure a few µs, an XOR gate chip could be useful. It has two inputs and one output. When the two inputs are both low, the chip sends a low signal. When one of the two inputs is high, the output is high, then when both inputs are high, the output goes low again. This is the signal that can be measured with the PULSIN. The Elements of Digital Logic text is available for free download from the www.parallax.com -> Downloads -> Stamps in Class Tutorials page. It has more information on how an XOR gate works along with information about an XOR chip and some simulation software that shows in more detail how it works.

    Did you mean a few (µs or ns) or a few (µs or ms)? If we are talking about nanoseconds, you will need a counter and a clock. The BASIC Stamp can then read the value that the counter counted up to. Again, this is an Elements of Digital Logic subject.
Sign In or Register to comment.