Shop OBEX P1 Docs P2 Docs Learn Events
serial LCD with piezo speaker — Parallax Forums

serial LCD with piezo speaker

pdugpdug Posts: 2
edited 2012-12-04 19:20 in General Discussion
I am using Basic Stamp 2 with board of education and a serial LCD #27977. My issue is that when I program a series of tones in a loop and play through LCD with serout, the tones continue to play even after I run a different program (with or without music). I have tried using control codes to turn LCD off and on, disconnecting power and adding long pauses at beginning of program. If the new program has sound, both sounds play simultaneously when I run it. Does anyone know how to correct this?

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2012-12-04 17:32
    Post your code. (I've given up on asking people to attach their code.)

    The only non-volatile storage available is for custom characters.
    I think that it can only 'play notes' if doing so is in the sequence of events.
  • pdugpdug Posts: 2
    edited 2012-12-04 19:20
    Here is an example that I was using to test the speaker with. When I run this code, it plays through and ends fine. When I place these commands inside a DO LOOP, the LCD will keep repeating it even when I load another program into the Stamp. Also, if I place any code after the last NEXT statement (eg. debug "some text"), it executes right after the tones start to play. A pause with a duration the length of the tone block is needed to stall the program until the tones are finished. It does seem as if there is non-volatile memory in the unit, but I can't find any information about it. The data sheet for the device only lists the control codes for executing the tones and a brief example. I apppreciate you taking a look at this. Anything you can tell me will be helpful.

    Alarm: ' alarm sound

    x VAR Nib
    i VAR Nib
    SEROUT 12, 84, [22] ' turn on LCD
    SEROUT 12, 84, [208, 219,232] ' note length, octave, pause

    FOR x = 1 TO 10 ' repeat pattern 10x

    FOR i = 1 TO 8 STEP 2
    SEROUT 12, 84, [ (222 + i)] ' note + counter ascending
    NEXT
    FOR i = 7 TO 0 STEP 2
    SEROUT 12, 84, [(222 + i)] ' note + counter descending
    NEXT
    NEXT
Sign In or Register to comment.