Shop OBEX P1 Docs P2 Docs Learn Events
Serial Communication in the background — Parallax Forums

Serial Communication in the background

lboucherlboucher Posts: 139
edited 2009-02-14 03:53 in BASIC Stamp
Hi All

So i am a bit confused.
I have been looking into setting my christmas lights to music with dimming.
To do the dimming you have to turn the power on at different times in the AC cycle, and you have to do this every cycle.

Reading thru a bunch of stuff it seems people most people use pic microcontrollers.
The serial data "interrupts" the program when needed. Thus the pic can actively dim the lights and when serial data starts coming in, it stops to receive the data.

My question is, can a Basic Stamp do something similar?
As far as i understand it doesn't have anything like an interrupt.
Does Shiftin/shiftout do what I am asking?

I probably am not asking my questions correctly.

Thanks
Lucas

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-02-14 03:39
    The Stamp has no interrupts and no "background". It's also not particularly fast. Depending on the Stamp model, it executes about 4000 (BS2) to 20000 (BS2px) interpretive instructions a second with most statement taking several instructions. A half cycle at 60Hz is about 32 to 160 instruction times which doesn't leave a lot of time at the slower speed to handle the dimming directly. You'd be much better off to use a typical dimmer circuit that's normally controlled by a variable resistor and replace the resistor with a digital pot suitably isolated and controlled by the Stamp. The Stamp also doesn't have a built-in analog to digital converter to sense the music level. There's lots of sample circuits and sample code in Parallax's tutorials (like "Basic Analog and Digital") for this. You'd still need some input conditioning circuitry to detect the average audio level (like a rectifier and filter).

    Both the Parallax SX and Propeller processors are fast enough and versatile enough to do the analog to digital conversion and the dimmer control themselves. You'd still need the isolation from the AC line for the triac trigger (for switching) and the zero-crossing detection for the dimmer timing.
  • lboucherlboucher Posts: 139
    edited 2009-02-14 03:47
    Thanks for confirming my thoughts.
    I just found this thread where someone did what i was thinking with additional hardware.

    http://forums.parallax.com/showthread.php?p=524010

    ·
  • Mike GreenMike Green Posts: 23,101
    edited 2009-02-14 03:53
    There's a good 4-channel dimmer designed for use with Stamps that uses serial control: www.efx-tek.com/topics/fc-4.html
Sign In or Register to comment.