Visual Basic and the BS2
After spending too many hours figuring out that the various free and "easy" programs out there that will interface with the BS2 cannot do what I want them to do, I surrender, I need to learn VB.
I need two-way comms between a PC and a BS2. I'd like a pretty GUI with sensor displays and the ability to send control signals.·I can do this with VB right?
So I decide to buy a copy of VB, I go to the·compUSA (gift card)·website to look around and there seems to be dozens of variants of VB for sale, grrrrrr. So, there's a steep learning curve just to figure out what version I need? I know some versions allow serial comms some don't...I don't know which.
Visual Studio 2005 Professional Edition Upgrade $359.98·, Visual Basic .NET 2003 $105.99, Visual Studio® .NET 2003 Professional $558.99, Visual Studio 2005 Professional Edition $544.99, Visual C++ .NET $105.99, Windows CE Toolkit for Visual Basic 6.0 $199.99, Microsoft Windows CE Toolkit for Visual C++ 6.0 $199.99 etc. etc.![shocked.gif](http://forums.parallax.com/images/smilies/shocked.gif)
Would someone kindly explain this to me before I go insane?
·
I need two-way comms between a PC and a BS2. I'd like a pretty GUI with sensor displays and the ability to send control signals.·I can do this with VB right?
So I decide to buy a copy of VB, I go to the·compUSA (gift card)·website to look around and there seems to be dozens of variants of VB for sale, grrrrrr. So, there's a steep learning curve just to figure out what version I need? I know some versions allow serial comms some don't...I don't know which.
Visual Studio 2005 Professional Edition Upgrade $359.98·, Visual Basic .NET 2003 $105.99, Visual Studio® .NET 2003 Professional $558.99, Visual Studio 2005 Professional Edition $544.99, Visual C++ .NET $105.99, Windows CE Toolkit for Visual Basic 6.0 $199.99, Microsoft Windows CE Toolkit for Visual C++ 6.0 $199.99 etc. etc.
![shocked.gif](http://forums.parallax.com/images/smilies/shocked.gif)
Would someone kindly explain this to me before I go insane?
·
Comments
Serial port communication is very easy to do with vb.net 2005.· Whatever you do, don't get visual studio 2003 since the .net 1 framework does not support serial port access.
Versions that have serial port:
Visual Studio 2005 - .NET 2.0·(Express, Std, Pro, Enterprise)
Visual Studio 4,5,6 (through mscomm control)
Versions that don't have serial port:
Visual Studio 2003 - .NET 1.0/1.1
Harrison
Post Edited (hpham) : 10/19/2006 2:47:27 AM GMT
Mike, I really respect your opinion since I think I've read hundreds of your posts.
I'd like to stick with a MS product because, well, I'll admit it, I like MS. If you know one MS product, you're half way there for learning the rest of them. I don't mind paying for software, as long as it's useful.
I like the looks of this version because it looks LabView-ish which I'm somewhat familiar with, do you know what version this is?http://www.controlanything.com/Merchant2/merchant.mvc?Screen=CTGY&Store_Code=NCD&Category_Code=VBASIC
I've got a $150 gift card to CompUSA, anyone care to make a specific recomendation?
I'm about done with the PBASIC code, that wasn't a problem. The PC interface is my problem.
The latest version of Visual Studio is 2005, and 2007 is in the works. The best thing you could do is to download one of the free Express editions from Microsoft's website. You'll have 4 language choices: Visual Basic, C# (C-Sharp), C++, and J# (J-Sharp). Each has it's pros/cons, but any should be able to get you moving. The VB & C# versions have some very good videos that you can also download.
Here's a link to the Express page: msdn.microsoft.com/vstudio/express/
If you have any questions concerning which to choose, just ask.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
What experience do you have of VB ? Mean if you know it since the 4th version, it has change a lot....
Visual Basic.Net isnt the same as the 4th, 5th or 6th
May be you should consider learning a new language ?
++
http://www.learn2asp.net/Campaign.aspx
I got mine back in June, this is a real deal.
Edit: Well, nevermind. It looks like the free Visual Studio offer is over.
Now all they are giving away is a 90 day trial of the professional version.
Too bad. Back in June you got the full version of Visual Studio Standard, not a download, it came in the mail in a box - 5 CDs.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Rick
Post Edited (RDL2004) : 10/19/2006 11:18:05 PM GMT
For a Visual Basic test drive, you might also consider Microsoft Excel. There is a Visual Basic shell wrapped inside of Excel that is very capable. If you have the right DLL's, you can do a lot of
the things you want to accomplish. Depending on how deep you want to get into things, you can even write your own DLL's that cater to your objective.
"I need two-way comms between a PC and a BS2. I'd like a pretty GUI with sensor displays and the ability to send control signals."
I'm pretty sure the COM can be done (I will need to look to confirm), and since Excel has many 'graph' / 'graphics capabilities' I would think you could hook into those features as well.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Beau, That's interesting about Excel, I didn't know Excel had serial communication capabilities. I've been playing with StampDAQ for a few days and I think that program may be incorporated somehow in my final product.
I downloaded the C++·and the C# version of VB (express) this morning, I'll take them for a test drive this afternoon.
I know just enough to be dangerous in the following languages since someone asked: PASCAL
I still don't undersatand exactly what VB is though, I always thought it was a language itself, I guess it isn't. It's a graphical way to use a language? That's why there's a·specific version for a specific language? Can you do more with VB C++ than you can with C++ alone? Or can you use VB C++ without actualy knowing C++?
For me hardware=fun, software=frustrating but necessary.
I also have the full version of SIMULINK, anyone know if that can be useful?
"...Beau, That's interesting about Excel, I didn't know Excel had serial communication capabilities..."
Most people aren't even aware that there is a VB editor inside Excel.· Inherently the communication capabilities
are turned off, but it looks like you can add them through "Tools-->References" under the "Visual Basic Editor".
· Edit:
I just checked, and you can add COM capabilities.· You will need 'MSCOMM32.OCX' ... for me this was located in "WINDOWS\system32"
To add this you will do it through "Tools-->References" under the "Visual Basic Editor" ... from there you will need to select "Browse..."
and go to that particular file.· This is an ActiveX control, so you will need to select the *.ocx extension under the browser menu.
Now you should be able to see it and the functions under "View-->Object Browser". Look under the new added header... "MSCommLib"
Be sure to·set the DTREnable signal to False!
····· Example:
·
······ Sending Data:
······ Receiving Data:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 10/19/2006 5:16:00 PM GMT
Visual Basic is Basic. The word Visual is a marketing term that refers to the drag and drop RAD features of the IDE. So, in a certain sense, VB is the whole RAD system, but the language is Basic. Microsoft uses the word Visual to create a brand association here; Visual C++ isn't nearly as "visual" as VB.
What you downloaded is part of Visual Studio - again, capitalizing on the word visual. VS contains several languages in one IDE. The Express versions are single language versions, but the other versions contain all of the languages.
All of the VSExpress downloads will let you do very "visual" drag and drop programming with WinForms, which is their default configuration. WinForms are part of the .Net framework, and the applications get compiled to IL VM language, which is native JIT compiled at run-time.
The only language version that will let you do native (not targeting the .Net VM) Win32 programming is Visual C++. However, to do this with the Express edition, you need to do some additional downloading and configuration. If you were serious about Visual C++ programming, it would be worth using VS standard or above for the out of the box configuration for Win32.
So, now that you've downloaded C# & C++, you'll notice that in WinForms/.Net, the development is very similar, with minor language syntax being the big difference. Of the 2 languages, C++ will give you more flexibility, but C# has better IDE support. VC++ (and VB.Net) will let you do non-OO style programming, where C# (and J#) are strictly OO languages. This may or may not make a difference,; it depends on your programming style preferences.
If you want to see three example programs, I posted a zip file in this thread:
http://forums.parallax.com/showthread.php?p=607328
It's called StampSendVS.zip. It has a VB.Net, C#, and C++ .Net versions of the same program that you can compare.
I was looking again at the freebasic fourm, seems there are still some problems with com communications but one post had this link.
http://www.serial-port-monitor.com/
I am going to investigate using freebasic for communicating with uCs I have tried freebasic for other stuff and it works pretty good.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think outside the BOX!
The above link is for the free version, this link is for the various products they offer if you need more features.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think outside the BOX!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Who says you have to have knowledge to use it?
I've killed a fly with my bare mind.
Post Edited (originator99) : 10/20/2006 1:56:44 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Who says you have to have knowledge to use it?
I've killed a fly with my bare mind.
I have been writing code since just after the earth cooled and the dinosaurs died.
I have been mainly writing in c and assembler for embedded applications for the last 10 or so.
I am using BS2s for small mobile robots and have been trying to work out how to write GUIs for PCs. I have tried Visual Studio 2005 which is just a ridiculous amount of complexity and hard disk space and memory and processing for simple applications. As I understand it, there is no "drop in" comm module so you have to scratch around the net for methods that other people have written to simmulate the VB6 comms module. I don't know any VB6, but it would appear that 2005 was a backward step if everyone is trying to make it behave like VB6.
It would also appear that MS products are now aimed at software engineers rather than robotics or automation engineers.
I then gave Java a try, it was easy to creat GUIs, however it was bloody hard to make them poll.
As I see it, a GUI needs·four things;
1) A drag and drop design front end.
2) Easy to implement comms.
3) Event driven user input
4) Timed (polled) or interrupt driven input
I have yet to find this in a language for windows which doesn't take a 3 month learning curve.·So I have to either learn VB6 which is no longer supported (but has timer and comm modules) or to use Labview which I know, but which is more overkill. Surely there must be an easy way to set up a GUI.
Issy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The robot is going to lose. Not by much. But when the final score is tallied, flesh and blood will beat the damn monster.
Adam Smith
It turns out what I'm really looking for is a "digital dashboard". There are two options for this as far as·I can tell, build from scratch (not gonna happen) or use someone else's code for the gauges and controls. VB includes a gauge package that can be imported but the license is $700. There are a few free code samples out there for gauges but they look like a three year old drew them with crayons.
I did however find find this absolutely gorgeous package http://www.dundas.com/Products/Gauge/index.aspx·-big bucks for a license though. It is exactly what I'm looking for so I downloaded the free evaluation version and imported it into VB (PITA for a noob like me). I made a nice looking dashboard·using the included gauge wizard which is easy to use. The gauges don't do anything at the moment except look pretty. It isn't clear from the company's web site what the limitations of the evaluation version are. I have some other projects·I need to focus on for a few days, anyone who's trying to do the same thing want to pick this up from here?
Beau, I haven't had the chance to explore the excel angle yet but I'm looking forward to trying that out.
Note to the fine engineers from Parallax: I'd love the opportunity to pay Parallax for something like what is described in this thread!
Your reference to 'digital dashboard' remided me that the early days, we developed a small VB application to use at trade shows which would talk/listen to a Stamp. It had several gauges, some sliders and reported the status of various Stamp registers. It also allowed several equations to be written so that you could say something like: 'when input 1 is ON and input 2 is OFF then turn on output 10".
We compiled it as standalone program and it was kind of neat to play with....never went anywhere commercially.
You can see the screen shot on my website under "projects".
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
What exactly, again, is your requirement? If I'm not mistaken, you can get a developer license of StampPlot Pro for around $50, and it will let you build dashboard type UIs. If it does what you want, it would be easier than building your own equivalent.
I have stampPlot Pro, I didn't pay anything for it though, as far as I know the eval version is full featured now, only with a 10 minute run time limit.·I tried it but I found the customization macros very difficult to use, once·I tried to change anything everything stopped working.
I'm trying to build a nice looking real-time PC interface for my BS2 to monitor 7 sensors and control 2 DC motors.
I had to play around a bit with my suggestion using Excel's VB...· Here is just a bare bones COM demonstration between a BS2 and Excel.
With a direct connection from·Stamp to Excel,·this would make a great data logger with slight modification.
Make sure that the COMport setting and the Baud are correct·on the Excel SpreadSheet before you press the·Start Basic StampII COM Macro
button on the Excel SpreadSheet.
This Demo allows you to have full control over ALL of the I/O Pin states and directions.
Enjoy!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
That looks amazing, I can't wait to try it!
Unfortunately my wife "owns" me on the weekends·
Will this work for the Propeller and the SX?
If you already have VBA, then use that to call up Excel. That would be the best approach. The Earlier solution is what I posted for someone who already has Excel, and perhaps didn't realize that VB was
part of the package.
Below is an example to launch and create an Excel spread sheet from VB (Microsoft Visual Basic 4.0 Professional Edition is the flavor that I use)...
As far as Propeller and SX?· ... Yes, there is an application in mind that I am currently working on that uses a Propeller <--> VB <--> Excel interface (See Image)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 11/2/2006 4:32:07 PM GMT
Once you get the fundamentals down sending and receiving via serial or usb2serial is ultra simple. I have included here a mini app that you can load on RB and test out within seconds of downloading it. Get the RB demo of your flavor, load the file and pres RUN. It will prompt you to search for the port, in my case it shows 3 options, one being usbserial. After selecting the port, there are several windows, type in the test box at the top and press send, whatever you have hooked up will receive the string that you typed. Also, in the lower box, it will show whatever is being received in real time. This mini app I adapted is set at 9600, 8 bits, 1 stop.
For example if you were to drag a button to the window, name it whatever, size it however, then double click on it, you'd get the window to type in the code for it ( or enter a method for it to call, whichever).
This his how difficult it is:
This is a slightly more invloved version using 4 sliders to generate the values to be included in the string:
The User Defined button is where you can double click it in the real basic software and enter your own fixed value(s) to be sent for test purposes.
As far as Propeller/SX/Stamp it is very simple to use, for the Propstick just tell your Spin code to look at pin P31(40 )for Rx, set P30(pin39) to Tx. Use the full duplex object with Spin and you are all set. With THe SX or Stamps, just set tp baud 9600. On the stamp demo board it works fine just using the input16 that is the default serin.
Ok here is one thing I found to be of big help, get two usb2serial adapters or you will regret it. What I am doing is have OS X sending and Receiving on one usb2serial(wires hangin off the cable going to the Propeller P0 for serin and P1 for serout. I have a laptop PC hooked up to the Propstick at all times, so you can update code in the RB and also update code in the Spin without changing cables all the time. One serial port will not work on two apps at the same time without dropping the connection each time. I found it a real headache switching back and forth cables. You may be able to plug two usb2serials into one computer, use one cable for programming the IC, the other for the serial i/o for com. If need be, buy a junker PC for 50 bucks for running the Spin/SXB/BS editor.
Post Edited (originator99) : 11/2/2006 8:46:04 PM GMT
Darn, now I gotta shell out another hundred bucks to use it in my stuff.......
Real help files that look like this, I type in Serial, search and everything I need to know is at my fingertips, I don't have to worry if I have the latest subscription to MSDN (heck I paid 100 bucks for a 1 year subscription once) Thanks Originator99
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think outside the BOX!
As far as my project goes, I've hit a lot of roadblocks recently and I've put the software development on the backburner due to sheer frustration.
···· 1) I have exceeded the capabilities of the BS2, I've run out of variable space and I'm not even close to having everything in the program·yet. My·options are to get another·microcontroller or move into a Dragon-12.
···· 2) I have succeeded in making a few simple GUIs using VB and stampDAQ/Excell as well as some Excell serial input programs (Thanks Beau). When my laptop is reading the data and displaying the GUI ·it·runs at 100% CPU usage (Centrino 1.8G), Graphing multiple inputs in real-time is a resource hog·
The hardware for my project is moving along nicely though, I'm about 6 weeks from testing.
Have you tried using the Clipboard to copy-n-paste? You can use the clipboard as a scratch pad to take snapshots of the data going to and from VB and Excel. VB can read and
write directly to the clipboard and create TAB delimited data that Excel can read as well as parse any data that Excel creates. You can also keep track of your data and only do
updates when the data changes.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
This comes from using real time stock market data feeds. It's just not low level enough to do the job for large amounts of data.
Please specify the amount of data and time intervals you are working with and lets get this thing solved.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think outside the BOX!