Basic Stamp 2 MicroController

I am currently working on a project that involves using a Basic Stamp 2 microcontroller that was purchased through Parallax.com.  We currently have the uController connected with our laptops using a USB to Serial converter and are able to achieve proper communication with the example LabVIEW code provided through parallax.com.  We loaded the Basic Stamp Editor code that I attached below  and ran the LabVIEW program (also attached).  The problem that we are running into is that we need to have the ability to read and write to each pin.  We need to set a specific pin HIGH depending on the user input. (Ex. User selects Pin 3 to set HIGH or LOW)  The program that was loaded from the basic stamp editor just echos the user input.  We are beginners with the software so we are not sure what part has to be changed in order to get it working.
If there is any more information that is needed please let us know! We are nearly 4 weeks until our due date =/
Attachments:
StampSerial.llb ‏63 KB
LabVIEWIO Notepad.txt ‏3 KB

Hi,
Looking at your stamp code, it is only programmed to drive one output pin and one input pin.  Your serial protocol needs to be expanded to allow you to set pin and state, currently you only send state.  You could just copy the code down and change the DO command to O1, O2 etc.
Also, the labview code you have is not too good.  There is no while loop.  Are you just running the code once or using the run continuous button?  Run continuous is very bad as you are continuously opening and closing the com port.  You should move the serial port open and close functions outside of the loop.  This will require you to move the open and close code out of the subvi.  If the code is user interface driven then you should use an event structure within your main loop.  If you are not using an event structure you must put a small wait inside the loop or your code could use 100% CPU and lock up your PC.
Search the labview examples for ways to code your application.
Good luck,
Michael

Similar Messages

  • Communicat​ing between LabVIEW and Basic Stamp 2.0

    Hello,
    We are trying to control the movement of a Parallax Boe-Bot (robot with
    Board of Education) via LabView programming.  The BOE operates on
    Basic Stamp programming to control the pulse width sent to two servo
    motors.
    Is there a way to establish communication between LabVIEW and Basic
    Stamp 2.0?   We need to send commands from LabVIEW to the
    Basic Stamp to control the pulse width and therefore the rotation of
    the two servo motors.  We also need to send a signal from an
    accelerometer based on the robot to the LabVIEW ADC. 
    The ultimate goal is to do this with wireless communication, but for
    right now we are simply trying to figure out any way to send the data
    between LabVIEW and the Basic Stamp.
    Any ideas?
    Thank you,
    Adam

    Hi Adam,
    You can communicate with a BASIC Stamp microcontroller over GPIB using VISA.  To see some LabVIEW example code, just search for GPIB in the NI Example Finder (Help>>Find Examples). This will show you the basics of GPIB communication in LabVIEW.  I also found this link by searching the NI discussion forums for "basic stamp"
    http://www.parallax.com/html_pages/downloads/softw​are/software_basic_stamp.asp
    Here you can download an example using LabVIEW 7.0 or higher to communicate with a BASIC Stamp 2.
    I hope this is helpful!  Let us know if you have further questions.
    Megan B.
    National Instruments

  • LabVIEW Output, BASIC STAMP II

    How can I output the LabVIEW program that does the following (see
    below) to interface with Basic Stamp II.
    From a graph, I could retrieve X-Values (X1 and X2) and Y-Values (Y1
    and Y2).
    Target (X1, Y1)
    Laser (X2, Y2)
    Change in X (X2 - X1)
    Change in Y (Y2 - Y1)
    If ChangeX >= 5 If ChangeY >=5;
    Move ChangeX==Right; Move ChangeY==Down;
    else if ChangeX <= -5 else if ChangeY <= -5
    Move ChangeX ==Left; Move ChangeY==Up;
    else Move ChangeX==0 else Move ChangeY==0
    | increasing Y
    |
    |
    |
    V ----------- > increasing X
    If the change in X is positive (greater than zero), move change in X
    to th
    e right. If it was negative (less than zero), move change in X to
    left. If the change in Y is positive (greater than zero), move change
    in Y down. If it was negative (less than zero), move change in Y up. I
    used 5 instead of 0 to give room for error.
    Please e-mail me at if you can help, have
    information or any question.
    Thanks,
    Paul

    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!
    Attachments:
    StampSerial.llb ‏63 KB

  • Working with basic stamp rs-232

    hi there,
    i'm currently using basic stamp together with labview 8.5. communication between the hardware (4 ultrasound sensors) and software is using the RS-232 serial communication.
    however, the sampling rate is very slow ( as low as 10 samples per second). may i know how to increase the sampling rate?
    it is due to the serial communication?

    Who wrote the embedded code for the microcontroller?  That's probably where the sampling rate is set (or allows to be set).  Is there documentation that came with the firmware?  Also, what are you sampling?  Depending on what you are sampling, sampling rates can vary greatly. 
    For instance, you would sample temperature at a vely low rate as compared with wind velocity. 
    Does your circuit allow for buffering?  There are many details about your environment that you need to share before we can offer any suggestions on how to increase sampling rate...  Or to determine if it is possible to do so...
    R

  • Communicating To Basic Stamp with RS232

    I am new to programming in Labview.
    I recently have a requirement to use LabView to control a Test Setup rigged with a Basic Stamp 2p Mircocontroller.
    All I need to do is to get Labview to send some coded commands to the stamp so that it can retrieve execute the commands and then return some data that it collected from the sensors that it is monitoring.
    Below is how I try to manage the communication:
    1. Labview send out "0" then read from COM1, timeout in 5secs. It will repeat this until it get a reply from the Stamp wihtin 5secs.
    2. Basic Stamp will not reply if it is doing something else. It will reply "0" if it is ready to receive instructions. And "1" if it is ready to send data.
    3. When Labview get a "0" reply, it will send out the two coded instructions. If the reply is "1" Labview will read from COM1.
    Here's the problem.
    I start my experiment by sending the first set of instructions to the Stamp. Which it has no problem executing.
    But when I try to send a 2nd instructions, i.e. when Labview try to send out "0" and wait for a "0" reply. It reads the value of the last instruction it sent out. Depending how many bytes I set it to read, LabView will cycle until the last byte of the previous instruction is done then it will read in the "0".
    I do not believe the problem is with my Stamp program or the hardware as I tried to manually sent instructions using Hyperterminal(with echo off) and I do not see the instructions returning.
    The way Labview behave seems like ECHO ON in hyperterminal. Just that the data I sent out seems to be sitting in the read buffer.
    I manage to bypass this by doing something really stupid. Each time I need to read from the COM port, I close the VISA connection and Open it again. This seems to help clear the buffer. But this put in substantial amount of wait time in both my Stamp and Labview program as I have to ensure each side is ready to communicate and they wait for each other to get ready.
    Does anyone know how I can stop the data I sent out to appear when I read from COM port?
    The only configuration that is not default on the VISA connection is that I stepped the Baud rate down to 4800 to ensure that the Stamp do not loose data.
    Thank you.

    I tried using the Send/Read Example. But since my Stamp is programmed to communicate in 4800 baud rate, I have to add the VISA Config in the Labview example to get it talking properly. Well the results are the same. I see what I send out in the read message box and my stamp is not program to echo message. The only thing I can think of that could cause this is the serial cable. I have to rig an adapter to diasble the stamp from resetting I rigged the cable so that pin 2, 3 & 5 on the DB9 cable is connected to the stamp. Pin 1, 4 & 6 are tie together. Pin 7 & 8 are tied together. (As suggested in the basic stamp manual, Pg 399). Would this cause the data to be routed back to the read buffer?
    Thank you.
    Attachments:
    Manual.jpg ‏64 KB

  • Peak detection and appropriate response

    I have been working on a wireless vital sign monitor. I have signals coming through 8 bits A/D entering the microcontroller and serially sent to Labview where i do my analysis.
    I am trying to implement the below algorithm:
    1) Detect the peaks above 3 volts (my range of signals is between 0-5 V) for an interval of 6 seconds.
    2) For every time I detect a peak, increment counter (Counter starts at 0 and ends at 6)
    3) Multiply the total number of detected peaks by 10 which gives beats / minute.
    I was initailly trying to accomplish this using the microcontroller (Basic Stamp 2) but have not been succesfull and am therefore wondering if there is an easier way to do this in Labview.
    I want to accomplish this in real time. Can anyone suggest an approach??
    Thanks

    There are two vis that can be combined :
    - the threshold peak detector (in the Analyse/Signal processing/Time domain sub-palette), gives the number of peaks above a threshold value, in an array of data;
    - the DataqueuePtbyPt in the Analyse/Point by Point/Other functions sub palette) that builds a queue (array) of a given length. This second vi can be used to collect points from your microcontroller ADC.
    Have a look at the attached vi.
    CC
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    Beat Count2.zip ‏23 KB

  • How to reject pulses

    Hi,
    This is one project that I am doing for some time using sinar sensor which generates pulse with to measure the distance to object. This sensor is being controlle dby basic stamp2.
    My problem is that I am getting signal from the signal out put of the sensor. the same output is used by the basic stamp to switch on the sensor and that time is like 2usec so it acts like pulse the sensor generate long pulse depending upon the distance from the object. SO one short pulse and one long pulse
    but I dont want my labview to read this short pulse which is like constant 2Usec,
    because I am trying to calculate the velocity out of that range sensor so I onle need pulses which tells me the distance so two consecutive distance pulses in my code will tell me change in distance and the I can convert it into velocity.
    But if small pulse I call it triggering pulse is read by the code then it will not be two consecutive distance but will be alternate small large small large
    Now I have tried to used the case structure telling it that if time measures is greaterthan this than it is true and process but what happens now is that when it recieves small pulse the case structure repeats the variable like repeat the distance again
    see my attachment
    How to get rid of this small pulse that it does not go into my while loop
    Attachments:
    combine1b.vi ‏158 KB

    The cause of the problem is that you were using the case structure to control the data update of the local variable, but you were not using it to control whether the data is processed for a given iteration of the loop. What this meant is that you would process old data during iterations in which you didn't want to process any data. The simple fix is to include all of your processing inside of your case structure. This also allows you to eliminate the use of local variables, which should always be avoided at all costs. The use of that local variable actually created a race condition in your code which could have also contributed to the problem you were having.
    I have attached a modified version of your code that implements what I described above. I hope this helps and remember the lesson to learn: use local variables as a last result only!
    Kind Regards,
    E. Sulzer
    Applications Engineer
    National Instruments
    Attachments:
    combine1b_mod.vi ‏160 KB

  • Best way to make this stepper motor control system

    The goal of my project is to have real-time data collected by a Dataq 158u utlimately controller a stepper motor.  I orignially planned on running this whole thing with basic stamp, but I'm realizing that this may not be possible.  I have a stepper motor and a L293DNE driver.  I will continuously be recording data with the dataq, in the form of volts, and want these values to determine how the motor works.  For example, if the voltage is 0-3 volts, I want it to rotate clockwise, 3-5 volts not rotate, and 5-8 volts rotate counter clockwise.
    I've been trying to figure this out the past week, looking through threads with basic stamp, matlab, and now labview.
    Is there an easy way to do this? or easier way that I am currently trying to figure out?
    Any help would be greatly appreciated!!
    Thanks in advance.
    -Nick
    Solved!
    Go to Solution.

    Nick,
    What I was describing is how you would need to configure the motor controller to accept PWM from LabVIEW and operate in a Locked Antiphase mode so you could control motor direction. A lot of the LabVIEW part depends on the DAQ you use. For instance does your DAQ have a Counter that can generate PWM? I did some checking just now and your DAQ is not manufactured by National Instruments and I could not locate any native LabVIEW drivers. I did however go to the Dataq 158u MFG website and found they do have LabVIEW drivers BUT their Software (SW) must be running in the back ground. The Dataq 158u web site also has a help forum, I suggest you start their to understand the capability of the Dataq 158u. Also it appears you are not familiar at all with LabVIEW , before you can take on a project like this you need to start with the basics of LabVIEW, learn how to handle arrays so you can store your ADC results and how to use loops and timing and shift registers.  NI has some FREE basic training like the 6 HR intrudction to LabVIEW I would start their. Oh and in your OP (original post) you doubted the Basic Stamp could do this, I do this type of control using Atmel micro controllers all the time, I am sure the Stamp could eaisily do this. Just get on one of their forums for more info. Oh and to answer your question an Inverter is an IC that inverts the input signal, what you would end up with at the direction pins of you motor controller is PWM on one pin and 180Deg out of phase PWM on the other.
    Alan

  • Soccer robot

    Hi, i'm working on a robot soccer, that has a webcam placed directly on the top of the robot(showing five different coloured circles from the view of the camera) to act as the robot's  "eyes", detecting the robot's position. I'm required to use Labview, with Vision Assistant as image processing program to create a programme in such that the robot would move to the ball(target). I'm using rs-232 connecting between the host computer and a Basic Stamp 2 board(transmitter), a  RF module to communicate with the robot(receiver). Currently, i'm working in grayscale image abdi've made necessary image processing steps but i cant seem to get the coordinates of both the robot and ball(target) in the same program and i'm stuck on how to control robot's movement to the target using Labview programming. How do I go about finding the angles and distance between the robot and the target? What functions should I use? Hope to seek guidance from anyone who can help.

    Creating soccer robots isn't too easy and using optical systems for position- and target-"acquisition" is very difficult.
    Pnt already wrote about some things you have to consider, but i will add some more:
    - What about "linearity" of your picture? Does your webcam create non-linear distortion? (see this)
    - If you create a real soccer robot, there will be relative speeds between ball and robot. Have you already thought about optimazation for this? (Otherwise, your robot will behave like a dog crossing a quick flowing river!)
    - Does the robot act as a single player or are there more of them? You will need to "look" for other "players" in order to prevent damage to your robot and the others....
    These are some points coming to my mind in seconds (writing takes more time though.....), but you can see one thing:
    ONE SINGLE sensor is most often absolutly insufficient to solve such a task. Take in consideration a human footballer:
    He has eyes and ears to learn his surrounding and maybe some kind of "precognition" in order to prevent dangerous situations. This will make a good soccerplayer...and your job seems to be to transfer this to.... a robot
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • PING))) Ultrasonic Distance Sensor (#28015) LabVIEW

    We are doing a project with the PING))) Ultrasonic Distance Sensor (#28015) using LabVIEW 9.0.  We are having difficulty interfacing the PING))) sensor with the NI ELVIS II+.  Also we are unsure of how to make a time delay in the microsecond range.  Any suggestions are appreciated.

    LabVIEW, under Windows, is not capable of a microsecond delay. Windows, in general, has a latency of 1 to 10 mS depending on who you ask and what version of Windows, machine, etc etc; however, I have seen LabVIEW commit to delays of 2 mS reliably. You just have to test it. LabVIEW RealTime is a different story, but I don't think you are running RT with Elvis.
    As far as "having difficulty interfacing the PING))) sensor with the NI ELVIS II+", that question is so general, I wouldn't know where to start. But I must say that the sensor you are using was designed to interface directly with microelectronics like the Basic Stamp. You will not reliably measure microsecond pulses through high level hardware and Windows. But lets say you don't need microseconds..... the sensor outputs TTL. If you can read a digital input with your Elvis, then that's where to start to get "something" out of the Ping))) and into Elvis/LabVIEW.
    Richard

  • Interfacing WRT 150 N to microprocessor

    Have an old WRT 150 N v1.1 Wireless router. Would like to interfase a Parralax Basic Stamp to it by way of a serial connection. My router circuit board does not look like some mods I have seen on the net. There is no JP next to the Reserved button. Also could someone Iidentify JP1, JP2, and JP3. Are those designations similar across other routers?
    Also would like to ad a SD card modification. Any help or links would be greatly appreciated.

    No you cant insert a SD card on wrt150n v1.1.

  • Robot soccer

    Hi, i'm working on a robot soccer, that has a webcam placed directly on the top of the robot to act as the robot's  "eyes", detecting the robot's position. I'm required to use Labview, with Viaion Assistant as image processing program to create a programme in such that the robot would move to the ball(target). I'm using rs-232 connecting between the host computer and a Basic Stamp 2 board(transmitter), a  RF module to communicate with the robot(receiver). Currently, i've made necessary image processing steps but i cant seem to get the coordinates of both the robot and target in the same program and i'm stuck on how to control robot's movement to the target using Labview programming. Hope to seek guidance from anyone who can help.

    I believe you posted this in the wrong forum. You need to post this to the Labview forum. You may get a response here, but this forum is for Multisim/Ultiboard and I doubt that there is anyone here that can help you.
    Kittmaster's Component Database
    http://ni.kittmaster.com
    Have a Nice Day

  • Steps needed to log external stimulus

    Hello,
    I am an electrical engineering student, but have been spending most of time doing higher level Matlab type applications. I would really like to create something during my own time that would initially log something as simple as a when a button is pressed from some device external to the PC.
    I have played around with Java a little, but didn't really get anywhere because I didn't have a goal. I would really like to get some help from someone on where to get started on an application like this.
    Thank you,
    Dave

    The bulk of applications written in Java are for interfacing with an end-user via a console, monitor, and mouse. For example, creating a web site to get data from a database, display it, and update it. There are other Java projects than these for such things as embedded microcontrollers such as Javelin-Stamp Microcontroller (http://www.neatsite.com/micros.htm) if you want to get into that as a hobby. Visit robot hobby web sites that work with such processors to see what they are doing with them. If you want to get into that, I suggest you read a lot about it before deciding to invest your time and money in it or committing yourself to one particular type of microcontroller. Note these microcontrollers have the ability to interface external devices such as switches with a computer via a communication port

  • DateAdd(interval,number,date) Visual Basic to LabVIEW Time Stamp add 18 months

    Hi all,
    I need to match Visual Basic Cmd  =  DateAdd("m", 18, Date()) which adds 18 months to today's date.  When I use LabVIEW Time Stamp VI's at first I tried adding 1.5 years in seconds. but this did not match the VB generated method?  What method do  I use in LV to obtain the VB DateAdd("m", 18, Date())
    Example 'Add one month to January 31, 2000
    document.write(DateAdd("m",1,"31-Jan-00"))
    Output:
    2/29/2000

    Well this is how you do it. However, it doesn't seem to work with the month. There was a thread about this problem not too long ago. If you overflow the month in the date/time rec cluster (so it is greater than 12), date/time to seconds returns 0. Every other element works fine. You can add 1000 to the day and it will figure it out just fine. When this bug is fixed, this will work. Also, it might only be a bug in recent versions. I'm on 8.5 and it doesn't work right.
    I realize this isn't a great answer to your question, but as far as I know, this is the easiest way to do what you want and have LabVIEW handle all the work.
    Message Edited by Marc A on 10-03-2007 03:56 PM
    Attachments:
    Example_BD.png ‏2 KB

  • Basic Function Generator does not return current time stamp

    The Basic Function Generator .VI file does not return the current time stamp.Instead it counts from 1904.
    Is there a solution to this so that the basic function generator returns a current time stamp?

    "Is there a solution to this" ...  yes, if you expand that to include "workarounds":
    Attachments:
    Example_VI.png ‏5 KB

Maybe you are looking for

  • Upgrading to Tiger Installer problems

    Ok, thanks in advance for giving a glance, and, Happiest of Holidays. I did search and still doesn't fit my situation... Upgrading to Tiger-retail box from OWC. I use an external partinioned 200g firewire drive as a B/U and bootable OS/software teste

  • How to see http response from an axis web service call (Eclipse)

    Hello, I would like to see the raw http response which is returned from web service calls. I have a dynamic web project in Eclipse which uses a local instance of Tomcat 6. I'm using all of the default setting for a top-down web service generated from

  • Using search in Acrobat 9 Pro Extended

    Hi and thanks for any help in advance as I am pulling my hair out. I have many technical wiring diagrams that I often have to find a wiring color label in. this is very difficult with just my eye as the print is small and labels are only two letters

  • Thread start() method problem

    I have a program server-client program that have a lot thread but when I called thread.start() method it doesn't return run() method. even so my input-output codes is running ( my client program can send data to server program ) Please help me

  • TNS error in JDBC connectivity in win 7 64 bit

    Hi, i am a newbie,working in eclipse(j2ee/oracle db), everything is working fine in win XP,but with the same code wen i switched to win 7(64bit) in case of jdbc connectivity after loading the driver( Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") stat