Shop OBEX P1 Docs P2 Docs Learn Events
Getting Basic Stamp ID via VB2010 — Parallax Forums

Getting Basic Stamp ID via VB2010

raybrandlraybrandl Posts: 2
edited 2011-05-23 19:15 in BASIC Stamp
I was working on a project that includes all COMM Ports but am having a hard-time getting the the proper ID or Device Type to show. What I'm looking for is a way to show which port has the BS2 much like the compiler found when programming the Stamp.

The code that I've written so far was all done in VB 2010. Any guidance or suggestions would be greatly appreciated.

Here is the code so far. It's not much but I've tried several different methods to get additional information from the stamp with little success.

' Get a list of serial port names.
Dim ports As String() = SerialPort.GetPortNames()

' Show a label with Action information on it
lblComFound.Text = "The following serial ports were found:"

' Put each port name Into a comboBox control.
Dim port As String
For Each port In ports
cmbo1.Items.Add(port).ToString()
Next port
' Select the first item in the combo control
cmbo1.SelectedIndex = 0

It would be great to get not only the device type but version, loopback and echo at the same time.

Comments

  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2011-05-20 16:44
    Hi , the following link will take you to a page that contains the Tokenizer documentation. The Tokenizer documentation details data expected to be sent and received when identifying a BS2 module. Each module is identified with a different string and in some cases at a different baud rate.

    http://www.parallax.com/tabid/441/Default.aspx

    The following is a working snippet I used at one time for the standard BS2
    Private Sub reset()
            _port.ReadExisting()
            _port.DtrEnable = True
            Thread.Sleep(8)
            _port.DtrEnable = False
            _port.BreakState = True
            Thread.Sleep(52)
            _port.BreakState = False
            Thread.Sleep(10)
            _port.ReadExisting()
        End Sub
    
    Public Sub ID_BS2()
            _port.Write("B")
            TextBox1.Text = TextBox1.Text & Chr(_port.ReadByte())
            TextBox1.Text = TextBox1.Text & _port.ReadByte() & " "
           
            _port.Write("S")
    
            TextBox1.Text = TextBox1.Text & Chr(_port.ReadByte()) & " "
            TextBox1.Text = TextBox1.Text & _port.ReadByte() & " "
            
            _port.Write(2)
    
            TextBox1.Text = TextBox1.Text & Chr(_port.ReadByte()) & " "
            TextBox1.Text = TextBox1.Text & _port.ReadByte() & " "
           
            _port.Write(Chr(0))
    
    
            TextBox1.Text = TextBox1.Text & _port.ReadByte() & " "
            TextBox1.Text = TextBox1.Text & _port.ReadByte() & " "
           
    
        End Sub
    

    Jeff T.
  • raybrandlraybrandl Posts: 2
    edited 2011-05-23 19:15
    Thank you Jeff. This would be what I'm looking for. I'll post my working example when done for other to use when complete.
Sign In or Register to comment.