Shop OBEX P1 Docs P2 Docs Learn Events
Pulse train — Parallax Forums

Pulse train

ArchiverArchiver Posts: 46,084
edited 2000-11-28 00:03 in General Discussion
I want to pulse an LED and continue to have it pulse while the program
continues to execute instructions. I see I can create a pulse train but it
appears that a loop is necessary to create a pule strain. As a result I
wouldn't be able to process any other data.

My other thought was to set a port high into a stobing led and let the
hardware do the strobing.

I'd prefer to do it with software..cheaper and I can change the duty cycle.

Any ideas?

Jay

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-11-26 02:23
    try using a 555 timer to do the asynchronous pulsing on the LED. Or did
    you not want to use a 555 timer ?

    nagi



    Original Message
    From: Jay Kay [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=JGghsbZVxPf684HlxnKZHcm7cpGWIOyQ9fIXzhRR1RY9jCtODSjpwuGe0xm2zZZ21e8BQrP7t7ANRkrDz8I]pcb4u@e...[/url
    Sent: Saturday, November 25, 2000 8:15 PM
    To: basicstamps@egroups.com
    Subject: [noparse][[/noparse]basicstamps] Pulse train


    I want to pulse an LED and continue to have it pulse while the program
    continues to execute instructions. I see I can create a pulse train but
    it
    appears that a loop is necessary to create a pule strain. As a result I
    wouldn't be able to process any other data.

    My other thought was to set a port high into a stobing led and let the
    hardware do the strobing.

    I'd prefer to do it with software..cheaper and I can change the duty
    cycle.

    Any ideas?

    Jay
  • ArchiverArchiver Posts: 46,084
    edited 2000-11-26 02:24
    Actually a 3909 is a better choice for just pulsing a LED. Lower current
    and fewer components...
    Bill

    At 08:23 PM 11/25/2000 -0600, you wrote:
    >try using a 555 timer to do the asynchronous pulsing on the LED. Or did
    >you not want to use a 555 timer ?
    >
    >nagi
    >
    >
    >
    >
    Original Message
    >From: Jay Kay [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=eUezJJwWmSYlgoeUJWU04qgQU3JLLIUBJiwf7-KLWsNh8oVZDkifgg3tM-C_baccDLY4r1qeIF0gNOZGFA]pcb4u@e...[/url
    >Sent: Saturday, November 25, 2000 8:15 PM
    >To: basicstamps@egroups.com
    >Subject: [noparse][[/noparse]basicstamps] Pulse train
    >
    >
    >I want to pulse an LED and continue to have it pulse while the program
    >continues to execute instructions. I see I can create a pulse train but
    >it
    >appears that a loop is necessary to create a pule strain. As a result I
    >wouldn't be able to process any other data.
    >
    >My other thought was to set a port high into a stobing led and let the
    >hardware do the strobing.
    >
    >I'd prefer to do it with software..cheaper and I can change the duty
    >cycle.
    >
    >Any ideas?
    >
    >Jay
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2000-11-26 03:10
    I need to start and stop the train when other things occur. Can the 555 be
    started with a LO or Hi which can come from a port on the STAMP?

    Jay

    Original Message
    From: Nagi Babu <nags@c...>
    To: <basicstamps@egroups.com>
    Sent: Saturday, November 25, 2000 6:23 PM
    Subject: RE: [noparse][[/noparse]basicstamps] Pulse train


    > try using a 555 timer to do the asynchronous pulsing on the LED. Or did
    > you not want to use a 555 timer ?
    >
    > nagi
    >
    >
    >
    >
    Original Message
    > From: Jay Kay [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=mzEHvYvzWscyfLR2_ylv6YIzWzJsYPKkiXPqS6IkXnI9aZ0W3Ntz9rqMmYmHWOEtRKQg13gfkx-7TZhNsvk]pcb4u@e...[/url
    > Sent: Saturday, November 25, 2000 8:15 PM
    > To: basicstamps@egroups.com
    > Subject: [noparse][[/noparse]basicstamps] Pulse train
    >
    >
    > I want to pulse an LED and continue to have it pulse while the program
    > continues to execute instructions. I see I can create a pulse train but
    > it
    > appears that a loop is necessary to create a pule strain. As a result I
    > wouldn't be able to process any other data.
    >
    > My other thought was to set a port high into a stobing led and let the
    > hardware do the strobing.
    >
    > I'd prefer to do it with software..cheaper and I can change the duty
    > cycle.
    >
    > Any ideas?
    >
    > Jay
    >
    >
    >
    >
    >
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2000-11-26 03:16
    yes. 555's pin 4 can be taken hi to switch on the pulseout and taken low
    to switch off.



    Original Message
    From: Jay Kay [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=_ynaw5u1B3-fuoRcLrQuVp2CB_GHjkvQabQnk9wi9-M87BMp_OgatLY5x5Jj1qQXV51HIKQ246kC]pcb4u@e...[/url
    Sent: Saturday, November 25, 2000 9:10 PM
    To: basicstamps@egroups.com
    Subject: Re: [noparse][[/noparse]basicstamps] Pulse train


    I need to start and stop the train when other things occur. Can the 555
    be
    started with a LO or Hi which can come from a port on the STAMP?

    Jay

    Original Message
    From: Nagi Babu <nags@c...>
    To: <basicstamps@egroups.com>
    Sent: Saturday, November 25, 2000 6:23 PM
    Subject: RE: [noparse][[/noparse]basicstamps] Pulse train


    > try using a 555 timer to do the asynchronous pulsing on the LED. Or
    did
    > you not want to use a 555 timer ?
    >
    > nagi
    >
    >
    >
    >
    Original Message
    > From: Jay Kay [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=_ynaw5u1B3-fuoRcLrQuVp2CB_GHjkvQabQnk9wi9-M87BMp_OgatLY5x5Jj1qQXV51HIKQ246kC]pcb4u@e...[/url
    > Sent: Saturday, November 25, 2000 8:15 PM
    > To: basicstamps@egroups.com
    > Subject: [noparse][[/noparse]basicstamps] Pulse train
    >
    >
    > I want to pulse an LED and continue to have it pulse while the program
    > continues to execute instructions. I see I can create a pulse train
    but
    > it
    > appears that a loop is necessary to create a pule strain. As a result
    I
    > wouldn't be able to process any other data.
    >
    > My other thought was to set a port high into a stobing led and let the
    > hardware do the strobing.
    >
    > I'd prefer to do it with software..cheaper and I can change the duty
    > cycle.
    >
    > Any ideas?
    >
    > Jay
    >
    >
    >
    >
    >
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2000-11-26 13:02
    Good Morning

    Missed your first post so don't know what you want to do. I have two trains
    running on three tracks, all controlled by two BS2, including operation of
    turnouts. If you will repeat your question maybe I can help. I do not use
    timers.

    Sid Weaver
    Newzed@a...
  • ArchiverArchiver Posts: 46,084
    edited 2000-11-26 16:12
    Morning Sid,

    Had nothing to do with trains...question was about generating a pulse train

    Jay

    Original Message
    From: <Newzed@a...>
    To: <basicstamps@egroups.com>
    Sent: Sunday, November 26, 2000 5:02 AM
    Subject: Re: [noparse][[/noparse]basicstamps] Pulse train


    > Good Morning
    >
    > Missed your first post so don't know what you want to do. I have two
    trains
    > running on three tracks, all controlled by two BS2, including operation of
    > turnouts. If you will repeat your question maybe I can help. I do not
    use
    > timers.
    >
    > Sid Weaver
    > Newzed@a...
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2000-11-26 17:21
    Nagi,

    So what your saying is that I can get the 555 in Astable mode (free running)
    and start and stop this astable operation with a port from the Stamp to
    start the pulse train (pin 4 at 555=1) and stop the pulse train (pin 4 at
    555=0)?

    Are there any Stamp problems (sinking current) from pin 4 of the 555 when
    the Stamp port is set to 0?

    Thanks

    Jay


    Original Message
    From: Nagi Babu <nags@c...>
    To: <basicstamps@egroups.com>
    Sent: Saturday, November 25, 2000 7:16 PM
    Subject: RE: [noparse][[/noparse]basicstamps] Pulse train


    > yes. 555's pin 4 can be taken hi to switch on the pulseout and taken low
    > to switch off.
    >
    >
    >
    >
    Original Message
    > From: Jay Kay [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=Q6WS00z7TSq9mPh7ISu5xwW7oJ9xZYhFHIzEPFdhAo8oWyt-xLqByGI3vj4gNwB1FiaaiWNm3JmRb4TVoA]pcb4u@e...[/url
    > Sent: Saturday, November 25, 2000 9:10 PM
    > To: basicstamps@egroups.com
    > Subject: Re: [noparse][[/noparse]basicstamps] Pulse train
    >
    >
    > I need to start and stop the train when other things occur. Can the 555
    > be
    > started with a LO or Hi which can come from a port on the STAMP?
    >
    > Jay
    >
    >
    Original Message
    > From: Nagi Babu <nags@c...>
    > To: <basicstamps@egroups.com>
    > Sent: Saturday, November 25, 2000 6:23 PM
    > Subject: RE: [noparse][[/noparse]basicstamps] Pulse train
    >
    >
    > > try using a 555 timer to do the asynchronous pulsing on the LED. Or
    > did
    > > you not want to use a 555 timer ?
    > >
    > > nagi
    > >
    > >
    > >
    > >
    Original Message
    > > From: Jay Kay [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=Q6WS00z7TSq9mPh7ISu5xwW7oJ9xZYhFHIzEPFdhAo8oWyt-xLqByGI3vj4gNwB1FiaaiWNm3JmRb4TVoA]pcb4u@e...[/url
    > > Sent: Saturday, November 25, 2000 8:15 PM
    > > To: basicstamps@egroups.com
    > > Subject: [noparse][[/noparse]basicstamps] Pulse train
    > >
    > >
    > > I want to pulse an LED and continue to have it pulse while the program
    > > continues to execute instructions. I see I can create a pulse train
    > but
    > > it
    > > appears that a loop is necessary to create a pule strain. As a result
    > I
    > > wouldn't be able to process any other data.
    > >
    > > My other thought was to set a port high into a stobing led and let the
    > > hardware do the strobing.
    > >
    > > I'd prefer to do it with software..cheaper and I can change the duty
    > > cycle.
    > >
    > > Any ideas?
    > >
    > > Jay
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    >
    >
    >
    >
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2000-11-26 17:23
    I found the answer about sinking current for pin 4 of the 555 chip..per the
    spec sheet about .4ma MAX. Apparently no problem for the Stamp port.

    Jay

    Original Message
    From: Nagi Babu <nags@c...>
    To: <basicstamps@egroups.com>
    Sent: Saturday, November 25, 2000 7:16 PM
    Subject: RE: [noparse][[/noparse]basicstamps] Pulse train


    > yes. 555's pin 4 can be taken hi to switch on the pulseout and taken low
    > to switch off.
    >
    >
    >
    >
    Original Message
    > From: Jay Kay [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=4DTzw7VRXfCKDM456ecHEdbuU_dRY8bEryAhVE06tBK3PWfmwYhM4ndBVBQ5eP4dKFnhgXiSVng3N39_ZpU]pcb4u@e...[/url
    > Sent: Saturday, November 25, 2000 9:10 PM
    > To: basicstamps@egroups.com
    > Subject: Re: [noparse][[/noparse]basicstamps] Pulse train
    >
    >
    > I need to start and stop the train when other things occur. Can the 555
    > be
    > started with a LO or Hi which can come from a port on the STAMP?
    >
    > Jay
    >
    >
    Original Message
    > From: Nagi Babu <nags@c...>
    > To: <basicstamps@egroups.com>
    > Sent: Saturday, November 25, 2000 6:23 PM
    > Subject: RE: [noparse][[/noparse]basicstamps] Pulse train
    >
    >
    > > try using a 555 timer to do the asynchronous pulsing on the LED. Or
    > did
    > > you not want to use a 555 timer ?
    > >
    > > nagi
    > >
    > >
    > >
    > >
    Original Message
    > > From: Jay Kay [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=4DTzw7VRXfCKDM456ecHEdbuU_dRY8bEryAhVE06tBK3PWfmwYhM4ndBVBQ5eP4dKFnhgXiSVng3N39_ZpU]pcb4u@e...[/url
    > > Sent: Saturday, November 25, 2000 8:15 PM
    > > To: basicstamps@egroups.com
    > > Subject: [noparse][[/noparse]basicstamps] Pulse train
    > >
    > >
    > > I want to pulse an LED and continue to have it pulse while the program
    > > continues to execute instructions. I see I can create a pulse train
    > but
    > > it
    > > appears that a loop is necessary to create a pule strain. As a result
    > I
    > > wouldn't be able to process any other data.
    > >
    > > My other thought was to set a port high into a stobing led and let the
    > > hardware do the strobing.
    > >
    > > I'd prefer to do it with software..cheaper and I can change the duty
    > > cycle.
    > >
    > > Any ideas?
    > >
    > > Jay
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    >
    >
    >
    >
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2000-11-26 17:30
    The PAK-VIII will do this nicely and very precisely. You can change the duty
    cycle in software, turn it on and off (either high/low/or Hi-z) and you get
    8 channels with 10uS resolution or 4 channels with 5uS resolution.

    Al Williams
    AWC
    * Control 8 servos: http://www.al-williams.com/awce/pak8.htm


    >
    Original Message
    > From: Jay Kay [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=IO5R8izTm70takB3XtPCQrcvy0pqZuJgNQgnUo8uONxWNbWhejlca227iq1SqdMEC86D6Lm7ZRDX]pcb4u@e...[/url
    > Sent: Saturday, November 25, 2000 8:15 PM
    > To: basicstamps@egroups.com
    > Subject: [noparse][[/noparse]basicstamps] Pulse train
    >
    >
    > I want to pulse an LED and continue to have it pulse while the program
    > continues to execute instructions. I see I can create a pulse train but it
    > appears that a loop is necessary to create a pule strain. As a result I
    > wouldn't be able to process any other data.
    >
    > My other thought was to set a port high into a stobing led and let the
    > hardware do the strobing.
    >
    > I'd prefer to do it with software..cheaper and I can change the
    > duty cycle.
    >
    > Any ideas?
    >
    > Jay
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2000-11-26 18:26
    Boy, Bill that's a fact about the 3909. I've had a led flashing for almost
    3 years on single C batery. Great chip for flashing leds. ==Mac== Abilene,
    Texas.
    At 09:24 PM 11/25/00 -0500, you wrote:
    >Actually a 3909 is a better choice for just pulsing a LED. Lower current
    >and fewer components...
    >Bill
  • ArchiverArchiver Posts: 46,084
    edited 2000-11-26 19:25
    > I want to pulse an LED and continue to have it pulse while the program
    >continues to execute instructions. I see I can create a pulse train but it
    >appears that a loop is necessary to create a pule strain. As a result I
    >wouldn't be able to process any other data.
    > My other thought was to set a port high into a stobing led and let the
    >hardware do the strobing.
    > I'd prefer to do it with software..cheaper and I can change the duty
    cycle.

    Hi Jay,

    There are certainly ways to do it in software, but with the Stamp it
    depends on how often and how accurately you need the pulses. Say for
    example that you want the LED to flash for 50 milliseconds, approximately
    once a second. Well, that leaves 949 milliseconds between pulses and 50
    milliseconds during pulses for the program to do other things. You can do
    it all in a loop, but you have to plan ahead. Maybe the program also has
    to monitor an input and do something if the input is in a certain state.
    May be it is enough to check the input once every 10 milliseconds. The
    following runs the loop on a ten millisecond "tick". The flash rate and
    length can be changed (in units of 10 milliseconds) by changing a couple of
    numbers. It isn't precise--but I don't know what you are trying to
    accomplish.


    i var byte
    LED var out0
    output LED
    loop:
    pause 10 ' 10 millisecond per tick
    LED= i max 5 - 5 max 1
    i=i+1 // 100
    ' statements above turns LED on for i=0 to 4
    ' in a cycle of 100 ticks=1 second
    if in1=1 then loop ' check the input
    ' dosomething quick
    goto loop




    > Are there any Stamp problems (sinking current) from pin 4 of the 555 when
    > the Stamp port is set to 0?

    If you use the LMC555, which is the CMOS version of the chip, the pin 4
    input will draw practically zero current. The regular '555 should be no
    problem either, at a fraction of a milliamp.

    good luck!

    -- Tracy Allen
    http://www.emesystems.com
  • ArchiverArchiver Posts: 46,084
    edited 2000-11-27 11:49
    >Boy, Bill that's a fact about the 3909. I've had a led flashing for almost
    >3 years on single C batery. Great chip for flashing leds. ==Mac== Abilene,
    >Texas.
    >
    >At 09:24 PM 11/25/00 -0500, you wrote:
    >>Actually a 3909 is a better choice for just pulsing a LED. Lower current
    >>and fewer components...
    >>Bill
    >



    Greb 'em while you can. I read that they're being discontinued.
  • ArchiverArchiver Posts: 46,084
    edited 2000-11-28 00:03
    A pulse train can be done in software something like this:
    (this is stamp 1, modify to suit for stamp 2)
    -assuming your led is on pin0

    mainloop:w0=w0+1
    pin0=bit7
    -
    - your program here
    -
    goto mainloop

    As register w0 (a word variable) increments, you pick off one of the
    16 bits and continually copy it to an output pin. A higher bit
    number gives a slower flash rate.
    It's not good programming practice, okay in simple programs but can
    drive you nuts if there is a lot of branching going on within the
    main loop.
Sign In or Register to comment.