Shop OBEX P1 Docs P2 Docs Learn Events
serial control of robot from computer console.... — Parallax Forums

serial control of robot from computer console....

ArchiverArchiver Posts: 46,084
edited 2003-06-26 16:24 in General Discussion
How can I program the stamp to take realtime input from a computer
connected to it via the serial cable to controll a robot? (ofcourse
the robot will not be going far from the computer)

thanks

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-06-25 09:31
    Hi
    In principle it could work something like the program fragment below.
    Of course this example is just an outline which has yet to be
    enhanced upon your needs. One important aspect is, that you have to
    signal to the computer when the stamp is ready to receive (as the
    stamp has no input buffer).
    Regards
    Adrian

    '{$STAMP BS2}
    Rx con 16 'use the programming port
    Tx con 16 ' dito
    ACK con $ff 'or whatever

    BAUD con 16468 'BS2:9600,8,N,1

    wdata var word
    cmd var wdata.NIB3


    loop:
    'wait for and receive data from the computer.
    'of course this can be more than just a word.
    serin Rx,BAUD,[noparse][[/noparse]wdata]

    'execute whatever code, according to 'wdata'
    'e.g. using the high nibble if wdata as a command
    branch cmd,[noparse][[/noparse]c1,c2,c3,c4]
    goto nop

    c1:
    'code from cmd 1

    c2:
    'code from cmd 2

    c3:
    'code from cmd 3

    c4:
    'code from cmd 4

    nop:
    'send acknowledgement to the computer to
    'signal that the stamp is ready to receive again.
    serout Tx,BAUD,[noparse][[/noparse]ACK]
    goto loop:
  • ArchiverArchiver Posts: 46,084
    edited 2003-06-25 13:47
    It's really pretty simple, just program the stamp to look at an input
    (serial in) and look for an ascii character. When it grabs the character,
    do an if/then comparison and jump to a subroutine to do the function
    associated with the character and then return to the serial input routine.
    I've done this several times for controlling spray heads and air cylinders
    and motors. I've developed a board to do this. Check out this page;

    Jim
    http://www.geocities.com/jimforkin2003/


    Original Message
    From: nestlerv [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=cUYSJIiiEgaf0JM2TsXHoOvnGkiV7Rx-f6r9AOJ9qhYpY0m8lb9xoH7Y5hJlDnKErlNIAbLIzvfrAwY]nestlerv@a...[/url
    Sent: Wednesday, June 25, 2003 12:56 AM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] serial control of robot from computer console....


    How can I program the stamp to take realtime input from a computer
    connected to it via the serial cable to controll a robot? (ofcourse
    the robot will not be going far from the computer)

    thanks



    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2003-06-25 20:56
    First, I am fairly new at this, so pardon my ignorance if it surfaces.

    I want to use the serial port of the computer the same way I use the
    serial cable to program the bs2sx.

    Are the serin commands the same as coding rx con 16, tx con 16?

    Your board looks interesting. I actually have a remote control car in
    mind that I picked up from radio shack. I want to remove the controls
    it has, put the basic stamp in, connect a computer to the stamp and
    then have the computer control the car.

    Do you think your board could do that? I have the schematics for the
    car if that would help.






    --- In basicstamps@yahoogroups.com, "Jim Forkin" <jjf@p...> wrote:
    > It's really pretty simple, just program the stamp to look at an
    input
    > (serial in) and look for an ascii character. When it grabs the
    character,
    > do an if/then comparison and jump to a subroutine to do the function
    > associated with the character and then return to the serial input
    routine.
    > I've done this several times for controlling spray heads and air
    cylinders
    > and motors. I've developed a board to do this. Check out this page;
    >
    > Jim
    > http://www.geocities.com/jimforkin2003/
    >
    >
    >
    Original Message
    > From: nestlerv [noparse][[/noparse]mailto:nestlerv@a...]
    > Sent: Wednesday, June 25, 2003 12:56 AM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] serial control of robot from computer
    console....
    >
    >
    > How can I program the stamp to take realtime input from a computer
    > connected to it via the serial cable to controll a robot? (ofcourse
    > the robot will not be going far from the computer)
    >
    > thanks
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the
    Subject and
    > Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2003-06-26 07:43
    Port number 16 ist somewhat different than others: if used with serin
    it refers to the stamp's SIN contact, when used with serout it refers
    to the stamp's SOUT contact.

    This way you can use the same cable and setup for your own control as
    for programming the stamp (I am always doing this). Don't forget that
    the stamp's programming port is fixed to 9600/8/N/1.

    Regards
    Adrian
  • ArchiverArchiver Posts: 46,084
    edited 2003-06-26 15:43
    Stamp programming and DEBUG is fixed at 9600 baud, but you can use the
    the port at any supported baud rate for your own applications. Just
    keep in mind that the hardware design echoes any character sent to it
    from the outside -- you'll need to filter this externally.

    -- Jon Williams
    -- Parallax


    Original Message
    From: Adrian Schneider [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=_WS-9KCr104qZxhYxsoNBGUPKJ4aOZRYkJWqe3LrN6DzKQXes_bFgyj_SU2iiCVIGuaZYKck8S-EDib4KUoWlVoBNhDGHbU]adrian.schneider@t...[/url
    Sent: Thursday, June 26, 2003 1:44 AM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Re: serial control of robot from computer
    console....


    Port number 16 ist somewhat different than others: if used with serin
    it refers to the stamp's SIN contact, when used with serout it refers
    to the stamp's SOUT contact.

    This way you can use the same cable and setup for your own control as
    for programming the stamp (I am always doing this). Don't forget that
    the stamp's programming port is fixed to 9600/8/N/1.

    Regards
    Adrian


    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject
    and Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/




    This message has been scanned by WebShield. Please report SPAM to
    abuse@p....
  • ArchiverArchiver Posts: 46,084
    edited 2003-06-26 16:24
    Yes, to use the BS2 built in serial port,
    you MUST use 'inverted' baud mode, and
    you refer to it as:

    SERIN 16, serbaud, [noparse][[/noparse]Data]
    SEROUT 16, serbaud, [noparse][[/noparse]Data2]

    where 'serbaud' refers to the INVERTED mode
    baudrate selector.

    --- In basicstamps@yahoogroups.com, "nestlerv" <nestlerv@a...> wrote:
    > First, I am fairly new at this, so pardon my ignorance if it
    surfaces.
    >
    > I want to use the serial port of the computer the same way I use
    the
    > serial cable to program the bs2sx.
    >
    > Are the serin commands the same as coding rx con 16, tx con 16?
    >
    > Your board looks interesting. I actually have a remote control car
    in
    > mind that I picked up from radio shack. I want to remove the
    controls
    > it has, put the basic stamp in, connect a computer to the stamp and
    > then have the computer control the car.
    >
    > Do you think your board could do that? I have the schematics for
    the
    > car if that would help.
    >
    >
    >
    >
    >
    >
    > --- In basicstamps@yahoogroups.com, "Jim Forkin" <jjf@p...> wrote:
    > > It's really pretty simple, just program the stamp to look at an
    > input
    > > (serial in) and look for an ascii character. When it grabs the
    > character,
    > > do an if/then comparison and jump to a subroutine to do the
    function
    > > associated with the character and then return to the serial input
    > routine.
    > > I've done this several times for controlling spray heads and air
    > cylinders
    > > and motors. I've developed a board to do this. Check out this
    page;
    > >
    > > Jim
    > > http://www.geocities.com/jimforkin2003/
    > >
    > >
    > >
    Original Message
    > > From: nestlerv [noparse][[/noparse]mailto:nestlerv@a...]
    > > Sent: Wednesday, June 25, 2003 12:56 AM
    > > To: basicstamps@yahoogroups.com
    > > Subject: [noparse][[/noparse]basicstamps] serial control of robot from computer
    > console....
    > >
    > >
    > > How can I program the stamp to take realtime input from a computer
    > > connected to it via the serial cable to controll a robot?
    (ofcourse
    > > the robot will not be going far from the computer)
    > >
    > > thanks
    > >
    > >
    > >
    > > To UNSUBSCRIBE, just send mail to:
    > > basicstamps-unsubscribe@yahoogroups.com
    > > from the same email address that you subscribed. Text in the
    > Subject and
    > > Body of the message will be ignored.
    > >
    > >
    > > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
Sign In or Register to comment.