Shop OBEX P1 Docs P2 Docs Learn Events
Newbie! Speed questions... — Parallax Forums

Newbie! Speed questions...

ArchiverArchiver Posts: 46,084
edited 2003-08-11 16:13 in General Discussion
Hello!

I just finished a little music (sequencer) project using the OOPic.
The OOPic has proven interesting, but a little slow. When programmed
without using "virtual circuits", there's a noticable delay between
the input and output(~ 1.5 hudredths of a second) in simple programs
like this:

[noparse][[/noparse]pseudocode:]

do
copy value from input_pin to output_pin
loop

The project is a little unnusual in that I wish to allow the
microcontroller to be programmed by your average hacker. The gear
will have a 9 pin serial port right on it.

I'm considering either using the basic stamp, or the atmel
microcontroller. The Atmel, however, seems far less "friendly" to
program. Plus, I think I might have to include a complicated
programmer circuit right in my project, which adds a lot of overhead.

My question is... what type of delay should I expect from the basic
stamp (let's say the BASIC Stamp 2p) for simply copying a value from
an input to an output?

Thanks a ton!!
- Bret

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-08-11 02:52
    Depending on the instruction, it should be in the 100 - 200 microsecond
    range. I haven't measured myself (can you help here, Tracy), but most
    simple instructions load and execute fairly quickly.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: c45a6 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=R8LddSHF-yMVvRWucbOIjNKkSGSwUY7D19OCq_QcDIx2faXU9Ne4roOZ6GS2zyVtqySYCn6idtUlvw0c]clone45@h...[/url
    Sent: Sunday, August 10, 2003 8:25 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Newbie! Speed questions...



    Hello!

    I just finished a little music (sequencer) project using the OOPic.
    The OOPic has proven interesting, but a little slow. When programmed
    without using "virtual circuits", there's a noticable delay between
    the input and output(~ 1.5 hudredths of a second) in simple programs
    like this:

    [noparse][[/noparse]pseudocode:]

    do
    copy value from input_pin to output_pin
    loop

    The project is a little unnusual in that I wish to allow the
    microcontroller to be programmed by your average hacker. The gear
    will have a 9 pin serial port right on it.

    I'm considering either using the basic stamp, or the atmel
    microcontroller. The Atmel, however, seems far less "friendly" to
    program. Plus, I think I might have to include a complicated
    programmer circuit right in my project, which adds a lot of overhead.

    My question is... what type of delay should I expect from the basic
    stamp (let's say the BASIC Stamp 2p) for simply copying a value from
    an input to an output?

    Thanks a ton!!
    - Bret


    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/




    This message has been scanned by WebShield. Please report SPAM to
    abuse@p....
  • ArchiverArchiver Posts: 46,084
    edited 2003-08-11 03:08
    Wow, that would be a vast improvement. Does anyone have the means
    (and valuable time) to write a tiny program that copies a logic input
    line to an output line and measure the delay involved? I'd love to
    get confirmation on that figure!!

    If not, no worries. It's worth it for me to buy the basic stamp and
    try it myself. :-)

    Thank you so much for the speedy response!! Jon, if I do buy the
    basic stamp, I'll try to remind myself to send you a visual comparison
    of the basic stamp vs. the OOPic for this experiment. {PS: I'm not
    dissing the OOPic.}

    - Bret

    --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
    wrote:
    > Depending on the instruction, it should be in the 100 - 200
    microsecond
    > range. I haven't measured myself (can you help here, Tracy), but
    most
    > simple instructions load and execute fairly quickly.
    >
    > -- Jon Williams
    > -- Applications Engineer, Parallax
    > -- Dallas Office
    >
    >
    >
    Original Message
    > From: c45a6 [noparse][[/noparse]mailto:clone45@h...]
    > Sent: Sunday, August 10, 2003 8:25 PM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] Newbie! Speed questions...
    >
    >
    >
    > Hello!
    >
    > I just finished a little music (sequencer) project using the OOPic.

    > The OOPic has proven interesting, but a little slow. When
    programmed
    > without using "virtual circuits", there's a noticable delay between
    > the input and output(~ 1.5 hudredths of a second) in simple
    programs
    > like this:
    >
    > [noparse][[/noparse]pseudocode:]
    >
    > do
    > copy value from input_pin to output_pin
    > loop
    >
    > The project is a little unnusual in that I wish to allow the
    > microcontroller to be programmed by your average hacker. The gear
    > will have a 9 pin serial port right on it.
    >
    > I'm considering either using the basic stamp, or the atmel
    > microcontroller. The Atmel, however, seems far less "friendly" to
    > program. Plus, I think I might have to include a complicated
    > programmer circuit right in my project, which adds a lot of
    overhead.
    >
    > My question is... what type of delay should I expect from the basic
    > stamp (let's say the BASIC Stamp 2p) for simply copying a value
    from
    > an input to an output?
    >
    > Thanks a ton!!
    > - Bret
    >
    >
    > 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/
    >
    >
    >
    >
    > This message has been scanned by WebShield. Please report SPAM to
    > abuse@p...
  • ArchiverArchiver Posts: 46,084
    edited 2003-08-11 03:28
    In a message dated 8/10/2003 7:10:57 PM Pacific Daylight Time,
    clone45@h... writes:

    >
    > Wow, that would be a vast improvement. Does anyone have the means
    > (and valuable time) to write a tiny program that copies a logic input
    > line to an output line and measure the delay involved? I'd love to
    > get confirmation on that figure!!
    >
    > If not, no worries. It's worth it for me to buy the basic stamp and
    > try it myself. :-)

    Yes, I will do it.....

    let me confirm what you want to measure.....

    Read a transistion on an input (low to high or high to low) then make an
    output line go high.

    If that is not what you want, clarify.......if that is good, email me soon, I
    can do it tonight.


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-08-11 04:32
    In a message dated 8/10/2003 7:10:57 PM Pacific Daylight Time,
    clone45@h... writes:

    > Wow, that would be a vast improvement. Does anyone have the means
    > (and valuable time) to write a tiny program that copies a logic input
    > line to an output line and measure the delay involved? I'd love to
    > get confirmation on that figure!!
    >
    > If not, no worries. It's worth it for me to buy the basic stamp and
    > try it myself. :-)
    >
    > Thank you so much for the speedy response!! Jon, if I do buy the
    > basic stamp, I'll try to remind myself to send you a visual comparison
    > of the basic stamp vs. the OOPic for this experiment. {PS: I'm not
    > dissing the OOPic.}
    >
    > - Bret
    >

    Bret,

    I wrote a simple program for the BS2 to test the speed of an input to be
    recognized and the act on an output. I think I read that the BS2sx is about 2.5
    times faster than the BS2

    dirs = $fe 'pin 0 input, all others outputs
    out1 = 0 'make pin 1 logic zero
    loop
    if in0 = 1 then loop 'wait for pin 0 to go high
    out1 = 1 'make pin 1 high
    out1 = 0 'make pin1 low
    goto loop ' do it again

    I connected pin 0 to +5v via 1k ohms
    Connected a signal generator to pin 1 at a frequency of 0.5 hertz
    Connected a dual trace o-scope on pins 1 and 2, set for single trigger
    and pin 0 the trigger source

    About 20 trials produced the following results:
    When pin 0 makes a low to high transition, the minimum time for pin 1 to go
    high measured 550 uS, and the maximum time measured 920 uS.

    The time varies due to not having control of exactly where the processor is
    within the two instructions.
    loop
    if in0 = 1 then loop
    I assume that the minimum time occurs if the low to high transition on pin 0
    occurs when the JUST BEFORE checking the state of pin 0, and the maximum time
    occurs if the low to high transition on pin 0 occurs JUST AFTER the processor
    is finished checking the state of pin 0.

    Also, once I made pin 1 high, I immediately make the pin low. The time of the
    pulse on pin 1 measured 188 uS.

    Hope this helps.

    I belong to two user groups, this one and the SX sold by Unicom (Parallax
    distributor) and it is unlikely you will find a user group with as much support
    as this one (BS2).

    If the Basic Stamp or BS2sx is not fast enough, the SX (not BS2sx) will be
    plenty fast enough. Clocked at 50 Mhz, each instruction takes only 20nS, yes,
    20nS. Most intructions take 2 or 3 clock cycles, so the same test on an SX will

    take either 60ns or 80ns, depending on jump back to loop or not. Worst case,
    the SX is ~6,800 times faster.
    The instructions would look like this:

    BS2 version
    loop
    if in0 = 1 then loop
    out1 = 1
    out1 = 0

    SX version
    loop
    jnb ra.0,loop ;if pin ra.0 is low jmp to loop
    setb ra.1 ;make pin ra.1 high

    The SX distributed from Parallax is not nearly as user friendly as the Basic
    Stamps, but Parallax has good tutorials on the device. The SX is about 1/10
    the cost of the BS2sx and lighting fast by comparison.


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-08-11 10:35
    Copying inputs to outputs, say:

    DO
    outH=INL ' copy 8 bits from inputs 0-7 to outputs 8-15
    outH=INL ' again
    LOOP

    On the BS2p will take about 70 microseconds between the first one and
    second one. It takes longer to get from the bottom of the loop back
    to the top, 75 microseconds on the BS2p. That makes 145 microseconds
    from the completion of the second transfer, around the loop to
    completion of the first one again.

    If you need more computations, more complicated mapping, or more
    fancy steps, it will of course take longer. Here is a speed
    reference...
    http://www.emesystems.com/BS2speed.htm

    -- Tracy



    >Depending on the instruction, it should be in the 100 - 200 microsecond
    >range. I haven't measured myself (can you help here, Tracy), but most
    >simple instructions load and execute fairly quickly.
    >
    >-- Jon Williams
    >-- Applications Engineer, Parallax
    >-- Dallas Office
    >
    >
    >
    Original Message
    >From: c45a6 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=yxRs2IHNUwIO82aWGZri9grnTv9g24z63OZ6QvvLriMn3645mIN5rqWA173BMYIUhmxJujRvqY0Wm7dn9vY]clone45@h...[/url
    >Sent: Sunday, August 10, 2003 8:25 PM
    >To: basicstamps@yahoogroups.com
    >Subject: [noparse][[/noparse]basicstamps] Newbie! Speed questions...
    >
    >
    >
    >Hello!
    >
    >I just finished a little music (sequencer) project using the OOPic.
    >The OOPic has proven interesting, but a little slow. When programmed
    >without using "virtual circuits", there's a noticable delay between
    >the input and output(~ 1.5 hudredths of a second) in simple programs
    >like this:
    >
    >[noparse][[/noparse]pseudocode:]
    >
    >do
    > copy value from input_pin to output_pin
    >loop
    >
    >The project is a little unnusual in that I wish to allow the
    >microcontroller to be programmed by your average hacker. The gear
    >will have a 9 pin serial port right on it.
    >
    >I'm considering either using the basic stamp, or the atmel
    >microcontroller. The Atmel, however, seems far less "friendly" to
    >program. Plus, I think I might have to include a complicated
    >programmer circuit right in my project, which adds a lot of overhead.
    >
    >My question is... what type of delay should I expect from the basic
    >stamp (let's say the BASIC Stamp 2p) for simply copying a value from
    >an input to an output?
    >
    >Thanks a ton!!
    >- Bret
    >
    >
    >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/
    >
    >
    >
    >
    >This message has been scanned by WebShield. Please report SPAM to
    >abuse@p....
    >
    >
    >
    >
    >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/
  • ArchiverArchiver Posts: 46,084
    edited 2003-08-11 16:13
    Hi:

    You were comparing Stamp to Atmel so only the latter is missing. I know a
    little about the AVR and just wrote exactly the same as Tracy but in a BASic
    COMpiler:
    Do
    IN R1, PortD
    OUT PortC,R1
    Loop

    I looked at the compiled code in AVR Studio (free from Atmel) and it had
    produced exactly what I would have written in assembler, just 3
    instructions, total of 4 cycles.

    4 cycles at standard 16 MHz is 250 nano secs - not micro secs.

    That is almost the same as 'Hardwired'.

    David Lawrence
    www.rhombus-tek.com


    Original Message
    From: Tracy Allen <tracy@e...>
    To: <basicstamps@yahoogroups.com>
    Sent: Monday, August 11, 2003 2:35 AM
    Subject: RE: [noparse][[/noparse]basicstamps] Newbie! Speed questions...


    > Copying inputs to outputs, say:
    >
    > DO
    > outH=INL ' copy 8 bits from inputs 0-7 to outputs 8-15
    > outH=INL ' again
    > LOOP
    >
    > On the BS2p will take about 70 microseconds between the first one and
    > second one. It takes longer to get from the bottom of the loop back
    > to the top, 75 microseconds on the BS2p. That makes 145 microseconds
    > from the completion of the second transfer, around the loop to
    > completion of the first one again.
    >
    > If you need more computations, more complicated mapping, or more
    > fancy steps, it will of course take longer. Here is a speed
    > reference...
    > http://www.emesystems.com/BS2speed.htm
    >
    > -- Tracy
    >
    >
    >
    > >Depending on the instruction, it should be in the 100 - 200 microsecond
    > >range. I haven't measured myself (can you help here, Tracy), but most
    > >simple instructions load and execute fairly quickly.
    > >
    > >-- Jon Williams
    > >-- Applications Engineer, Parallax
    > >-- Dallas Office
    > >
    > >
    > >
    Original Message
    > >From: c45a6 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=x9LEYTXekowKi0IJl-La7H6t70XYEBgd3AgrI-JYNr5_kOK_4-I0rQjqDDRHAz3kkbDgr1Wp2Gdb_NmE]clone45@h...[/url
    > >Sent: Sunday, August 10, 2003 8:25 PM
    > >To: basicstamps@yahoogroups.com
    > >Subject: [noparse][[/noparse]basicstamps] Newbie! Speed questions...
    > >
    > >
    > >
    > >Hello!
    > >
    > >I just finished a little music (sequencer) project using the OOPic.
    > >The OOPic has proven interesting, but a little slow. When programmed
    > >without using "virtual circuits", there's a noticable delay between
    > >the input and output(~ 1.5 hudredths of a second) in simple programs
    > >like this:
    > >
    > >[noparse][[/noparse]pseudocode:]
    > >
    > >do
    > > copy value from input_pin to output_pin
    > >loop
    > >
    > >The project is a little unnusual in that I wish to allow the
    > >microcontroller to be programmed by your average hacker. The gear
    > >will have a 9 pin serial port right on it.
    > >
    > >I'm considering either using the basic stamp, or the atmel
    > >microcontroller. The Atmel, however, seems far less "friendly" to
    > >program. Plus, I think I might have to include a complicated
    > >programmer circuit right in my project, which adds a lot of overhead.
    > >
    > >My question is... what type of delay should I expect from the basic
    > >stamp (let's say the BASIC Stamp 2p) for simply copying a value from
    > >an input to an output?
    > >
    > >Thanks a ton!!
    > >- Bret
    > >
    > >
    > >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/
    > >
    > >
    > >
    > >
    > >This message has been scanned by WebShield. Please report SPAM to
    > >abuse@p....
    > >
    > >
    > >
    > >
    > >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/
    >
    >
    > 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.