Shop OBEX P1 Docs P2 Docs Learn Events
speed control? — Parallax Forums

speed control?

jknightandkarrjknightandkarr Posts: 234
edited 2009-07-19 04:13 in BASIC Stamp
I'm planning on using a BS2 & BS2P40 on a display project. Both to drive LED displays, both making producing beeping effects & the other a sound clip via a voice recording chip. Now my question is, how can I adjust the speed of the scanning displays using a reg pot or a digital pot? I tried using an RC circuit, but only managed to create a display that flashed slow at first then speeded up. tongue.gif Needless to say that didn't work. I didn't save the program cause it didn't work but used experiments from the What is a microcontroller Ch 5, activity 2 & 3 to design the program.

Joe

Comments

  • dev/nulldev/null Posts: 381
    edited 2009-07-18 09:37
    Are you just gonna flash the LED's, or flash them in a sequence? Do you need to do other processing while the LED's are flashing? Maybe you should consider a shift register (ex. 74HC595) which will take serial data in and produce parallel outputs...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
  • jknightandkarrjknightandkarr Posts: 234
    edited 2009-07-18 16:43
    I'm going to have both sets of leds flash in a fixed pattern, as for other data on the inside, I'll have the BS2 control the 12 leds, & produce a simple beep with each led, & an extra button programed to end the cycle. As for the BS2P40. I'm going to run 8 Bi-color leds, But I gotta find leds for that first, but I'm planning on using 8 pins for one color, 8 for the other color, 1 pin to trigger a sound recording chip, 1 button to end the display & 1 button to change the pattern of the display, maybe, still debating on that one.

    Joe

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I'm going insaine. It's SOOOOOO much fun. lol
  • dev/nulldev/null Posts: 381
    edited 2009-07-18 19:25
    So why don't you just use the PAUSE command?

    This code will blink 16 leds in succesion:
    LEDS  VAR Word
    LEDS = %1000000000000000
    
    DO
      OUTS = LEDS
      IF LEDS.HIGHBYTE(7) = 1 THEN ' If we reached the 16th bit
        LEDS = %1000000000000000 ' go to first one again
      else
        LEDS = LEDS >> 1 ' (expletive) the bit to the right
      endif
      PAUSE 50
    LOOP
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
  • jknightandkarrjknightandkarr Posts: 234
    edited 2009-07-18 22:22
    I know how to do make the leds flash, that's not my problem I have, that's easy to do write. What my problem is, is that I want to be able to adjust the speed at which the leds display scan at without having to reprogram the BS2's to go from fast to slow & back again. Somehow by using a digital or analog pot, the BS2's can adjust the display speed from slow to fast & back simply by adjusting the pot. I can't do that with pause alone. I tried an RC circuit, but it didn't work as excected.

    Joe

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I'm going insaine. It's SOOOOOO much fun. lol
  • PrettybirdPrettybird Posts: 269
    edited 2009-07-18 23:09
    In TTL just use a 555 timer with a pot and use the stamp turn in the timer (s). I use to use a 4017 decade counter with an op amp to a 555 one shot to make LEDs go in sequence with sound using a microphone. Using TTL can save limitted I/O pins.
  • dev/nulldev/null Posts: 381
    edited 2009-07-19 02:06
    I would be interested to know how an RC circuit might look like for that. Any of you electronic buffs out there any idea?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
  • ercoerco Posts: 20,256
    edited 2009-07-19 04:04
    The easy way is to just have a pot set up in an RCtime circuit on a Stamp pin, no direct electrical connection to your LED circuit. Your software reads the current pot value, then passes that value into your LED flashing routine, then loops back to read the pot value again. Different pot values cause proportionally longer or shorter pauses, which controls the flash speed. It's all about efficient looping.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • jknightandkarrjknightandkarr Posts: 234
    edited 2009-07-19 04:07
    Prettybird said...
    In TTL just use a 555 timer with a pot and use the stamp turn in the timer (s). I use to use a 4017 decade counter with an op amp to a 555 one shot to make LEDs go in sequence with sound using a microphone. Using TTL can save limitted I/O pins.

    I didn't think of a 555 timer. I can use that with the Pause Pin command to adjust my speed. Thanks.

    Joe

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I'm going insaine. It's SOOOOOO much fun. lol
  • jknightandkarrjknightandkarr Posts: 234
    edited 2009-07-19 04:13
    erco said...
    The easy way is to just have a pot set up in an RCtime circuit on a Stamp pin, no direct electrical connection to your LED circuit. Your software reads the current pot value, then passes that value into your LED flashing routine, then loops back to read the pot value again. Different pot values cause proportionally longer or shorter pauses, which controls the flash speed. It's all about efficient looping.

    That was actually my first attempt on a single led to test. I did something wrong though, it starts out flashing real slow & then gradually speeds up, & the rate it speeds up varied with the pot. I did something wrong, just gotta figure out what.

    Joe

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I'm going insaine. It's SOOOOOO much fun. lol
Sign In or Register to comment.