Shop OBEX P1 Docs P2 Docs Learn Events
Record Data from many basic stamp 2 to one PC — Parallax Forums

Record Data from many basic stamp 2 to one PC

MaliokMaliok Posts: 3
edited 2004-09-21 22:03 in BASIC Stamp
Dear Everyone blush.gif ,

First if all, i'd like thanks for helping me.
I wanna ask about:

1. How to send data to 1 PC for storing data with the write code at certain of memory location at the basic stamp2 which is data is stored at one location to the other sequential location that we want to send.

2. If the data had already sent, how to send the rest of data in memory location after the last data had been sent to the 1 PC.

3. At the PC side, how to access many basic stamp 2 microcontrollers (for example 2) with visual basic 6 program and how to recoqnize request from 1 PC at BS2.

Sincerely
Ali

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-09-20 15:31
    I'm not sure I understand you firs two questions, but as for the third, you will need some sort of multi-drop network and a messaging protocol that allows either side of the conversation to "identify" the slave (BASIC Stamp) units. Let me suggest Jan Axelson's book "Serial Port Complete" which you can read about at www.lvr.com. Jan has several networking examples and lots of very useful VB code in her book.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • K de JongK de Jong Posts: 154
    edited 2004-09-20 16:14
    Ali,

    I think polling the Bsic Stamps will be much easier. In that case you have the PC calling ech of the Stamps, one at the time, and ask for the latest data. So in effect the PC will be the master and the Stamps the slaves.

    This way you have no conflicts when two Stamps try to connect to the PC.

    From the hardware side you normally have two independent serial ports, sometimes four. You could overcome this problem by using relays controlled by the PC. But I'm sure tere is a better, more elegant way to do this.

    These are my first idea's, maybe more at a later time smile.gif.

    Regards,

    Klaus
  • MaliokMaliok Posts: 3
    edited 2004-09-21 16:50
    Thanks for the answer. I'll try. But Before I want to record data from many basic stamps. I want record data from one basic stamp2 to the 1 PC, could you tell me:

    1. At the Basic Stamp2, how to send storing data in EEPROM at range of memory location. The data is stored at one location to the other sequential location using write code.

    2. If the data had already sent, how to send the rest of data in memory location after the last data had been sent to the PC.

    For Example: I had store the data at location 00-08 and then I want to send data at location 00-03 to PC. How I can do that? If the data at 00-03 had been sent to the PC, how to send the rest data (04-08).

    Thanks
  • K de JongK de Jong Posts: 154
    edited 2004-09-21 22:03
    Hi Maliok,

    Look at the piece of code below. It is a loop where the Stamp waits for the right command fom the PC and then fetches and sends a block of data of size SIZE to the PC.

    Work with blocks of data, do not make it too difficult for yourself by trying to send some bytes here and then a byte from overthere. It is not going to work that way.

    I have this type of code running on a couple of Stamps and I can have 2 running simultaneously. One on COM 1 and one on COM 2. They handle quite large amound of data (up to 30 kBytes), no conflicts !!

    I hope this helps a bit,

    Klaus

    //////////////////////////////////////////////
    Declarations etc

    LabelStart:

    SERIN Tx,BAUD,TimeOut,LBL,[noparse][[/noparse]WAIT("S"),CommandByte]

    IF CommandByte= something THEN GOSUB ReadAndSendData
    ELSEIF CommandByte= somethingelse THEN GOSUB somethingelse
    .....
    ENDIF



    LBL:
    GOTO LabelStart

    ReadAndSendData:
    FOR idx=0 TO SIZE-1
    READ MEMCOUNT*(SIZE)+idx, ByteVar
    SEROUT PC,BAUD,[noparse][[/noparse]DEC UniByte," ",DEC ByteVar," "]
    NEXT
    MEMCOUNT=MEMCOUNT+1
    RETURN
Sign In or Register to comment.