Shop OBEX P1 Docs P2 Docs Learn Events
PLEASE help me with — Parallax Forums

PLEASE help me with

ArchiverArchiver Posts: 46,084
edited 2001-10-31 15:57 in General Discussion
Here's the problem.

I am using the following command from Visual Basic to send data to
the Stamp.

Main.MSComm1.Output = Chr$(255) & mode & Chr$(PinNumber) &
Chr$(PinState)

The 'mode' variable is a string and contains the value "Remote".
PinNumber is equal to 1 and PinState is equal to 0.

The Serin syntax (and declarations) I am using in the Stamp is:

PinNumber var byte
PinState var byte
Mode var byte(6)

Serin 16,16780,[noparse][[/noparse]WAIT(255),STR Mode\4,PinNumber,PinState]


The Stamp is receiving the PinNumber and PinState variables with no
problem, but I can NOT get the Stamp to recognize the value "Remote"
that is equal to 'mode'.

PLEASE tell me what I am doing wrong!

Sorry for all the questions!

Jim D. Martin

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-10-31 15:23
    Jim,

    I'm not familiar w/ VB, however, I'd guess the problem is that the stamp is
    probably only receiving the first so many bytes. I've never been able to
    get the stamp to serially receive more than 10 bytes.

    EXAMPLE:
    serstring var byte(10)
    serin 1,16780,[noparse][[/noparse]str serstring\10]

    NOTE:
    serstring var byte(11)
    DOES NOT WORK BECAUSE 11 IS TO BIG FOR THE BS2

    In the past I've simply sent the string in 8 byte increments with a pause or
    delay in between.
    I typically find the smallest delay that "works" and multiply it by two to
    make SURE it works.
    You'll have to play with the delay and it will vary from one PC to the next
    and probably will vary with location of the external electronics and serial
    cable, however, this is beyond my knowledge on the subject. P.S. This
    method was first suggested to me by Mr. Al Williams and it works well. I
    believe one of his PAK units might aid in this task.

    David Fixemer
    fixemerd@a...
    402-472-8239
  • ArchiverArchiver Posts: 46,084
    edited 2001-10-31 15:57
    You may want to adjust your pacing from VB too -- see Jan Axelson's "Serial
    Port Complete" for a VB delay routine that allows this. Another idea is to
    send the numbers as strings, then use the DEC or HEX modifiers of SERIN to
    capture the information. I've done this with VB when I had values greater
    than 255; it just seemed to save some headaches. If you use the modifiers,
    limit your baud rate to 9600.

    -- Jon Williams
    -- Parallax


    In a message dated 10/31/01 9:33:57 AM Central Standard Time,
    fixemerd@a... writes:


    > I'm not familiar w/ VB, however, I'd guess the problem is that the stamp is
    > probably only receiving the first so many bytes. I've never been able to
    > get the stamp to serially receive more than 10 bytes.
    >
    > EXAMPLE:
    > serstring var byte(10)
    > serin 1,16780,[noparse][[/noparse]str serstring\10]
    >
    > NOTE:
    > serstring var byte(11)
    > DOES NOT WORK BECAUSE 11 IS TO BIG FOR THE BS2
    >
    > In the past I've simply sent the string in 8 byte increments with a pause or
    > delay in between.
    > I typically find the smallest delay that "works" and multiply it by two to
    > make SURE it works.
    > You'll have to play with the delay and it will vary from one PC to the next
    > and probably will vary with location of the external electronics and serial
    > cable, however, this is beyond my knowledge on the subject. P.S. This
    > method was first suggested to me by Mr. Al Williams and it works well. I
    >




    [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.