Shop OBEX P1 Docs P2 Docs Learn Events
Integrating BS2p and VB — Parallax Forums

Integrating BS2p and VB

kuskowskikuskowski Posts: 17
edited 2006-10-24 12:34 in BASIC Stamp
I·have·most of it integration working good but the only problem I'm having is reading the code coming from the stamp·into Visual Basic.· Does anyone have any examples of an easy way to accomplish this?

Thanks,

Justin

Comments

  • RobbanRobban Posts: 124
    edited 2006-10-23 17:38
    what type of data are you trying to send to VB?
    i found a a page that has done this very simple

    http://www.rentron.com/receiving_data.htm

    good luck!

    may the stamp be with you smile.gif
  • Beau SchwabeBeau Schwabe Posts: 6,559
    edited 2006-10-23 18:05
    kuskowski,

    Are you setting the DTRenable to False within VB?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • kuskowskikuskowski Posts: 17
    edited 2006-10-24 10:57
    Beau Schwabe (Parallax) said...
    kuskowski,

    Are you setting the DTRenable to False within VB?
    correct it is false...
  • kuskowskikuskowski Posts: 17
    edited 2006-10-24 11:14
    START
    PC --> Waiting to send commands
    BS2 --> Waiting to receive commands
    PC --> Send request for permission to transmit command sequence
    BS2 --> Grant permission to send command sequence, await MainCommand
    PC --> Send MainCommand
    BS2 --> Acknowledge receiving MainCommand, await SubCommand
    PC --> Send SubCommand
    BS2 --> Acknowledge receiving SubCommand, process command sequence
    ...

    This is what the code looks like in VB..

    VB:

    SerialPort1.Write("Sending_Command1") 
    SerialPort1.Write(Command1) 
    
    Try 'Request 2nd command 
       SerialPort1.Read(b, 0, 20) 
    
       If SerialPort1.BytesToRead <> 0 Then 
          MessageBox.Show("Got some data!") 
       End If 
       Catch ex As Exception 
    End Try 
    
    SerialPort1.Write("Send_Command2") 
    SerialPort1.Write(Command2) 
    
    Try 'Request 3nd command 
       SerialPort1.Read(b, 0, 20) 
    
       If SerialPort1.BytesToRead <> 0 Then 
          MessageBox.Show("Got some data!") 
       End If 
       Catch ex As Exception 
    End Try 
    
    SerialPort1.Write("Send_Command3") 
    SerialPort1.Write(Command3)
    
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-10-24 12:14
    Note, if you're writing to the 'programming port', aka "port 16" on the BS2, then everything will be 'echoed' back to your VB program by the BS2 hardware, THEN the BS2 response will be sent to you.
  • kuskowskikuskowski Posts: 17
    edited 2006-10-24 12:34
    :SIDE NOTE:

    I plan on going to BlueTooth, I have the AppMod Bluetooth and right now I am using port 0
Sign In or Register to comment.