Shop OBEX P1 Docs P2 Docs Learn Events
Microsecond pause durations — Parallax Forums

Microsecond pause durations

ArchiverArchiver Posts: 46,084
edited 2003-01-03 16:02 in General Discussion
I saw in a post from a few weeks ago that pauses of a few
microseconds' duration might be possible with the BS2 SX if Assembly
were used:

"If you really need that much precision, you could switch to assembly
and use the SX directly ... that will give you complete control."

I need to pulse a signal in a pretty tight pattern....300 microseconds
low, 600 high, 1200 low, 600 high, and so on. Although I'm good at
coding, I'm new to microcontrollers. Could someone give me some advice
on how to use Assembly, or actually ANY strategy to get this timing?

FYI, what I'm actually trying to accomplish, is sending commands to a
Sony CD-player using the S-Link protocol...

Thanks in advance,
--Alex

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-01-03 05:02
    Haven't done it with an SX chip, but I did figure out how to run a servo
    with an Atmel AVR in Assembly Language. Very similar to what you want to do.

    You can either use the internal timer(s) or a program loop to generate a
    pulse every so often -- you have to start with your processor clock speed
    and work backwards. Its definitely more difficult than Stamp Basic and it
    will drive you nuts.

    Original Message

    > I saw in a post from a few weeks ago that pauses of a few
    > microseconds' duration might be possible with the BS2 SX if Assembly
    > were used:
    >
    > "If you really need that much precision, you could switch to assembly
    > and use the SX directly ... that will give you complete control."
    >
    > I need to pulse a signal in a pretty tight pattern....300 microseconds
    > low, 600 high, 1200 low, 600 high, and so on. Although I'm good at
    > coding, I'm new to microcontrollers. Could someone give me some advice
    > on how to use Assembly, or actually ANY strategy to get this timing?
    >
    > FYI, what I'm actually trying to accomplish, is sending commands to a
    > Sony CD-player using the S-Link protocol...
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-03 11:30
    I'd use a pulse output coprocessor myself.
    http://www.al-williams.com/pak8.htm
    They also have a PWM coprocessor as well.
    http://www.al-williams.com/pak5.htm This chip can be clocked at up to 75mhz
    as well.
    these chips can be controlled from the Basic Stamp quite easily.
    With these chips you could get down to about a 5us pulse, with 1-2us
    increments.

    If you want real precision, you can use assembly and a Ubicom Scenix SX chip
    directly.
    The basic Stamp BS2-SX happens to use the Ubicom Scenix chip itself.


    Original Message
    From: Rodent [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=RYcEiknXtG0zdBwO3lkfkEXrIGjszSSEByJbBLC-YW2VVGUhg6OdOve-QMS7151pQMHjv0OfmHgW]daweasel@s...[/url
    Sent: Thursday, January 02, 2003 11:02 PM
    To: basicstamps@yahoogroups.com
    Subject: Re: [noparse][[/noparse]basicstamps] Microsecond pause durations


    Haven't done it with an SX chip, but I did figure out how to run a servo
    with an Atmel AVR in Assembly Language. Very similar to what you want to do.

    You can either use the internal timer(s) or a program loop to generate a
    pulse every so often -- you have to start with your processor clock speed
    and work backwards. Its definitely more difficult than Stamp Basic and it
    will drive you nuts.

    Original Message

    > I saw in a post from a few weeks ago that pauses of a few
    > microseconds' duration might be possible with the BS2 SX if Assembly
    > were used:
    >
    > "If you really need that much precision, you could switch to assembly
    > and use the SX directly ... that will give you complete control."
    >
    > I need to pulse a signal in a pretty tight pattern....300 microseconds
    > low, 600 high, 1200 low, 600 high, and so on. Although I'm good at
    > coding, I'm new to microcontrollers. Could someone give me some advice
    > on how to use Assembly, or actually ANY strategy to get this timing?
    >
    > FYI, what I'm actually trying to accomplish, is sending commands to a
    > Sony CD-player using the S-Link protocol...




    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-01-03 16:02
    Alex,

    > "If you really need that much precision, you could switch to assembly
    > and use the SX directly ... that will give you complete control."

    > I need to pulse a signal in a pretty tight pattern....300 microseconds
    > low, 600 high, 1200 low, 600 high, and so on. Although I'm good at
    > coding, I'm new to microcontrollers. Could someone give me some advice
    > on how to use Assembly, or actually ANY strategy to get this timing?

    If you would rather not use assembly, the PicBasic Pro compiler can easily
    do what you want with its "pauseus" command. The "us" in "pauseus"
    indicates that this command is for microseconds (uS), so...

    pauseus 300

    ...gives you 300 microseconds. PicBasic Pro generates code for the PIC line
    of microcontrollers, which is what the BS2 uses.

    The "SX" reference above appears to mean an "SX" microcontroller, rather
    than the BS2-SX Stamp.

    Randy Jones
    www.glitchbuster.com
Sign In or Register to comment.