Visual Basic Express
Microman171
Posts: 111
Hi I'm using the new (free) visual basic express edition and I want to know how I can interface with my BS2 so I can control realys ect... How should I go about this??
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
1 + 1 = Window
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
0............................................0
0............................................0
0.(Microman171@hotmail.com)..0
0............................................0
0............................................0
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
1 + 1 = Window
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
0............................................0
0............................................0
0.(Microman171@hotmail.com)..0
0............................................0
0............................................0
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Comments
You will need to establish an asynchronous serial (RS-232) link between the two platforms. The necessary commands on the Basic Stamp side are SERIN and SEROUT. Since there is no true and established data transmission methodology or protocal, you will need to define your own, or just do it by the knowledge of the order of the data sent back and forth.
This presumes, of course, that Visual Basic Express has asynchronous serial (RS-232) capability, and I have no idea whether that is true or not. I would look at the listed features of Visual Basic Express to try and determine that.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
1 + 1 = Window
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
0............................................0
0............................................0
0.(Microman171@hotmail.com)..0
0............................................0
0............................................0
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
You should start small and work your way to bigger and better. You will have a lot to accomplish, since you will have to do the programming on both the PC and the BS2. That being said, here are some pointers:
1. Choose a realistic project
Start with something small. The techniques that you learn will be the building blocks for larger projects.
2. Plan, Plan, Plan, Plan, Plan...
The better you plan things before starting, the easier it will be to finish successfully. Write down ideas on paper, revise your ideas, write out the steps necessary, build flowcharts, etc. This is also where you will do your research for the project.
3. Break the project down into smaller steps
Create an outline for the steps involved.
4. Tackle the project one step at a time
Follow your outline.
5. Stick to the plan, unless the plan is unworkable for technical reasons
Don't get sidetracked by other ideas that may come up. Write down the ideas, but leave them for later.
6. Once the project is working, you can then look at ways to improve it
There might be several different ways t get the desired results, some better than others. Once the project is finished and working, if you want to revise it for better performance, expandability, etc, go ahead. As you gain practical experience, you will learn which techniques work best in various situations.
The project that you suggested was a bit vague, there are hundreds, thousands, etc. of things you could do by interfacing VB Express with a BS2. So here is a simple project idea to get you started.
Project
Create a Visual Basic .Net program that will send and receive ASCII text messages to / from the BS2 Homework board. The messages should be simple text messages of a few words or so. The BS2 will receive the message, and reply with “The message you sent is: <insert your message here>”, which will echo your message.
This may seem like a trivial project, but here's what's involved:
For Visual Basic .Net
Succesfully install and configure the VB IDE
Design your VB project
Create your VB project in the IDE
Build a VB user form with all of the necessary controls for: text input, text output, and RS-232 communications
Build and compile your VB program
Deploy your program
Test your program
Debug your program
For the BS2 Homework Board:
Succesfully install and configure the Basic Stamp IDE
Design your BS2 project
Create your BS2 project
Create a BS2 program that will send and receive ASCII text messages via RS-232
Compile your BS2 program
Deploy your program
Test your program
Debug your program
One possible way to break this up into small steps would be to first get your BS2 communication with Hyperterminal. This should give you a basic framework for communication with your BS2 program. Then build your VB form, again communicationg with Hyperterminal. Once this is done, determine where you need to modify your code to interface VB and the BS2.
The reason for using Hyperterminal is to use a known working program to eliminate possible bugs on either side of your interface. Trying to create the VB & BS2 programs simultaneously would make it difficult to determine where the problem is if it’s not working right.
Once you have finished this project, you should have good experience to build upon for later projects.
Here are some more pointers:
1. The only thing you need to interface your HW board to your PC is the serial cable that you use for programming the BS2. If you can get the BS2 to send a debug message to the debug terminal, you are well on your way. Then work on communicating with Hyperterminal using the SEROUT and SERIN commands.
2. There might only be a couple of pins not easily accessed on the Homework board, but all of your I/Os are easily accessed. If you want to do sreial comms on the I/O pins, you will have to build an interface circuit, but you can use the default serial port via your serial cable.
3. Visual Basic Express 2005 should contain a control in the toolbox for serial communications. This is one of the controls you will need. Other controls needed will depend on your form layout. You will basically need a box to input your message, a box to display the return from the BS2, and a button to send your message. Use the serial comms control to configure your interface.
And Ken
I have got all my idea for a start i want:
1: The basic stamp sends "READY" to the VB window
2: you now have a button active to push. So you push it
3: The LED on the Basic stamp I/O port lights
4: The basic stamp sends done to the VB window
5: You quit everything and start again if desired
Some basic hello (in the VB window) on the push of a VB button from the basic stamp would be coolif you could show me so I could build my project
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
1 + 1 = Window
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
0............................................0
0............................................0
0.(Microman171@hotmail.com)..0
0............................................0
0............................................0
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Post Edited (Microman171) : 1/17/2006 8:41:13 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
1 + 1 = Window
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
0............................................0
0............................................0
0.(Microman171@hotmail.com)..0
0............................................0
0............................................0
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
msdn.microsoft.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
1 + 1 = Window
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
0............................................0
0............................................0
0.(Microman171@hotmail.com)..0
0............................................0
0............................................0
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Post Edited (Microman171) : 1/19/2006 5:30:57 AM GMT