Shop OBEX P1 Docs P2 Docs Learn Events
command line interface - Page 2 — Parallax Forums

command line interface

2»

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-10-24 21:33
    Hi Tracy
    If i use the first approach (since it seems simpler), how exactly would the 'C'
    program call the BS2 program? That is, how would it send those 'new' set of ones
    and zeros to the BS2 code and downloads it to the stamp? And which line in the
    BS2 program you mentioned below is 'listening' to this 'C' program? I just need
    a fixed set of ones and zeros in the BS2 at a time. When the next set arrives,
    it should overwrite this old set and run the robot with the new set. Then the
    control should return to the C program so that it can compute the distance moved
    by the robot with this new set.
    You might already have explained this in your program, and i might have missed
    it.

    amul

    Tracy Allen <tracy@e...> wrote:
    You don't have to tokenize anything if you are simply transferring
    data. Suppose you have the sequences of 0s and 1s in a file that is
    generated on your PC as a sequence of bytes, where bit 1 is for leg
    1, bit 2 for leg 2 and so on, and bits 0 and 7 will always be zeros
    (until you add two more legs!). Then the sequence your PC generates
    will be,
    00000110
    00000000
    00000010
    00000000
    00000110
    00000000
    00000100
    00000010
    00000101
    00000000
    11111111

    and so on, for example. Maybe all 1s might mean, "End of sequence".

    Anyway, the program in the Stamp would look something like this:

    cmd var byte
    chr var byte
    ndx var word

    initialize:
    'whatever

    Command_processor:
    SERIN 16,$54,5000,[noparse][[/noparse]WAIT ("GA",cmd] wait for prefix "GA" + command from PC
    LOOKDOWN cmd, [noparse][[/noparse]"RC"], ndx ' "R" for run, "C" for configure
    BRANCH ndx, [noparse][[/noparse]Running, Configuring]

    Running: ' play the sequence stored in eeprom
    ndx=0 ' start at 0 in eeprom
    DO
    READ ndx,chr
    IF chr=%11111111 THEN
    ' move the legs according to chr
    ndx=ndx+1
    LOOP
    ' do whatever at the end of sequence, repeat, stop, etc
    STOP

    Configuring: ' capture sequence codes from PC.
    ndx=0 ' start at 0 in eeprom
    DO
    SERIN 16,$54,5000,error_receive,[noparse][[/noparse]chr]
    WRITE ndx,chr
    ndx=ndx+1
    LOOP UNTIL chr=%11111111
    ' finished with upload
    ' a CRC might be a good idea
    ' return to command processor, or just RUN
    ' ???
    GOTO Command_processor


    Error_Receive:
    ' ring a bell or send a code back to PC
    stop

    The Stamp has to WRITE bytes to eeprom one at a time, which takes up
    to 10 milliseconds per byte (usually 3 to 5), so the PC would have to
    pace its transmission. Or you could implement a software or hardware
    flow control scheme.

    If you are using a Stamp 2p or 2pe, you have lots of eeprom available
    for storage in the extra banks (16k in the BS2p, 32k in the BS2pe).
    It is not so convenient to access the extra data banks in the BS2sx
    or BS2e. If you have an original BS2, you have to be careful that
    your data does not overwrite the program. In the Stamp, data is
    stored from address 0 up in eeprom, while program is stored from
    address 2047 down.

    There is another approach to transferring data, which uses the native
    programming algorithm of the Stamp. It would only be writing blocks
    of data, not the program blocks. The advantage of this is that it is
    very fast. It uses block level eeprom programming, and the protocol
    includes a handshake for flow control. If you do that, your Stamp
    program only has to play back the sequence, not to load it. However,
    you would need to implement the programming protocol on your PC. It
    is not hard. The protocol is described in the Parallax programmers
    docs, and also here on my web site:
    http://www.emesystems.com/BS2clone.htm

    -- Tracy





    >Hi Tracy,
    >The sequence generated by the GA is just a set of ones and zeros
    >that would describe the direction that each leg of the robot(4 or 6
    >legs) moves by. so this would look something like
    >
    >100010101000
    >101010010100
    >
    >It is possible to load new sequence data into a Stamp
    >_without_ invoking the tokenizer. The BASIC Stamp can be programmed
    >to accept commands from your C program, one of which would be to
    >accept the new sequence data, and another would be to "play" the
    >sequence.
    >
    >The problem is we do not know this sequence in advance because the
    >scheme code generates it after every run. Every run is made only
    >after the robot moves with a particular set of ones and zeros, and
    >then the distance moved is measured and fed back into the scheme
    >program. The scheme code does not generate the next set UNTIL we
    >feed this distance moved number. That is why we do not know the
    >whole set in advance. How would we load the new sequence every time
    >without using tokenizers?
    >
    >i hope that clarifies my questions.
    >
    >amul
    >
    >
    >
    >
    >
    >Tracy Allen wrote:
    >>Yeah, as u said the possibilities are infinite potentially, but its
    >>one at a time. The scheme GA generates the set of ones and zeros for
    >>every run of the GA. We then feed this to the controller (the C
    >>program has to do this with the help of the tokenizer library? ) and
    >>run it every time. so would the 'tokenizer library' help in this
    >>process?
    >
    >Like others here, I think I'm confused about what you are trying to
    >accomplish. It sounds kind of like the "ones and zeros for every run
    >of the GA" is something like a sequence or a tape recording or a
    >scheme that the Stamp has to play back. For example, to be simple,
    >it might be a sequence of ones and zeros that have to be played back
    >with one second timing on pin P0 of the Stamp:
    >110000010001000.....
    >
    >You could write each possible sequence of 1s and 0s as a separate
    >program and then reprogram the Stamp each time you need a new
    >sequence, and to do that from your C program you would need the
    >tokenizer.
    >
    >Or, you could have one single Stamp program that "plays" the
    >sequence. It is possible to load new sequence data into a Stamp
    >_without_ invoking the tokenizer. The BASIC Stamp can be programmed
    >to accept commands from your C program, one of which would be to
    >accept the new sequence data, and another would be to "play" the
    >sequence.
    >
    >What sort of sequence is "every run of the GA"?
    >
    >-- Tracy
    >
    >
    >
    >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/
    >
    >
    >
    >
    >Do you Yahoo!?
    >The New Yahoo! Shopping - with improved product search
    >
    >[noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    >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/


    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/



    Do you Yahoo!?
    The New Yahoo! Shopping - with improved product search

    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-24 21:53
    You need to have to have your C program open a serial port and send the
    bytes to the Stamp -- there's no need to go through another program.
    When using the Stamp's programming port for serial input, you'll set the
    pin to 16 as Tracy demonstrated in his example below.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office



    Original Message
    From: Vimal Vishwanathan [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=UsuY94g5iZCD3nmDF7ltcIk4qp8_IzdYSYkQmX9DaSDFNkU8-fRLp6wE4jI1FPoTtqY40uR7lv0nxg]vimal222@y...[/url
    Sent: Friday, October 24, 2003 3:33 PM
    To: basicstamps@yahoogroups.com
    Subject: RE: [noparse][[/noparse]basicstamps] Re: command line interface


    Hi Tracy
    If i use the first approach (since it seems simpler), how exactly would
    the 'C' program call the BS2 program? That is, how would it send those
    'new' set of ones and zeros to the BS2 code and downloads it to the
    stamp? And which line in the BS2 program you mentioned below is
    'listening' to this 'C' program? I just need a fixed set of ones and
    zeros in the BS2 at a time. When the next set arrives, it should
    overwrite this old set and run the robot with the new set. Then the
    control should return to the C program so that it can compute the
    distance moved by the robot with this new set.
    You might already have explained this in your program, and i might have
    missed it.

    amul

    Tracy Allen <tracy@e...> wrote:
    You don't have to tokenize anything if you are simply transferring
    data. Suppose you have the sequences of 0s and 1s in a file that is
    generated on your PC as a sequence of bytes, where bit 1 is for leg
    1, bit 2 for leg 2 and so on, and bits 0 and 7 will always be zeros
    (until you add two more legs!). Then the sequence your PC generates
    will be,
    00000110
    00000000
    00000010
    00000000
    00000110
    00000000
    00000100
    00000010
    00000101
    00000000
    11111111

    and so on, for example. Maybe all 1s might mean, "End of sequence".

    Anyway, the program in the Stamp would look something like this:

    cmd var byte
    chr var byte
    ndx var word

    initialize:
    'whatever

    Command_processor:
    SERIN 16,$54,5000,[noparse][[/noparse]WAIT ("GA",cmd] wait for prefix "GA" + command from
    PC LOOKDOWN cmd, [noparse][[/noparse]"RC"], ndx ' "R" for run, "C" for configure BRANCH
    ndx, [noparse][[/noparse]Running, Configuring]

    Running: ' play the sequence stored in eeprom
    ndx=0 ' start at 0 in eeprom
    DO
    READ ndx,chr
    IF chr=%11111111 THEN
    ' move the legs according to chr
    ndx=ndx+1
    LOOP
    ' do whatever at the end of sequence, repeat, stop, etc
    STOP

    Configuring: ' capture sequence codes from PC.
    ndx=0 ' start at 0 in eeprom
    DO
    SERIN 16,$54,5000,error_receive,[noparse][[/noparse]chr]
    WRITE ndx,chr
    ndx=ndx+1
    LOOP UNTIL chr=%11111111
    ' finished with upload
    ' a CRC might be a good idea
    ' return to command processor, or just RUN
    ' ???
    GOTO Command_processor


    Error_Receive:
    ' ring a bell or send a code back to PC
    stop

    The Stamp has to WRITE bytes to eeprom one at a time, which takes up
    to 10 milliseconds per byte (usually 3 to 5), so the PC would have to
    pace its transmission. Or you could implement a software or hardware
    flow control scheme.

    If you are using a Stamp 2p or 2pe, you have lots of eeprom available
    for storage in the extra banks (16k in the BS2p, 32k in the BS2pe).
    It is not so convenient to access the extra data banks in the BS2sx
    or BS2e. If you have an original BS2, you have to be careful that
    your data does not overwrite the program. In the Stamp, data is
    stored from address 0 up in eeprom, while program is stored from
    address 2047 down.

    There is another approach to transferring data, which uses the native
    programming algorithm of the Stamp. It would only be writing blocks
    of data, not the program blocks. The advantage of this is that it is
    very fast. It uses block level eeprom programming, and the protocol
    includes a handshake for flow control. If you do that, your Stamp
    program only has to play back the sequence, not to load it. However,
    you would need to implement the programming protocol on your PC. It
    is not hard. The protocol is described in the Parallax programmers
    docs, and also here on my web site:
    http://www.emesystems.com/BS2clone.htm

    -- Tracy





    >Hi Tracy,
    >The sequence generated by the GA is just a set of ones and zeros
    >that would describe the direction that each leg of the robot(4 or 6
    >legs) moves by. so this would look something like
    >
    >100010101000
    >101010010100
    >
    >It is possible to load new sequence data into a Stamp _without_
    >invoking the tokenizer. The BASIC Stamp can be programmed to accept
    >commands from your C program, one of which would be to accept the new
    >sequence data, and another would be to "play" the sequence.
    >
    >The problem is we do not know this sequence in advance because the
    >scheme code generates it after every run. Every run is made only
    >after the robot moves with a particular set of ones and zeros, and
    >then the distance moved is measured and fed back into the scheme
    >program. The scheme code does not generate the next set UNTIL we
    >feed this distance moved number. That is why we do not know the
    >whole set in advance. How would we load the new sequence every time
    >without using tokenizers?
    >
    >i hope that clarifies my questions.
    >
    >amul
    >
    >
    >
    >
    >
    >Tracy Allen wrote:
    >>Yeah, as u said the possibilities are infinite potentially, but its
    >>one at a time. The scheme GA generates the set of ones and zeros for
    >>every run of the GA. We then feed this to the controller (the C
    >>program has to do this with the help of the tokenizer library? ) and
    >>run it every time. so would the 'tokenizer library' help in this
    >>process?
    >
    >Like others here, I think I'm confused about what you are trying to
    >accomplish. It sounds kind of like the "ones and zeros for every run of

    >the GA" is something like a sequence or a tape recording or a scheme
    >that the Stamp has to play back. For example, to be simple, it might be

    >a sequence of ones and zeros that have to be played back with one
    >second timing on pin P0 of the Stamp: 110000010001000.....
    >
    >You could write each possible sequence of 1s and 0s as a separate
    >program and then reprogram the Stamp each time you need a new sequence,

    >and to do that from your C program you would need the tokenizer.
    >
    >Or, you could have one single Stamp program that "plays" the sequence.
    >It is possible to load new sequence data into a Stamp _without_
    >invoking the tokenizer. The BASIC Stamp can be programmed to accept
    >commands from your C program, one of which would be to accept the new
    >sequence data, and another would be to "play" the sequence.
    >
    >What sort of sequence is "every run of the GA"?
    >
    >-- Tracy
    >
    >
    >
    >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/
    >
    >
    >
    >
    >Do you Yahoo!?
    >The New Yahoo! Shopping - with improved product search
    >
    >[noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    >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/


    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/



    Do you Yahoo!?
    The New Yahoo! Shopping - with improved product search

    [noparse][[/noparse]Non-text portions of this message have been removed]


    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-10-24 22:22
    The 'C' program would have to start by getting the attention of the
    Stamp (by pulsing high the DTR line briefly), and then it sends the
    text, "GAC", and then it sends the the binary data, the sequence of
    0s and 1s for each leg packed into bytes. The line in the program
    that listens for the binary data is in the subroutine "configuring:",
    It listens for one byte at a time and WRITEs it into the Stamp
    EEPROM. You did not say how many actions there would be in this
    sequence, but the program as shown stops when the C program sends it
    a %11111111. Then it goes back to the command processor, waiting for
    the Run command from the C program, but it could just as well go
    straight into a run. As shown, the "running" subroutine goes through
    the sequence once, and then waits for the attention signal from the C
    program.

    The DTR signal on pin 4 of the DB9 connector (pin 3 of the stampIC
    module) is the standard means to get the attention of the Stamp. A
    capacitor on in series with that line can block DC levels, so that it
    only responds to the 0->1 transition.

    There are two points in the program where it is waiting for the C
    program, both being SERIN commands,

    SERIN 16,$54,5000,error_receive,[noparse][[/noparse]WAIT ("GA",cmd]

    waits for a command "GAR" for run or "GAC" for configure.


    SERIN 16,$54,5000,error_receive,[noparse][[/noparse]chr]

    receives individual bytes in the sequence to WRITE to eeprom.
    The C program has to delay 10 milliseconds or so between each byte it sends.

    There are a few additional lines that have to be added to take care
    of error conditions smoothly. There is a timeout that goes to an
    error routine, but maybe that is not appropriate. I don't know if
    you need the STamp to do anything to report its own distance moved.

    -- Tracy




    >Hi Tracy
    >If i use the first approach (since it seems simpler), how exactly
    >would the 'C' program call the BS2 program? That is, how would it
    >send those 'new' set of ones and zeros to the BS2 code and downloads
    >it to the stamp? And which line in the BS2 program you mentioned
    >below is 'listening' to this 'C' program? I just need a fixed set
    >of ones and zeros in the BS2 at a time. When the next set arrives,
    >it should overwrite this old set and run the robot with the new set.
    >Then the control should return to the C program so that it can
    >compute the distance moved by the robot with this new set.
    >You might already have explained this in your program, and i might
    >have missed it.
    >
    >amul
    >
    >Tracy Allen <tracy@e...> wrote:
    >You don't have to tokenize anything if you are simply transferring
    >data. Suppose you have the sequences of 0s and 1s in a file that is
    >generated on your PC as a sequence of bytes, where bit 1 is for leg
    >1, bit 2 for leg 2 and so on, and bits 0 and 7 will always be zeros
    >(until you add two more legs!). Then the sequence your PC generates
    >will be,
    >00000110
    >00000000
    >00000010
    >00000000
    >00000110
    >00000000
    >00000100
    >00000010
    >00000101
    >00000000
    >11111111
    >
    >and so on, for example. Maybe all 1s might mean, "End of sequence".
    >
    >Anyway, the program in the Stamp would look something like this:
    >
    >cmd var byte
    >chr var byte
    >ndx var word
    >
    >initialize:
    >'whatever
    >
    >Command_processor:
    >SERIN 16,$54,5000,[noparse][[/noparse]WAIT ("GA",cmd] wait for prefix "GA" + command from PC
    >LOOKDOWN cmd, [noparse][[/noparse]"RC"], ndx ' "R" for run, "C" for configure
    >BRANCH ndx, [noparse][[/noparse]Running, Configuring]
    >
    >Running: ' play the sequence stored in eeprom
    >ndx=0 ' start at 0 in eeprom
    >DO
    >READ ndx,chr
    >IF chr=%11111111 THEN
    >' move the legs according to chr
    >ndx=ndx+1
    >LOOP
    >' do whatever at the end of sequence, repeat, stop, etc
    >STOP
    >
    >Configuring: ' capture sequence codes from PC.
    >ndx=0 ' start at 0 in eeprom
    >DO
    >SERIN 16,$54,5000,error_receive,[noparse][[/noparse]chr]
    >WRITE ndx,chr
    >ndx=ndx+1
    >LOOP UNTIL chr=%11111111
    >' finished with upload
    >' a CRC might be a good idea
    >' return to command processor, or just RUN
    >' ???
    >GOTO Command_processor
    >
    >
    >Error_Receive:
    >' ring a bell or send a code back to PC
    >stop
    >
    >The Stamp has to WRITE bytes to eeprom one at a time, which takes up
    >to 10 milliseconds per byte (usually 3 to 5), so the PC would have to
    >pace its transmission. Or you could implement a software or hardware
    >flow control scheme.
    >
    >If you are using a Stamp 2p or 2pe, you have lots of eeprom available
    >for storage in the extra banks (16k in the BS2p, 32k in the BS2pe).
    >It is not so convenient to access the extra data banks in the BS2sx
    >or BS2e. If you have an original BS2, you have to be careful that
    >your data does not overwrite the program. In the Stamp, data is
    >stored from address 0 up in eeprom, while program is stored from
    >address 2047 down.
    >
    >There is another approach to transferring data, which uses the native
    >programming algorithm of the Stamp. It would only be writing blocks
    >of data, not the program blocks. The advantage of this is that it is
    >very fast. It uses block level eeprom programming, and the protocol
    >includes a handshake for flow control. If you do that, your Stamp
    >program only has to play back the sequence, not to load it. However,
    >you would need to implement the programming protocol on your PC. It
    >is not hard. The protocol is described in the Parallax programmers
    >docs, and also here on my web site:
    >http://www.emesystems.com/BS2clone.htm
    >
    >-- Tracy
    >
    >
    >
    >
    >
    >>Hi Tracy,
    >>The sequence generated by the GA is just a set of ones and zeros
    >>that would describe the direction that each leg of the robot(4 or 6
    >>legs) moves by. so this would look something like
    >>
    >>100010101000
    >>101010010100
    >>
    >>It is possible to load new sequence data into a Stamp
    >>_without_ invoking the tokenizer. The BASIC Stamp can be programmed
    >>to accept commands from your C program, one of which would be to
    >>accept the new sequence data, and another would be to "play" the
    >>sequence.
    >>
    >>The problem is we do not know this sequence in advance because the
    >>scheme code generates it after every run. Every run is made only
    >>after the robot moves with a particular set of ones and zeros, and
    >>then the distance moved is measured and fed back into the scheme
    >>program. The scheme code does not generate the next set UNTIL we
    >>feed this distance moved number. That is why we do not know the
    >>whole set in advance. How would we load the new sequence every time
    >>without using tokenizers?
    >>
    >>i hope that clarifies my questions.
    >>
    >>amul
    >>
    >>
    >>
    >>
    >>
    >>Tracy Allen wrote:
    >>>Yeah, as u said the possibilities are infinite potentially, but its
    >>>one at a time. The scheme GA generates the set of ones and zeros for
    >>>every run of the GA. We then feed this to the controller (the C
    >>>program has to do this with the help of the tokenizer library? ) and
    >>>run it every time. so would the 'tokenizer library' help in this
    >>>process?
    >>
    >>Like others here, I think I'm confused about what you are trying to
    >>accomplish. It sounds kind of like the "ones and zeros for every run
    >>of the GA" is something like a sequence or a tape recording or a
    >>scheme that the Stamp has to play back. For example, to be simple,
    >>it might be a sequence of ones and zeros that have to be played back
    >>with one second timing on pin P0 of the Stamp:
    >>110000010001000.....
    >>
    >>You could write each possible sequence of 1s and 0s as a separate
    >>program and then reprogram the Stamp each time you need a new
    >>sequence, and to do that from your C program you would need the
    >>tokenizer.
    >>
    >>Or, you could have one single Stamp program that "plays" the
    >>sequence. It is possible to load new sequence data into a Stamp
    >>_without_ invoking the tokenizer. The BASIC Stamp can be programmed
    >>to accept commands from your C program, one of which would be to
    >>accept the new sequence data, and another would be to "play" the
    >>sequence.
    >>
    >>What sort of sequence is "every run of the GA"?
    >>
    >>-- Tracy
    >>
    >>
    >>
    >>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/
    >>
    >>
    >>
    >>
    >>Do you Yahoo!?
    >>The New Yahoo! Shopping - with improved product search
    >>
    >>[noparse][[/noparse]Non-text portions of this message have been removed]
    > >
    >>
    >>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/
    >
    >
    >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/
    >
    >
    >
    >
    >Do you Yahoo!?
    >The New Yahoo! Shopping - with improved product search
    >
    >[noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    >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-10-25 00:54
    Is there a way to access the ATN pin (pin 3) of the BS2? I would like to use
    it but I don't want it to RESET the BS2? Thanks!
    azeasi


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-25 01:43
    The actual line that 'listens' is the
    SERIN line below. The syntax he's using has
    it wait for input for 5 seconds (5000 milliseconds)
    -- if no input comes in during that time, the program
    goes on.


    --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
    wrote:
    > You need to have to have your C program open a serial port and send
    the
    > bytes to the Stamp -- there's no need to go through another program.
    > When using the Stamp's programming port for serial input, you'll
    set the
    > pin to 16 as Tracy demonstrated in his example below.
    >
    > -- Jon Williams
    > -- Applications Engineer, Parallax
    > -- Dallas Office
    >
    >
    >
    >
    Original Message
    > From: Vimal Vishwanathan [noparse][[/noparse]mailto:vimal222@y...]
    > Sent: Friday, October 24, 2003 3:33 PM
    > To: basicstamps@yahoogroups.com
    > Subject: RE: [noparse][[/noparse]basicstamps] Re: command line interface
    >
    >
    > Hi Tracy
    > If i use the first approach (since it seems simpler), how exactly
    would
    > the 'C' program call the BS2 program? That is, how would it send
    those
    > 'new' set of ones and zeros to the BS2 code and downloads it to the
    > stamp? And which line in the BS2 program you mentioned below is
    > 'listening' to this 'C' program? I just need a fixed set of ones
    and
    > zeros in the BS2 at a time. When the next set arrives, it should
    > overwrite this old set and run the robot with the new set. Then the
    > control should return to the C program so that it can compute the
    > distance moved by the robot with this new set.
    > You might already have explained this in your program, and i might
    have
    > missed it.
    >
    > amul
    >
    > Tracy Allen <tracy@e...> wrote:
    > You don't have to tokenize anything if you are simply transferring
    > data. Suppose you have the sequences of 0s and 1s in a file that is
    > generated on your PC as a sequence of bytes, where bit 1 is for leg
    > 1, bit 2 for leg 2 and so on, and bits 0 and 7 will always be zeros
    > (until you add two more legs!). Then the sequence your PC generates
    > will be,
    > 00000110
    > 00000000
    > 00000010
    > 00000000
    > 00000110
    > 00000000
    > 00000100
    > 00000010
    > 00000101
    > 00000000
    > 11111111
    >
    > and so on, for example. Maybe all 1s might mean, "End of sequence".
    >
    > Anyway, the program in the Stamp would look something like this:
    >
    > cmd var byte
    > chr var byte
    > ndx var word
    >
    > initialize:
    > 'whatever
    >
    > Command_processor:
    > SERIN 16,$54,5000,[noparse][[/noparse]WAIT ("GA",cmd] wait for prefix "GA" + command
    from
    > PC LOOKDOWN cmd, [noparse][[/noparse]"RC"], ndx ' "R" for run, "C" for configure BRANCH
    > ndx, [noparse][[/noparse]Running, Configuring]
    >
    > Running: ' play the sequence stored in eeprom
    > ndx=0 ' start at 0 in eeprom
    > DO
    > READ ndx,chr
    > IF chr=%11111111 THEN
    > ' move the legs according to chr
    > ndx=ndx+1
    > LOOP
    > ' do whatever at the end of sequence, repeat, stop, etc
    > STOP
    >
    > Configuring: ' capture sequence codes from PC.
    > ndx=0 ' start at 0 in eeprom
    > DO
    > SERIN 16,$54,5000,error_receive,[noparse][[/noparse]chr]
    > WRITE ndx,chr
    > ndx=ndx+1
    > LOOP UNTIL chr=%11111111
    > ' finished with upload
    > ' a CRC might be a good idea
    > ' return to command processor, or just RUN
    > ' ???
    > GOTO Command_processor
    >
    >
    > Error_Receive:
    > ' ring a bell or send a code back to PC
    > stop
    >
    > The Stamp has to WRITE bytes to eeprom one at a time, which takes
    up
    > to 10 milliseconds per byte (usually 3 to 5), so the PC would have
    to
    > pace its transmission. Or you could implement a software or
    hardware
    > flow control scheme.
    >
    > If you are using a Stamp 2p or 2pe, you have lots of eeprom
    available
    > for storage in the extra banks (16k in the BS2p, 32k in the BS2pe).
    > It is not so convenient to access the extra data banks in the BS2sx
    > or BS2e. If you have an original BS2, you have to be careful that
    > your data does not overwrite the program. In the Stamp, data is
    > stored from address 0 up in eeprom, while program is stored from
    > address 2047 down.
    >
    > There is another approach to transferring data, which uses the
    native
    > programming algorithm of the Stamp. It would only be writing blocks
    > of data, not the program blocks. The advantage of this is that it
    is
    > very fast. It uses block level eeprom programming, and the protocol
    > includes a handshake for flow control. If you do that, your Stamp
    > program only has to play back the sequence, not to load it.
    However,
    > you would need to implement the programming protocol on your PC. It
    > is not hard. The protocol is described in the Parallax programmers
    > docs, and also here on my web site:
    > http://www.emesystems.com/BS2clone.htm
    >
    > -- Tracy
    >
    >
    >
    >
    >
    > >Hi Tracy,
    > >The sequence generated by the GA is just a set of ones and zeros
    > >that would describe the direction that each leg of the robot(4 or
    6
    > >legs) moves by. so this would look something like
    > >
    > >100010101000
    > >101010010100
    > >
    > >It is possible to load new sequence data into a Stamp _without_
    > >invoking the tokenizer. The BASIC Stamp can be programmed to
    accept
    > >commands from your C program, one of which would be to accept the
    new
    > >sequence data, and another would be to "play" the sequence.
    > >
    > >The problem is we do not know this sequence in advance because the
    > >scheme code generates it after every run. Every run is made only
    > >after the robot moves with a particular set of ones and zeros, and
    > >then the distance moved is measured and fed back into the scheme
    > >program. The scheme code does not generate the next set UNTIL we
    > >feed this distance moved number. That is why we do not know the
    > >whole set in advance. How would we load the new sequence every
    time
    > >without using tokenizers?
    > >
    > >i hope that clarifies my questions.
    > >
    > >amul
    > >
    > >
    > >
    > >
    > >
    > >Tracy Allen wrote:
    > >>Yeah, as u said the possibilities are infinite potentially, but
    its
    > >>one at a time. The scheme GA generates the set of ones and zeros
    for
    > >>every run of the GA. We then feed this to the controller (the C
    > >>program has to do this with the help of the tokenizer library? )
    and
    > >>run it every time. so would the 'tokenizer library' help in this
    > >>process?
    > >
    > >Like others here, I think I'm confused about what you are trying
    to
    > >accomplish. It sounds kind of like the "ones and zeros for every
    run of
    >
    > >the GA" is something like a sequence or a tape recording or a
    scheme
    > >that the Stamp has to play back. For example, to be simple, it
    might be
    >
    > >a sequence of ones and zeros that have to be played back with one
    > >second timing on pin P0 of the Stamp: 110000010001000.....
    > >
    > >You could write each possible sequence of 1s and 0s as a separate
    > >program and then reprogram the Stamp each time you need a new
    sequence,
    >
    > >and to do that from your C program you would need the tokenizer.
    > >
    > >Or, you could have one single Stamp program that "plays" the
    sequence.
    > >It is possible to load new sequence data into a Stamp _without_
    > >invoking the tokenizer. The BASIC Stamp can be programmed to
    accept
    > >commands from your C program, one of which would be to accept the
    new
    > >sequence data, and another would be to "play" the sequence.
    > >
    > >What sort of sequence is "every run of the GA"?
    > >
    > >-- Tracy
    > >
    > >
    > >
    > >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/
    > >
    > >
    > >
    > >
    > >Do you Yahoo!?
    > >The New Yahoo! Shopping - with improved product search
    > >
    > >[noparse][[/noparse]Non-text portions of this message have been removed]
    > >
    > >
    > >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/
    >
    >
    > 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/
    >
    >
    >
    >
    > Do you Yahoo!?
    > The New Yahoo! Shopping - with improved product search
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    > 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-10-25 01:45
    No, the ATN pin is wired to the 'MCLR' pin on
    the stamp, and as such it is dedicated to the
    purpose of resetting the BS2. It is wired to
    DTR on the serial port -- so by strobing DTR
    (make it Active then Inactive) you can reset
    the BS2 on your own time-table.

    But the ATN pin CANNOT be used as another
    general purpose I/O pin.

    --- In basicstamps@yahoogroups.com, azeasi@a... wrote:
    > Is there a way to access the ATN pin (pin 3) of the BS2? I would
    like to use
    > it but I don't want it to RESET the BS2? Thanks!
    > azeasi
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-25 02:01
    That is what i was confused about. How will the C program do that? i understand
    from what u said that the c program would send the bytes to the serial port, and
    the stamp which is listening to the serial port would download it as soon as the
    data is sent? Do you happen to know how the C program would open and send bytes
    to serial port? Or maybe i should look at C reference if thats the only problem
    left in this case. I have never handled communication programs before. So this
    means that the control actually never leaves my C program? And I would initially
    download the program Tracy has given below on to my BS2? Does this BS2 program
    return control to the C code once its done?
    The robot would run using the new set of ones and zeros as soon as the C program
    sends them to the serial port? And then after the robot runs, the next line in
    the C code would be executed normally? If that is so, its great once i get the
    communication part.
    To summarize, So I can always then send the fixed set of ones and zeros (that is
    generated by the scheme) to the serial port (using the C program), and this
    pretty much takes care of the scenario?
    thanks, amul
    Jon Williams <jwilliams@p...> wrote: You need to have to have
    your C program open a serial port and send the
    bytes to the Stamp -- there's no need to go through another program.
    When using the Stamp's programming port for serial input, you'll set the
    pin to 16 as Tracy demonstrated in his example below.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office



    Original Message
    From: Vimal Vishwanathan [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=WTgCtgpOFUFSR8BlttLrAjBvXaQp32lqCxUgun_PsP19XtCWmmR2Tw3sYDnnpl1GyREN4fpTTBnBl4xh]vimal222@y...[/url
    Sent: Friday, October 24, 2003 3:33 PM
    To: basicstamps@yahoogroups.com
    Subject: RE: [noparse][[/noparse]basicstamps] Re: command line interface


    Hi Tracy
    If i use the first approach (since it seems simpler), how exactly would
    the 'C' program call the BS2 program? That is, how would it send those
    'new' set of ones and zeros to the BS2 code and downloads it to the
    stamp? And which line in the BS2 program you mentioned below is
    'listening' to this 'C' program? I just need a fixed set of ones and
    zeros in the BS2 at a time. When the next set arrives, it should
    overwrite this old set and run the robot with the new set. Then the
    control should return to the C program so that it can compute the
    distance moved by the robot with this new set.
    You might already have explained this in your program, and i might have
    missed it.

    amul

    Tracy Allen wrote:
    You don't have to tokenize anything if you are simply transferring
    data. Suppose you have the sequences of 0s and 1s in a file that is
    generated on your PC as a sequence of bytes, where bit 1 is for leg
    1, bit 2 for leg 2 and so on, and bits 0 and 7 will always be zeros
    (until you add two more legs!). Then the sequence your PC generates
    will be,
    00000110
    00000000
    00000010
    00000000
    00000110
    00000000
    00000100
    00000010
    00000101
    00000000
    11111111

    and so on, for example. Maybe all 1s might mean, "End of sequence".

    Anyway, the program in the Stamp would look something like this:

    cmd var byte
    chr var byte
    ndx var word

    initialize:
    'whatever

    Command_processor:
    SERIN 16,$54,5000,[noparse][[/noparse]WAIT ("GA",cmd] wait for prefix "GA" + command from
    PC LOOKDOWN cmd, [noparse][[/noparse]"RC"], ndx ' "R" for run, "C" for configure BRANCH
    ndx, [noparse][[/noparse]Running, Configuring]

    Running: ' play the sequence stored in eeprom
    ndx=0 ' start at 0 in eeprom
    DO
    READ ndx,chr
    IF chr=%11111111 THEN
    ' move the legs according to chr
    ndx=ndx+1
    LOOP
    ' do whatever at the end of sequence, repeat, stop, etc
    STOP

    Configuring: ' capture sequence codes from PC.
    ndx=0 ' start at 0 in eeprom
    DO
    SERIN 16,$54,5000,error_receive,[noparse][[/noparse]chr]
    WRITE ndx,chr
    ndx=ndx+1
    LOOP UNTIL chr=%11111111
    ' finished with upload
    ' a CRC might be a good idea
    ' return to command processor, or just RUN
    ' ???
    GOTO Command_processor


    Error_Receive:
    ' ring a bell or send a code back to PC
    stop

    The Stamp has to WRITE bytes to eeprom one at a time, which takes up
    to 10 milliseconds per byte (usually 3 to 5), so the PC would have to
    pace its transmission. Or you could implement a software or hardware
    flow control scheme.

    If you are using a Stamp 2p or 2pe, you have lots of eeprom available
    for storage in the extra banks (16k in the BS2p, 32k in the BS2pe).
    It is not so convenient to access the extra data banks in the BS2sx
    or BS2e. If you have an original BS2, you have to be careful that
    your data does not overwrite the program. In the Stamp, data is
    stored from address 0 up in eeprom, while program is stored from
    address 2047 down.

    There is another approach to transferring data, which uses the native
    programming algorithm of the Stamp. It would only be writing blocks
    of data, not the program blocks. The advantage of this is that it is
    very fast. It uses block level eeprom programming, and the protocol
    includes a handshake for flow control. If you do that, your Stamp
    program only has to play back the sequence, not to load it. However,
    you would need to implement the programming protocol on your PC. It
    is not hard. The protocol is described in the Parallax programmers
    docs, and also here on my web site:
    http://www.emesystems.com/BS2clone.htm

    -- Tracy





    >Hi Tracy,
    >The sequence generated by the GA is just a set of ones and zeros
    >that would describe the direction that each leg of the robot(4 or 6
    >legs) moves by. so this would look something like
    >
    >100010101000
    >101010010100
    >
    >It is possible to load new sequence data into a Stamp _without_
    >invoking the tokenizer. The BASIC Stamp can be programmed to accept
    >commands from your C program, one of which would be to accept the new
    >sequence data, and another would be to "play" the sequence.
    >
    >The problem is we do not know this sequence in advance because the
    >scheme code generates it after every run. Every run is made only
    >after the robot moves with a particular set of ones and zeros, and
    >then the distance moved is measured and fed back into the scheme
    >program. The scheme code does not generate the next set UNTIL we
    >feed this distance moved number. That is why we do not know the
    >whole set in advance. How would we load the new sequence every time
    >without using tokenizers?
    >
    >i hope that clarifies my questions.
    >
    >amul
    >
    >
    >
    >
    >
    >Tracy Allen wrote:
    >>Yeah, as u said the possibilities are infinite potentially, but its
    >>one at a time. The scheme GA generates the set of ones and zeros for
    >>every run of the GA. We then feed this to the controller (the C
    >>program has to do this with the help of the tokenizer library? ) and
    >>run it every time. so would the 'tokenizer library' help in this
    >>process?
    >
    >Like others here, I think I'm confused about what you are trying to
    >accomplish. It sounds kind of like the "ones and zeros for every run of

    >the GA" is something like a sequence or a tape recording or a scheme
    >that the Stamp has to play back. For example, to be simple, it might be

    >a sequence of ones and zeros that have to be played back with one
    >second timing on pin P0 of the Stamp: 110000010001000.....
    >
    >You could write each possible sequence of 1s and 0s as a separate
    >program and then reprogram the Stamp each time you need a new sequence,

    >and to do that from your C program you would need the tokenizer.
    >
    >Or, you could have one single Stamp program that "plays" the sequence.
    >It is possible to load new sequence data into a Stamp _without_
    >invoking the tokenizer. The BASIC Stamp can be programmed to accept
    >commands from your C program, one of which would be to accept the new
    >sequence data, and another would be to "play" the sequence.
    >
    >What sort of sequence is "every run of the GA"?
    >
    >-- Tracy
    >
    >
    >
    >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/
    >
    >
    >
    >
    >Do you Yahoo!?
    >The New Yahoo! Shopping - with improved product search
    >
    >[noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    >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/


    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/



    Do you Yahoo!?
    The New Yahoo! Shopping - with improved product search

    [noparse][[/noparse]Non-text portions of this message have been removed]


    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....


    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/



    Do you Yahoo!?
    The New Yahoo! Shopping - with improved product search

    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-25 02:08
    But when the C program communicates with serial port, should we time it for 10ms
    for every byte written...ie we wait for 10ms after sending 1 byte to serial
    port? Is that called implementing a 'software flow control scheme' as mentioned
    by Tracy? Can I get how to do that by reading a C reference on that or does it
    require more knowledge than the typical C that a student would know? can u
    suggest links/books for that?

    amul

    Allan Lane <allan.lane@h...> wrote:
    The actual line that 'listens' is the
    SERIN line below. The syntax he's using has
    it wait for input for 5 seconds (5000 milliseconds)
    -- if no input comes in during that time, the program
    goes on.


    --- In basicstamps@yahoogroups.com, "Jon Williams"
    wrote:
    > You need to have to have your C program open a serial port and send
    the
    > bytes to the Stamp -- there's no need to go through another program.
    > When using the Stamp's programming port for serial input, you'll
    set the
    > pin to 16 as Tracy demonstrated in his example below.
    >
    > -- Jon Williams
    > -- Applications Engineer, Parallax
    > -- Dallas Office
    >
    >
    >
    >
    Original Message
    > From: Vimal Vishwanathan [noparse][[/noparse]mailto:vimal222@y...]
    > Sent: Friday, October 24, 2003 3:33 PM
    > To: basicstamps@yahoogroups.com
    > Subject: RE: [noparse][[/noparse]basicstamps] Re: command line interface
    >
    >
    > Hi Tracy
    > If i use the first approach (since it seems simpler), how exactly
    would
    > the 'C' program call the BS2 program? That is, how would it send
    those
    > 'new' set of ones and zeros to the BS2 code and downloads it to the
    > stamp? And which line in the BS2 program you mentioned below is
    > 'listening' to this 'C' program? I just need a fixed set of ones
    and
    > zeros in the BS2 at a time. When the next set arrives, it should
    > overwrite this old set and run the robot with the new set. Then the
    > control should return to the C program so that it can compute the
    > distance moved by the robot with this new set.
    > You might already have explained this in your program, and i might
    have
    > missed it.
    >
    > amul
    >
    > Tracy Allen wrote:
    > You don't have to tokenize anything if you are simply transferring
    > data. Suppose you have the sequences of 0s and 1s in a file that is
    > generated on your PC as a sequence of bytes, where bit 1 is for leg
    > 1, bit 2 for leg 2 and so on, and bits 0 and 7 will always be zeros
    > (until you add two more legs!). Then the sequence your PC generates
    > will be,
    > 00000110
    > 00000000
    > 00000010
    > 00000000
    > 00000110
    > 00000000
    > 00000100
    > 00000010
    > 00000101
    > 00000000
    > 11111111
    >
    > and so on, for example. Maybe all 1s might mean, "End of sequence".
    >
    > Anyway, the program in the Stamp would look something like this:
    >
    > cmd var byte
    > chr var byte
    > ndx var word
    >
    > initialize:
    > 'whatever
    >
    > Command_processor:
    > SERIN 16,$54,5000,[noparse][[/noparse]WAIT ("GA",cmd] wait for prefix "GA" + command
    from
    > PC LOOKDOWN cmd, [noparse][[/noparse]"RC"], ndx ' "R" for run, "C" for configure BRANCH
    > ndx, [noparse][[/noparse]Running, Configuring]
    >
    > Running: ' play the sequence stored in eeprom
    > ndx=0 ' start at 0 in eeprom
    > DO
    > READ ndx,chr
    > IF chr=%11111111 THEN
    > ' move the legs according to chr
    > ndx=ndx+1
    > LOOP
    > ' do whatever at the end of sequence, repeat, stop, etc
    > STOP
    >
    > Configuring: ' capture sequence codes from PC.
    > ndx=0 ' start at 0 in eeprom
    > DO
    > SERIN 16,$54,5000,error_receive,[noparse][[/noparse]chr]
    > WRITE ndx,chr
    > ndx=ndx+1
    > LOOP UNTIL chr=%11111111
    > ' finished with upload
    > ' a CRC might be a good idea
    > ' return to command processor, or just RUN
    > ' ???
    > GOTO Command_processor
    >
    >
    > Error_Receive:
    > ' ring a bell or send a code back to PC
    > stop
    >
    > The Stamp has to WRITE bytes to eeprom one at a time, which takes
    up
    > to 10 milliseconds per byte (usually 3 to 5), so the PC would have
    to
    > pace its transmission. Or you could implement a software or
    hardware
    > flow control scheme.
    >
    > If you are using a Stamp 2p or 2pe, you have lots of eeprom
    available
    > for storage in the extra banks (16k in the BS2p, 32k in the BS2pe).
    > It is not so convenient to access the extra data banks in the BS2sx
    > or BS2e. If you have an original BS2, you have to be careful that
    > your data does not overwrite the program. In the Stamp, data is
    > stored from address 0 up in eeprom, while program is stored from
    > address 2047 down.
    >
    > There is another approach to transferring data, which uses the
    native
    > programming algorithm of the Stamp. It would only be writing blocks
    > of data, not the program blocks. The advantage of this is that it
    is
    > very fast. It uses block level eeprom programming, and the protocol
    > includes a handshake for flow control. If you do that, your Stamp
    > program only has to play back the sequence, not to load it.
    However,
    > you would need to implement the programming protocol on your PC. It
    > is not hard. The protocol is described in the Parallax programmers
    > docs, and also here on my web site:
    > http://www.emesystems.com/BS2clone.htm
    >
    > -- Tracy
    >
    >
    >
    >
    >
    > >Hi Tracy,
    > >The sequence generated by the GA is just a set of ones and zeros
    > >that would describe the direction that each leg of the robot(4 or
    6
    > >legs) moves by. so this would look something like
    > >
    > >100010101000
    > >101010010100
    > >
    > >It is possible to load new sequence data into a Stamp _without_
    > >invoking the tokenizer. The BASIC Stamp can be programmed to
    accept
    > >commands from your C program, one of which would be to accept the
    new
    > >sequence data, and another would be to "play" the sequence.
    > >
    > >The problem is we do not know this sequence in advance because the
    > >scheme code generates it after every run. Every run is made only
    > >after the robot moves with a particular set of ones and zeros, and
    > >then the distance moved is measured and fed back into the scheme
    > >program. The scheme code does not generate the next set UNTIL we
    > >feed this distance moved number. That is why we do not know the
    > >whole set in advance. How would we load the new sequence every
    time
    > >without using tokenizers?
    > >
    > >i hope that clarifies my questions.
    > >
    > >amul
    > >
    > >
    > >
    > >
    > >
    > >Tracy Allen wrote:
    > >>Yeah, as u said the possibilities are infinite potentially, but
    its
    > >>one at a time. The scheme GA generates the set of ones and zeros
    for
    > >>every run of the GA. We then feed this to the controller (the C
    > >>program has to do this with the help of the tokenizer library? )
    and
    > >>run it every time. so would the 'tokenizer library' help in this
    > >>process?
    > >
    > >Like others here, I think I'm confused about what you are trying
    to
    > >accomplish. It sounds kind of like the "ones and zeros for every
    run of
    >
    > >the GA" is something like a sequence or a tape recording or a
    scheme
    > >that the Stamp has to play back. For example, to be simple, it
    might be
    >
    > >a sequence of ones and zeros that have to be played back with one
    > >second timing on pin P0 of the Stamp: 110000010001000.....
    > >
    > >You could write each possible sequence of 1s and 0s as a separate
    > >program and then reprogram the Stamp each time you need a new
    sequence,
    >
    > >and to do that from your C program you would need the tokenizer.
    > >
    > >Or, you could have one single Stamp program that "plays" the
    sequence.
    > >It is possible to load new sequence data into a Stamp _without_
    > >invoking the tokenizer. The BASIC Stamp can be programmed to
    accept
    > >commands from your C program, one of which would be to accept the
    new
    > >sequence data, and another would be to "play" the sequence.
    > >
    > >What sort of sequence is "every run of the GA"?
    > >
    > >-- Tracy
    > >
    > >
    > >
    > >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/
    > >
    > >
    > >
    > >
    > >Do you Yahoo!?
    > >The New Yahoo! Shopping - with improved product search
    > >
    > >[noparse][[/noparse]Non-text portions of this message have been removed]
    > >
    > >
    > >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/
    >
    >
    > 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/
    >
    >
    >
    >
    > Do you Yahoo!?
    > The New Yahoo! Shopping - with improved product search
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    > 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...


    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/



    Do you Yahoo!?
    The New Yahoo! Shopping - with improved product search

    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-25 03:01
    amul,

    This aspect of you project is serial port communication, and as
    such, your C reference manual will not help much.

    You might want to start reading up on serial port communication:
    there are examples at several of Stamp-oriented sites:

    Jan Axelson: http://lvr.com/serport.htm (lots of information)
    Parallax:
    http://www.parallax.com/html_pages/downloads/nvcolumns/Nuts_Volts
    _Downloads.asp
    Tracy Allen: http://www.emesystems.com/BS2index.htm
    Al Williams: http://www.faq-pro.com/faq/
    http://www.google.com has lots more, if you want...

    I suggest that you program your mock-up your application--write
    the Stamp program, put LEDs on instead of robot legs, and connect
    to it with a serial terminal emulator. Then type the strings of
    1's and 0s, and observe the simulated robot motion--watch the
    LEDs twinkle. Maybe you also want to have the Stamp connected to
    another PC so that you can see DEBUG statement output to help
    work out the difficulties of receiving the serial data. But
    maybe you've already done this.

    Then write a simple serial communications program that sends a
    similar stream of 1's and 0's to the serial port. Watch the LEDs
    twinkle some more. The links above will all help you on your
    way. Make sure that you get this part understood, as the your
    goal depends on this working correctly.

    After that, apply the techniques from the simple serial
    communications program to your robot control program, and watch
    the LEDs some more.

    Finally, reconnect the robot's legs back to the Stamp, and drive
    your robot.

    HTH,
    Daniel

    >
    Original Message
    > From: Vimal Vishwanathan [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=8Ucv2XR67bdNKdzUTIH_THYOn0_KzHFwQLoPXSiBpaJIHDQP8vpFDkEvtdFb0Ni_U2vlrJqAg326GMWgjA]vimal222@y...[/url
    > Sent: Friday, October 24, 2003 9:08 PM
    > To: basicstamps@yahoogroups.com
    > Subject: Re: [noparse][[/noparse]basicstamps] Re: command line interface
    >
    >
    > But when the C program communicates with serial port,
    > should we time it for 10ms for every byte written...ie
    > we wait for 10ms after sending 1 byte to serial port?
    > Is that called implementing a 'software flow control
    > scheme' as mentioned by Tracy? Can I get how to do
    > that by reading a C reference on that or does it
    > require more knowledge than the typical C that a
    > student would know? can u suggest links/books for that?
    >
    > amul
    >
Sign In or Register to comment.