Shop OBEX P1 Docs P2 Docs Learn Events
Using VB to control BS2 pins — Parallax Forums

Using VB to control BS2 pins

ArchiverArchiver Posts: 46,084
edited 2000-10-11 20:56 in General Discussion
Hi,
I was wondering if anyone knew how to select a specific pin using the
VB comm port. I have already setup the comm port settings.
Also how would one send a value to that pin on the Basic Stamp.
Thanks
Alan

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-10-11 20:55
    In Microcontroller Projects with Basic Stamps there is a VB Class Module
    that "duplicates" the Stamp functions in VB (like PULSOUT, SHIFTIN, etc.).
    It uses MSCOMM to send commands (and receive responses) from the Stamp. So
    you can connect a Stamp to your serial port and use this class module to
    write "Basic Stamp-like" programs all in VB.

    http://www.al-williams.com/awce/sbook.htm

    Regards,

    Al Williams
    AWC
    * Control 8 Servos at once: http://www.al-williams.com/awce/pak8.htm


    >
    Original Message
    > From: alan_correia@h... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=ktTPLfRE4I9-cS6pQ1_kUmSesTVaey5iGJKq5CkhLPROF5u3ob6p57OppqwV8BbXTXgMAqSMwHD9o3-KpdNuSU1WAg]alan_correia@h...[/url
    > Sent: Wednesday, October 11, 2000 12:05 PM
    > To: basicstamps@egroups.com
    > Subject: [noparse][[/noparse]basicstamps] Using VB to control BS2 pins
    >
    >
    > Hi,
    > I was wondering if anyone knew how to select a specific pin using the
    > VB comm port. I have already setup the comm port settings.
    > Also how would one send a value to that pin on the Basic Stamp.
    > Thanks
    > Alan
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2000-10-11 20:56
    Alan,

    VB won't select a specific pin on the Stamp. You use the Stamps
    SERIN command to do this, IE,, SERIN 0. This selects the serial
    input pin of the Stamp.

    When using VB or other PC software to control the serial port, data
    will go out (to the Stamp) or other device on pin #3 TXD of the PC
    serial port. Data coming to the PC serial port arrives on pin #2 RXD.

    Here's a schematic showing how to connect the Stamp to the PC serial
    port: http://www.rentron.com/pc-relay.htm Use the 22K resistor as shown
    in the schematic to connect your Stamp to the PC serial port. Be sure to
    connect pin #5 (signal ground) of the serial port to the Stamps circuit ground
    also.

    In VB you can have the form load initialize the com port settings as such:

    Private Sub Form_Load()
    MSComm1.Settings = "9600,N,8,1"
    MSComm1.CommPort = 1
    MSComm1.PortOpen = True
    End Sub

    The baud rate is set to 9600,N,8,1 and the port is opened for use.

    To send data out the PC serial port to the Stamp:

    Private Sub Command1_Click()
    MSComm1.Output = Chr$(255)
    End Sub

    This assumes you have dropped a command button onto your form in VB.
    This button will now send the value 255 to the serial port, and to the Stamp
    I/O-pin you have selected using the SERIN,? command.

    Be sure to use the same baud rate with the serin command, and you're
    in business.

    Regards,

    Bruce
    webmaster@r...

    Original Message
    From: <alan_correia@h...>
    To: <basicstamps@egroups.com>
    Sent: Wednesday, October 11, 2000 11:04 AM
    Subject: [noparse][[/noparse]basicstamps] Using VB to control BS2 pins


    | Hi,
    | I was wondering if anyone knew how to select a specific pin using the
    | VB comm port. I have already setup the comm port settings.
    | Also how would one send a value to that pin on the Basic Stamp.
    | Thanks
    | Alan
    |
    |
    |
    |
    |
Sign In or Register to comment.