02-24-2011 07:02 PM
I am currently working on my Senior Design project which involves interfacing to our Basic Stamp II microcontroller. We need to have the ability to develop a LabVIEW GUI to read and write to each of the pins. Currently on parallax's website, they have example code for LabVIEW but it involves interfacing the microcontroller through serial port. Currently our Stamp is using a serial to USB converter since our laptops do not have serial inputs. We tried to fool around with the program but we are not familiar with what to change in order to communicate via USB. If anyone has done this before or if anyone could help us it would be much appreciated in order to get our project done by the end of the semester. If there are any problems or if you need more information please let us know.
Thanks!
02-24-2011 07:27 PM
First make sure the drivers for your USB to RS232 converter are installed. Look at the Windows device manager and make sure it is there. If it is there take note of the com port number. COM13 or whatever.
Then look for the serial communications examples that ship with LabVIEW. Do a "loopback" test to make sure it works. Just do a search on this forum for loopback. Here is one thread.
Once that works and you configure the baud rate, etc, you should be able to run the examples you found on the parallax site.
02-25-2011 05:51 AM
I did this a long time ago (and may still have the code at home - I'll check). The way I understand it (and did it) is that LabVIEW communicates on the Serial port with the program you have running on the Basic Stamp. This program responds to commands from LabVIEW to either read or write a pin. Have you written either program that you can post? Can you post a link to the example code on Parallax's site that you mentioned?
02-25-2011 05:35 PM
The example code that was provided with parallax is attached. As far as the driver for the serial to USB, I downloaded that and I can see the BS2 in my Device Manager (COM5). When I ran both the example code from Parallax and an example code through LabVIEW for a basic serial write and read, I was unable to get communication between my laptop and the BS2. If you have code that you developed before, it would be really helpful if I could test that out with my microcontroller. Thanks for all your help guys!
02-27-2011 12:40 PM
I have several questions. Do you get some kind of an error with the example? Are you sure that the baud rate is correct? Have you tried a loopback test? Do you have a null modem cable or a straight through and which one is required? You have to make sure that TX on the PC side connects to RX on the BS2 side, and the RX on the PC side connects to TX on the BS2 side.
You just have to go through the process of elimination. If you have access to an oscilloscope that would really help and you can get some good deals on ebay.
03-07-2011 11:46 AM
I tried to run the program several times under each baudrate and an error is displayed everytime. I attached a picture with the error out message. My setup is the BS2 developer board, a serial to usb converter, and usb cable to my laptop. I am running that example code that I posted above. Once I achieve communication, I just need a basic program to set a specified pin High or Low.
03-07-2011 01:04 PM - edited 03-07-2011 01:13 PM
Never mind.
03-07-2011 01:24 PM
The error message gives you a clue as to what is wrong. It is pointing to Argument 1 in the VISA serial configuration VI. Assuming it hasn't been modified, that argument is the timeout setting.
Try a larger timeout such as 10 seconds.