Shop OBEX P1 Docs P2 Docs Learn Events
oscilloscope questions / measuring a pulse width question — Parallax Forums

oscilloscope questions / measuring a pulse width question

ArchiverArchiver Posts: 46,084
edited 2002-12-24 09:55 in General Discussion
more stupid questions probably...

I want to measure the width of a pulse. All I have is a volt meter,
and
I think you need an oscilloscope for this. But I think you can do
this with
a stamp and the pulsein command? And that's what I want to do.

Now this is for a stepper controller program, or its output.

So any way, what is an oscilloscope really? Isn't it just a
voltmeter that
measures a sample over a sweep time period, and displays its out put
on
a graph of time versus magnitude?

Second, my output to be measured, comes from a program where a pin
is simply turned on for a time then turned off, this is a square
wave on an
oscilloscope, no?

now when using the pulsin command,

pulsin pin, state, variable

variable -- has a unit(a min value) associated with what ever pin
you are
using, and a max
pulse width value. I think I understand this, it will wait 'upto'
this max
value for a
pulse, and measure it if it gets one, and store its value in
variable as the
number
corresponding to the number of pulse units it counted? Correct?

it stores a zero if there is no pulse

question,-- what happens if the pulse is faster than the minimum
unit for
the stamp
you are using, does it register as a 'variable = 1' or is this a
zero also?


lastly, can you safely hook up the parallel output pin, this is my
output to
be measured,
directly into the stamp pin to read it with pulsin, or do you need a
resister or anything
else....

thanks for any help or info

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-12-23 15:48
    That's an accurate description of an oscilloscope if you ask me. Now,
    let me ask a question of the group: If he runs his pulse into the
    anode of a diode, then connects the cathode to a parallel combination
    of a capasitor and small resistor, can the pulse width be found using
    the dc average taken from the resistor and the known discharge time
    of the capasitor? Maybe that's not a good way to do it (because of
    the .7 drop as well as the internal resistance of the multimeter),
    but if he doesn't have access to an oscilloscope maybe that would
    work, if indeed the width could be found that way. Hey man, does your
    multimeter measure frequency? That might help with the equations also.
  • ArchiverArchiver Posts: 46,084
    edited 2002-12-23 15:48
    That's an accurate description of an oscilloscope if you ask me. Now,
    let me ask a question of the group: If he runs his pulse into the
    anode of a diode, then connects the cathode to a parallel combination
    of a capasitor and small resistor, can the pulse width be found using
    the dc average taken from the resistor and the known discharge time
    of the capasitor? Maybe that's not a good way to do it (because of
    the .7 drop as well as the internal resistance of the multimeter),
    but if he doesn't have access to an oscilloscope maybe that would
    work, if indeed the width could be found that way. Hey man, does your
    multimeter measure frequency? That might help with the equations also.
  • ArchiverArchiver Posts: 46,084
    edited 2002-12-23 17:43
    >So any way, what is an oscilloscope really? Isn't it just a
    >voltmeter that measures a sample over a sweep time period, and
    >displays its out put on a graph of time versus magnitude?


    That is it in a nutshell, but one main difference is a thing called
    triggering. Without triggering, the scope does not know when to
    start the graph, and your pulse ends up nowhere in particular on the
    'scope screen. With triggering, the scope starts the graph
    immediately at the left edge of the display right when your pulse
    starts. That is just elementary triggering. A lot of the imposing
    number of knobs (or menus) on an oscilloscope have to do with setting
    the triggering. Many scopes can display two or more signals at once,
    and the triggering can come from one of those or from yet another
    signal, and the triggering can be delayed etc etc. Digital 'scopes
    have internal memory that can store up the signal, so that even a
    single event can be captured and displayed when you are ready.

    >Second, my output to be measured, comes from a program where a pin
    >is simply turned on for a time then turned off, this is a square
    >wave on an oscilloscope, no?

    Yes, although on the 'scope you may see other aspects of the signal,
    like its rise time, oscillations on your power supply, etc etc.

    >pulsin pin, state, variable
    >
    >variable -- has a unit(a min value) associated with what ever pin
    >you are using, and a max pulse width value. I think I understand
    >this, it will wait 'upto' this max value for a pulse, and measure
    >it if it gets one, and store its value in variable as the number
    >corresponding to the number of pulse units it counted? Correct?


    Yes, you are a careful reader!


    >it stores a zero if there is no pulse
    >
    >question,-- what happens if the pulse is faster than the minimum
    >unit for the stamp you are using, does it register as a 'variable =
    >1' or is this a zero also?

    The Stamp samples the signal, and if it just happens to sample at the
    instant your pulse is there, then it will return a 1. Otherwise a
    zero. So you can't be sure. If it is a repeating signal, sometimes
    you will get 1 and sometimes 0.

    How wide is your signal? The unit of resolution for the BS2 is 2
    microseconds, and for the BS2sx it is 0.8 us. Is your signal shorter
    than that?


    >lastly, can you safely hook up the parallel output pin, this is my
    >output to be measured, directly into the stamp pin to read it with
    >pulsin, or do you need a resister or anything
    >else....

    Always use a resistor. What is the voltage level and source for the
    signal you are measuring?

    >
    >thanks for any help or info


    I hope that helps,

    -- Tracy
  • ArchiverArchiver Posts: 46,084
    edited 2002-12-23 22:27
    > >question,-- what happens if the pulse is faster than the minimum
    > >unit for the stamp you are using, does it register as a 'variable =
    > >1' or is this a zero also?
    >
    > The Stamp samples the signal, and if it just happens to sample at the
    > instant your pulse is there, then it will return a 1. Otherwise a
    > zero. So you can't be sure. If it is a repeating signal, sometimes
    > you will get 1 and sometimes 0.
    >

    -- this I'm a little foggy on, does your answer here only apply to
    my question about the very short pulse?

    If not, what good is pulsin? How can you use it to measure a pulse?

    It sounds like you go into pulsin 'mode' upto the max time, and hope
    the pulse is there to be measured.

    Or I guess you could only do a pulsin when you know the pulse will be
    there,
    and you know it's less than the max that can be measured.





    > How wide is your signal? The unit of resolution for the BS2 is 2
    > microseconds, and for the BS2sx it is 0.8 us. Is your signal shorter
    > than that?
    >

    This, the width, I have no idea. My pulse width is how ever long it takes
    my computer
    to do a 1000 step for / next loop. This is a pulse being sent to a stepper
    controller,
    power supply. I just played around with the delay until it began to work
    half way OK. It actually works pretty well, but I'd like to know exactly
    what's going on.



    >
    > >lastly, can you safely hook up the parallel output pin, this is my
    > >output to be measured, directly into the stamp pin to read it with
    > >pulsin, or do you need a resister or anything
    > >else....
    >
    > Always use a resistor. What is the voltage level and source for the
    > signal you are measuring?
    >
    it's the parallel port, I think it's ttl, 0 to +5 vdc. but it may only be
    3.5 vdc

    > >
    > >thanks for any help or info
    >
    >
    > I hope that helps,
    >
    > -- Tracy
    >
    this is very helpful, thanks very much!


    as far as getting an oscilloscope. I'm afraid of getting one for fear that
    I'll get one unable to do my simple task here. I have no idea of what the
    max pulse my computer might be able to produce. The fastest computer
    I have is a 1.12 Mhz pentium III, this running running through VB6, or maybe
    an inline assembly subroutine, might potentially make a very high frequency
    pulse

    But then again, I don't know if the frequency ratings for oscilloscopes
    determine the max frequency of the pulse they are capable of measuring.

    What if my pentium produces a 100 Mhz square wave pulse, -- you can't
    measure something like this with a $25, 20Mhz surpluse scope can you?

    And next year, the pentiums will probably be 2 Ghz or more, so in a few
    years,
    these thing will be able to out speed just about everything you need to do
    for some of the sensor stuff and stepper motor stuff....


    thanks everyone, happy holidays!
  • ArchiverArchiver Posts: 46,084
    edited 2002-12-24 00:17
    > > >question,-- what happens if the pulse is faster than the minimum
    >> >unit for the stamp you are using, does it register as a 'variable =
    >> >1' or is this a zero also?
    >>
    >> The Stamp samples the signal, and if it just happens to sample at the
    >> instant your pulse is there, then it will return a 1. Otherwise a
    >> zero. So you can't be sure. If it is a repeating signal, sometimes
    >> you will get 1 and sometimes 0.
    >>
    >
    >-- this I'm a little foggy on, does your answer here only apply to
    >my question about the very short pulse?

    Yes, the explanation applies only to a very short pulse, shorter than
    the pulsin command is capable of measuring. Something under a
    microsecond, like 50 nanoseconds for example. That is how long an SX
    chip running in turbo mode at 20mhz takes to execute one machine
    language instruction (BS2p). Pulsin is a verrry useful command for
    pulse lengths from 2 microseconds and up (BS2) to just over 0.13
    millisecond. The uncertainty I was talking about only happens when
    the pulses are shorter than one microsecond.

    >If not, what good is pulsin? How can you use it to measure a pulse?
    >
    >It sounds like you go into pulsin 'mode' upto the max time, and hope
    >the pulse is there to be measured.
    >
    >Or I guess you could only do a pulsin when you know the pulse will be
    >there,
    >and you know it's less than the max that can be measured.


    Right!

    > > How wide is your signal? The unit of resolution for the BS2 is 2
    >> microseconds, and for the BS2sx it is 0.8 us. Is your signal shorter
    >> than that?
    >>
    >
    >This, the width, I have no idea. My pulse width is how ever long it takes
    >my computer
    >to do a 1000 step for / next loop. This is a pulse being sent to a stepper
    >controller,
    >power supply. I just played around with the delay until it began to work
    >half way OK. It actually works pretty well, but I'd like to know exactly
    >what's going on.

    That is certainly longer enough for the Stamp to measure. Try it!!!!!

    > >
    >> >lastly, can you safely hook up the parallel output pin, this is my
    >> >output to be measured, directly into the stamp pin to read it with
    >> >pulsin, or do you need a resister or anything
    >> >else....
    >>
    >> Always use a resistor. What is the voltage level and source for the
    >> signal you are measuring?
    >>
    >it's the parallel port, I think it's ttl, 0 to +5 vdc. but it may only be
    >3.5 vdc

    That will work fine. Put a 10k resistor in series between the port
    pin and your BASIC Stamp. Good insurance. And be sure to connect
    the grounds together.

    >
    >> >
    >> >thanks for any help or info
    >>
    >>
    >> I hope that helps,
    >>
    >> -- Tracy
    >>
    >this is very helpful, thanks very much!
    >
    >
    >as far as getting an oscilloscope. I'm afraid of getting one for fear that
    >I'll get one unable to do my simple task here. I have no idea of what the
    >max pulse my computer might be able to produce. The fastest computer
    >I have is a 1.12 Mhz pentium III, this running running through VB6, or maybe
    >an inline assembly subroutine, might potentially make a very high frequency
    >pulse
    >
    >But then again, I don't know if the frequency ratings for oscilloscopes
    >determine the max frequency of the pulse they are capable of measuring.


    Like the BASIC Stamp, you can't get all that speed to the output pin,
    running BASIC. There are a lot of steps in there. Maybe someone
    else here knows what the maximum throughput of a PC printer port
    might be.

    >
    >What if my pentium produces a 100 Mhz square wave pulse, -- you can't
    >measure something like this with a $25, 20Mhz surpluse scope can you?

    No, but there are quite capable 20mhz 'scopes around, that will do
    much of what you want with the Stamp.

    >
    >And next year, the pentiums will probably be 2 Ghz or more, so in a few
    >years,
    >these thing will be able to out speed just about everything you need to do
    >for some of the sensor stuff and stepper motor stuff....
    >
    >thanks everyone, happy holidays!


    Likewise!!!!
  • ArchiverArchiver Posts: 46,084
    edited 2002-12-24 09:55
    I can't see the application from the thread, but if the pulses are coming in
    in a repetitive manner it is possible to slow down repetitive short duration
    pulses by using a IC divider chain. The pulses can then be measured as a
    frequency.

    HTH

    Tony
    Original Message
    From: "Tracy Allen" <tracy@e...>
    To: <basicstamps@yahoogroups.com>
    Sent: Monday, December 23, 2002 5:43 PM
    Subject: Re: [noparse][[/noparse]basicstamps] oscilloscope questions / measuring a pulse width
    question


    > >So any way, what is an oscilloscope really? Isn't it just a
    > >voltmeter that measures a sample over a sweep time period, and
    > >displays its out put on a graph of time versus magnitude?
    >
    >
    > That is it in a nutshell, but one main difference is a thing called
    > triggering. Without triggering, the scope does not know when to
    > start the graph, and your pulse ends up nowhere in particular on the
    > 'scope screen. With triggering, the scope starts the graph
    > immediately at the left edge of the display right when your pulse
    > starts. That is just elementary triggering. A lot of the imposing
    > number of knobs (or menus) on an oscilloscope have to do with setting
    > the triggering. Many scopes can display two or more signals at once,
    > and the triggering can come from one of those or from yet another
    > signal, and the triggering can be delayed etc etc. Digital 'scopes
    > have internal memory that can store up the signal, so that even a
    > single event can be captured and displayed when you are ready.
    >
    > >Second, my output to be measured, comes from a program where a pin
    > >is simply turned on for a time then turned off, this is a square
    > >wave on an oscilloscope, no?
    >
    > Yes, although on the 'scope you may see other aspects of the signal,
    > like its rise time, oscillations on your power supply, etc etc.
    >
    > >pulsin pin, state, variable
    > >
    > >variable -- has a unit(a min value) associated with what ever pin
    > >you are using, and a max pulse width value. I think I understand
    > >this, it will wait 'upto' this max value for a pulse, and measure
    > >it if it gets one, and store its value in variable as the number
    > >corresponding to the number of pulse units it counted? Correct?
    >
    >
    > Yes, you are a careful reader!
    >
    >
    > >it stores a zero if there is no pulse
    > >
    > >question,-- what happens if the pulse is faster than the minimum
    > >unit for the stamp you are using, does it register as a 'variable =
    > >1' or is this a zero also?
    >
    > The Stamp samples the signal, and if it just happens to sample at the
    > instant your pulse is there, then it will return a 1. Otherwise a
    > zero. So you can't be sure. If it is a repeating signal, sometimes
    > you will get 1 and sometimes 0.
    >
    > How wide is your signal? The unit of resolution for the BS2 is 2
    > microseconds, and for the BS2sx it is 0.8 us. Is your signal shorter
    > than that?
    >
    >
    > >lastly, can you safely hook up the parallel output pin, this is my
    > >output to be measured, directly into the stamp pin to read it with
    > >pulsin, or do you need a resister or anything
    > >else....
    >
    > Always use a resistor. What is the voltage level and source for the
    > signal you are measuring?
    >
    > >
    > >thanks for any help or info
    >
    >
    > I hope that helps,
    >
    > -- Tracy
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
Sign In or Register to comment.