Shop OBEX P1 Docs P2 Docs Learn Events
Another thing that makes no sense — Parallax Forums

Another thing that makes no sense

lenny1337lenny1337 Posts: 26
edited 2007-07-27 18:34 in BASIC Stamp
This one has stumped quite a few people here, not to mention me. To make a long story short, we have a light board here which drives like 50 shift registers w/ a basic stamp. The shift register procedure is known as subroutine "lighttest". What i want to do is remotely initiate this light test. I breadboarded the driver circuit, and wrote the following code:

Start:
DO
k = k+1
IF (k>1) THEN
SERIN 0, 16468, [noparse][[/noparse]WAIT("go")]
DEBUG "got it"
GOSUB LIGHTTEST
DEBUG "light test done", CR
ELSE
GOSUB LIGHTTEST
ENDIF

(note that it runs through the first time when its plugged in, this is just a hardware requirement)

Now, on the breadboard, when i press the remote trigger i undoubtedly each time see "got it" followed after a short period by "light test done". However, when i take the BS2 and plug it into the actual driver card, nothing happens. THe only way i can start the light test is by manually restarting the driver circuit.

I've mapped all the pins on the driver, varified voltages on the reciever, tested the SAME reciever in the breadboard everything works fine, but when its on the circuit card, nothing. No reaction.

Now, if I change the K to "If (K>2) THEN", then i will get two light tests out of my hardware - but the third one will fail to be remotely triggered.
Anyone? Anyone?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Lenny Bogdanov
Systems Concept Center

Post Edited (lenny1337) : 7/26/2007 6:50:07 PM GMT

Comments

  • NewzedNewzed Posts: 2,503
    edited 2007-07-26 18:51
    You wrote:

    SERIN 0, 16468, [noparse][[/noparse]WAIT("go")]

    You are telling the Stamp to wait for a "go", but then you are not sending it any data.· Try something like:

    SERIN 0, 16468, [noparse][[/noparse]WAIT("go"), "a"]
    if com = "a" then GOSUB lighttest

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Yesterday is history, tomorrow is a mystery, and today is a gift.

    That is why they call it the present.

    Don't have VGA?
    Newzed@aol.com
    ·
  • lenny1337lenny1337 Posts: 26
    edited 2007-07-26 19:14
    hm, ill try that out - i just assumed that once it sees a "go" it will move on to the next line in the code

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Lenny Bogdanov
    Systems Concept Center
  • lenny1337lenny1337 Posts: 26
    edited 2007-07-26 19:23
    okay i tried that - i edited my code to look like this on the receiving end:


    Start:

    DO
    k = k+1
    IF (k>1) THEN
    SERIN 0, 16468, [noparse][[/noparse]WAIT("go"), flag]
    DEBUG ? flag
    IF flag = 1 THEN
    GOSUB lighttest
    ENDIF
    DEBUG "light test done", CR
    ELSE
    GOSUB LIGHTTEST
    ENDIF


    the remote trigger end looks like this:
    [noparse][[/noparse]...]
    flag VAR Bit
    flag = 1
    PULSOUT 2, 1200
    SEROUT 2, 16468, [noparse][[/noparse]"go", flag]
    [noparse][[/noparse]...]

    and on the breadboard the debug out is:

    flag = 1
    (pause)
    light test done

    on the hardware, still nothing.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Lenny Bogdanov
    Systems Concept Center
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-07-26 19:47
    Lenny -

    You need to terminate the DO statement like so:

    Start:
    DO

    k = k+1
    IF (k>1) THEN
    SERIN 0, 16468, [noparse][[/noparse]WAIT("go"), flag]
    DEBUG ? flag
    IF flag = 1 THEN
    GOSUB lighttest
    ENDIF
    DEBUG "light test done", CR
    ELSE
    GOSUB LIGHTTEST
    ENDIF

    LOOP

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-07-26 19:58
    Lenny, you should really try to pick a more descriptive subject for your messages than, "This makes no sense..."

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-07-26 20:34
    Hi Lenny, I have had circumstances when·serial input could not reliably satisfy the WAIT directive at 9600 on a BS2.

    Is it possible to test your system at a lower baud rate to eliminate that possibility.

    Jeff T.
  • lenny1337lenny1337 Posts: 26
    edited 2007-07-26 20:41
    I lowered the baud two-fold, however there is still no difference.

    I guess this is just one of those unsolvable issues...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Lenny Bogdanov
    Systems Concept Center
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2007-07-26 21:33
    Is your lighttest terminal sending "go" or "GO" ?
  • lenny1337lenny1337 Posts: 26
    edited 2007-07-26 21:36
    "go". plus the thing about this is it works on the breadboard....or atleast displays the two debugs before and after the subroutine which means it should be running it. but on the hardware i see no effect.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Lenny Bogdanov
    Systems Concept Center
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2007-07-27 00:38
    Well, OK.

    Then the trouble must be·your lighttest subroutine (which, so far, has been excluded from this "discussion") and/or how you're interfacing with the Stamp.· DEBUG only indicates, as I think you understand,·that your program has progressed to some program line.

    Over to you, Len.
  • lenny1337lenny1337 Posts: 26
    edited 2007-07-27 00:46
    roger that, PJ - the way i tested the subroutine is simply by changing the IF line to (k>2) which would mean i would have to see two subroutines run in the hardware, AND I DO!

    this problem really makes no sense. i thougth that perhaps 5V was not enough for the board and got a variable power supply and gave it 5.5V which i believe is the threshold of "not burning (expletive) up", and yet that made no difference either.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Lenny Bogdanov
    Systems Concept Center
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2007-07-27 01:09
    Do we get to see the LIGHTTEST subroutine already?
    (Sheesh.)
  • lenny1337lenny1337 Posts: 26
    edited 2007-07-27 01:17
    haha okay, it will have to wait until tomorrow when i get back to my work computer though.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Lenny Bogdanov
    Systems Concept Center
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2007-07-27 13:38
    OK.·

    And what is the deal with variable "k"?· What value is it when the program first slides into "Start:"?· Is it 0 [noparse][[/noparse]zero]?
  • lenny1337lenny1337 Posts: 26
    edited 2007-07-27 18:34
    k is automatically set to zero, that just ensures that it runs through once before waiting for the remote trigger - hardware requirement

    heres the rest of the code- nothing special
    ' ********************** I/O DEFINITIONS *********************
    OUTPUT 13 'Setting input and output pin definitions
    OUTPUT 11
    OUTPUT 10
    OUTPUT 9
    OUTPUT 8

    INPUT 12 'Optional input pin that can receive the data
    'scrolling R to L back to the microcontroller.

    ' ********************* INITIALIZATION ***********************
    LOW 8 'Initialize CLK to low.
    LOW 9 'Initialize STROBE to low.
    LOW 10 'Initialize DATA_IN_LR to low.
    LOW 11 'Initialize LR output enable to logic high (enables outputs).
    LOW 13 'Initialize RL output enable to logic high (enables outputs).

    '******************** VARIABLE DEFINITIONS *******************
    N CON 80 'Total number of lights
    NL CON 3 'Length of adjacent ligts to be scrolled

    C CON 1 'Pause in ms between clock cycles. Will control the scroll speed of the
    'lights down the length of the board.

    T CON 2000 'Pause in ms between light test and dark test.

    i VAR Byte 'counter
    j VAR Byte 'counter
    k VAR Byte 'counter


    CLEAR:

    LOW 9
    FOR i=1 TO (N)
    LOW 10
    HIGH 8
    LOW 8
    NEXT

    RETURN

    '***********************************************************
    '* LIGHTS: Fills registers with N logic '1's *
    '***********************************************************
    LIGHTS:

    LOW 9
    FOR i=1 TO (N)
    HIGH 10
    HIGH 8
    LOW 8
    NEXT

    RETURN

    '***********************************************************
    '* ZEROS: Fills registers with NL logic '0's *
    '***********************************************************
    ZEROS:

    FOR i=1 TO NL
    LOW 10
    PAUSE C
    HIGH 8
    PAUSE C
    LOW 8
    NEXT

    RETURN

    '***********************************************************
    '* ONES: Fills registers with NL logic '1's *
    '***********************************************************
    ONES:

    FOR i=1 TO NL
    HIGH 10
    PAUSE C
    HIGH 8
    PAUSE C
    LOW 8
    NEXT

    RETURN

    '***********************************************************
    '* ZERO: Fills register with one logic '0' *
    '***********************************************************
    ZERO:

    LOW 10
    PAUSE C
    HIGH 8
    PAUSE C
    LOW 8

    RETURN

    '***********************************************************
    '* ONE: Fills register with one logic '1' *
    '***********************************************************
    ONE:

    HIGH 10
    PAUSE C
    HIGH 8
    PAUSE C
    LOW 8

    RETURN

    '***********************************************************
    '* LIGHTTEST: Scrolls lights of length NL down the *
    '* the length of the board and back. *
    '***********************************************************
    LIGHTTEST:

    GOSUB CLEAR 'Initialize shift registers with logic '0's
    HIGH 9 'Sets the strobe to high so lights can be seen.
    GOSUB ONES 'Shifts NL lights to be scrolled into shift registers.


    FOR j=1 TO (2*N) 'Shifts 2*N logic '0's into shift registers
    GOSUB ZERO 'which shift the lights down the length
    NEXT 'of the board and back.

    LOW 9 'Strobe low.

    RETURN

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Lenny Bogdanov
    Systems Concept Center
Sign In or Register to comment.