Basic Stamp and Visual Basic
NWUpgrades
Posts: 292
This may not be the correct forum to ask this, but I will try any how. Does anyone know how to use Visual Basic to connect to my Basic 2 Stamp via the Serial Port? In other words, I wantto use Visual Basic to do my programming instead of PBasic. I just need to be able to open the serial port from Visual Basic. Thanks for any help.
Comments
try this:
http://www.developerfusion.co.uk/show/21/
to get you started. as far as actually working with your BS2 with the pc serial port, i can offer little help. but the coding side of vb6 comm is pretty easy to research.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
**************
daniel woolston
Teksystems Inc.
www.danwoolston.com
**************
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
To do what you want:
Write a program in PBASIC that receives serial data and outputs pulses to the stepper motors.
Download that program into the stamp.
Now write a VB program to send the serial data that the PBASIC program is looking for.
I think you use (virtual) PIN 16 for the programming serial port.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video Display Module" Available Now.
www.sxvm.com
"A problem well defined, is a problem·half solved."
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
You can use your VB GUI with ANY BS2-family module.· The key is writing code on your BASIC Stamp such that it will adjust the SERIN/SEROUT baudmode parameters for any module that you use.· My standard template (attached and updated for the BS2px) has the constants used for the most popular serial baud rates.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
1. When you use SERIN 16, 16384, [noparse][[/noparse]DEC MyValue]
You are reading from the port that the PC uses for programming. The 'mythical' pin 16 is used to indicate to the BS2 that it should use the programming port.
2. You want to create your GUI in Visual Basic. This GUI should have a part which talks to the BS2. This part should use the MSCOMM control, to talk to the PC's serial port, which you'll have connected to the BS2 DB-9 connector.
3.· The attached ZIP file contains two programs.· The VB side is how VB should be configured to work with the BS2 on a serial port.· The BS2 side is how the BS2 can listen and respond to a VB program.
It includes instructions on the VB side on how to add the MSCOMM control to your VB project.
(I'm one of those people a little mad with Microsoft's decision to maroon VB6 in favour of VB.Net!).
-marc
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
and i like microsoft. i think they rock. any company that throws as much into developers and research in general, is o.k. in my book. and my kids get to eat each week because daddy makes software with microsoft products. [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
**************
daniel woolston
Teksystems Inc.
www.danwoolston.com
**************