Simple Serial Communication

Hello there, I`m working on a project which involves me having to control a large number of servo's via a serial servo controller board. It's a very simple board which communicates using simple ascii commands.  I`ve tried running the examples associated with serial communication but none of them work. No devices are detected which I can link to the VISA rescource name. In matlab I can connect to the board quite easily using two simple commands:
port = serial('com6','BaudRate',19200)
fopen(port)
I would assume this would be almost trivial in Labview but so far I have failed misserably. A possible source for the error would be that I`m running the student edition of labview v7.0 and it doesn't even include MAX (or if it does I haven't found it yet). Do I need another version of Labview (if so which ?) or am I forgetting something critical in the examples ?

I don't believe that the student edition comes with any drivers. If nothing shows up in the VISA Resource Name control, you just probably need to install NI-VISA.

Similar Messages

  • Having issues with simple serial communication.

     I followed a tutorial online to start learning basic serial communication. The tutorial involved shorting pins 1 and 3 on the Comm 1 port, and writing a simple program (attached). I edited the program a little, to show the varied results that I get when trying to write and read a simple phrase via serial port. 
    Could someone explain what causes the kind of result shown in "Serial Comm Example.png"? I believe it has to do with timing. Why would only parts of the phrase be transmitted?
    Thanks,
    Sarah
    Solved!
    Go to Solution.
    Attachments:
    Serial Comm Example.vi ‏30 KB
    Serial Comm Example.png ‏139 KB

    sarahzig wrote:
    The tutorial involved shorting pins 1 and 3 on the Comm 1 port
    Shouldn't that be pins 2 and 3?  On a standard DB-9 serial port, pin 2 is the Recieve and pin 3 is the Transmit.
    Now for your code...
    1. Move the Configure Serial Port to be before the loop.  You only need to configure the port once.
    2. Close the port after the loop.
    3. Handle your error after the close.
    4. Stop your loop on an error or the stop button was pressed.  You will need an OR in there.
    5. No need for the Flush Buffer function.  Remove it.
    6. Using the Bytes At Port is a dangerous thing.  It introduces all kinds of interesting race conditions.  Instead, tell the VISA Read to read the number of bytes you expect to read.
    6a. Alternatively, be sure to send an End Of Line character at the end of your sent data and set the number of bytes to read to something a lot more than you would ever expect to read.  The VISA Read will stop reading when it a) sees the number of bytes it was told to read, b) sees the termination character (currently enabled and set to a Line Feed, which is part of the End Of Line), or c) the timeout happens.  Whichever happens first.
    7. With 6, the wait is no longer needed.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions

  • Data Missing in Serial Communication

    Hi,
    I am Communicating an Embedded Board with LabVIEW.Data is transfering in 1 Data per second priodically.Problem is Some data are missing in between.I am using simple serial read VI.Can any one suggest me a solution? Data Log file is attached.I crossed check with some other applications in that its working fine.
    :a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
    :a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
    :a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
    :a) 329 b) 400 c) 100 d) 328 e) 373 f:a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
    :a) 329 b) 400 c) 100:a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
    :a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
    :a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
    :a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
    :a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
    :a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
    :a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
    :a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
    :a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
    :a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
    Please Mark the solution as accepted if your problem is solved and donate kudoes

    Can you share some code?  It would help a lot if we could see how your program is put together.
    Is the embedded board using a termination character?  A termination character is something like an End Of Line character at the end of each message.  If it is sending it, then make sure you are not using the Bytes At Port function.  Just tell the VISA Read to read a huge number and the read will finish when that termination character is found.  This, of course, is assuming you enable the termination character in your program.
    My other guess is that you are constantly opening and closing the serial port.  DON'T DO THAT.  You should open and configure the port before your loop and close it after the loop.  You can send and read data inside as much as you want then.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Serial communication error

    hello,
    when i try to run my application(serial communication simple data transfer using loop back), labview evaluaton 8.6 showing the erron as attached.I dont understand what went wrong, it was working fine earlier.
    Thanks,
    hari
    Solved!
    Go to Solution.
    Attachments:
    laberror.JPG ‏85 KB

    Is that mean permission from NI? it was working fine, once i terminated the labview application abruptly when not responding since then i have this problem.
    hari

  • How to send data using serial Communication

    I want to make serial communication using RXTXcomm.jar file.I was written the code.From this I got the list of serial ports avilable on pc but then after when I was tring to send command to machine which is attached to port it didn't gave any reply.
    Tell me that how to send command to port?

    This is how I do it:// open port, get ownership
    SerialPort serialPort= (SerialPort)portId.open(APPLICATIONNAME, timeout);
    // no framing and no threshold
    serialPort.disableReceiveFraming();
    serialPort.disableReceiveThreshold();
    // communication speed, parity, stopbits and databits
    serialPort.setSerialPortParams(BAUDRATE, SerialPort.DATABITS_8,
         SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
    // no handshaking or other flow control
    serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
    // timer on any read of the serial port
    serialPort.enableReceiveTimeout(TIMEOUT);
    // open streams for reading and writing
    InputStream is= serialPort.getInputStream();
    OutputStream os= serialPort.getOutputStream();... then you use the 'os' stream for writing and the 'is' stream for reading.
    kind regards,
    Jos

  • How do i open a new window? serial communication problem

    I am trying to make a serial communication interface, with changeable settings,
    but i wanted it to be that the settings to be openend in a new window, how am i able to do that.
    I tried to make a separate subvi, but unable to do that, here is my explanation in images and the vi files.
    -Just a student-
    Attachments:
    LVTerm.vi ‏50 KB

    Hello Nandha,
    SubVI's can be created by selecting the part that you want in the subVI and than select "create subVI" from the "Edit" menu.
    Or cut the selected part and open a new VI and paste in the code. Then you have to connect all the controls and indicators to your connector pane. To do this right click the icon in the upper right corner and "Show connector". Select a pattern that has enough connectors, my personal favorite is the 4x4x4. Select the wire tool and select a connector and then the control or indicator you want to connect. Try to keep controls to the left and indicator to the right.
    Now you have to figure out when you want to show the settings window. Is it necessary that the communication goes on during manipulation of the settings?
    Kind regards,
    André
    Regards,
    André
    Using whatever version of LV the customer requires. (LV5.1-LV2012) (www.carya.nl)

  • Changing the name of serial communication example in lab windows. Urgent help required

    I am using the example of getting data from rs 232 in lab windows. I want to use this in my final year project that's why I want to change its name that appears as  "serial communication example" how can I change its name and how can I make its exe file that will run on any system even without lab windows.
    How can I modify this example to save the data. I am very new to lab windows, I was using hyper terminal previously.

    I am not informed about the file format that hyperterminal uses.  However, CVI allows wiring to files.  To get a list of functions that deal with file handling, press <Ctrl-Shift-p> to get the "Find Function Panel" dialog.  Type in "file" and press the "Find" button.  This will open a list of funtions that contain "file" in their name.

  • Problem download: Java serial communication

    Hi,
    I need to work with Java serial communication api for Windows.
    As mentioned on SUN site, downloaded the following:
    1) comm2.0.3.zip, &
    2) rxtx-2.0-7pre1-i386-pc-mingw32.zip
    Extracting, unable to see win32com.dll & javax.comm.properties
    Can you help me?
    Thanks,
    Priya

    Hi priya
    There is problem in your downloaded s/w
    Download commAPI once again then try
    Read the readme file and follow the instruction

  • VISA Read function Read buffer problem in serial communication

    Hi,  I use VISA write and read function in serial communication app, the device continuously sends 0x00 if it is not receive a request from Labview program running on PC.
    And the request sent by labview is programmable. I met a weird problem, each time the request changes, the VISA read buffer output port still shows the last request firstly, from second time, shows the right request.
    It works like: Req code: ... 50, 51,51,51,50....;  VISA Read buffer: ...50, 50, 51, 51, 51, 51, 50....
    Please refer to the program.
    Attachments:
    readOne_test.vi ‏21 KB

    How are you running this?  You don't have a while loop around it.  Is it part of a larger VI?  Please don't tell me you are using the run continuously button.
    You don't have any wait statement between you VISA Write and your bytes at port.  So it is very likely the receive buffer is still empty since you didn't give your VI time to wait for the device to turn around and give a reply.  If you read 0 bytes, your VISA read string will be empty.  How does your decoder subVI (which you didn't include) handle an empty string?

  • Synchronous serial communication

    Hello All,
    Is there anybody with experience in synchronous communication or have
    board vendor adress.
    Any information would be very helpfull.
    Thank you in advance.
    Michael

    Some years ago I have to do something similar. We wanted to do some simple data communication PC to CPU board for test purposes. We ended up taken a small and cheap micro-controller, which we interfaced to the CPU board. Then we used RS232 from the microcontroller to the PC. The whole setup required 2 circuits, and was soldered up on a prototype board. At the end of the day the project worked as we wanted. If you do not like soldering you may pick up a cheap microcontroller test board. The cost very little compeered to your NI IO unit (USB 6509). I am just passing this as an idea. It may not fit your need.By the way are you sure you do not have a free UART port on your CPU board you can use for your testing
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • To read 512 bytes using serial communication

    I want to read 512 bytes of data using rs 232 with the timeout of 30ms. I am using "Serial read with timeout -Palm.vi". Is there a limitation of the number of bytes I can specify to this VI?
    Thanks!!
    Attachments:
    Serial_Read_with_Timeout--Palm.vi ‏63 KB

    Hi software enigineer,
    It is not possible to transfer 512 bytes per 30 ms here. To do this would require a baud rate of 136533 (512*8/.03) and the maximum possible baud rate is 115000. The recommend baud rate for a serial transfer is 9600, which would mean transferring at most 36 bytes if the timeout is kept at 30ms. Moreover, there is usually some overhead involved in serial communication, and I would recommend sending a little less than the maximum 36 bytes every time too.
    On another note, I noticed that in your block diagram, you are using the Bytes at Serial Port vi. Definitely use the output of this vi to determine how many bytes to read at a time and read the bytes as they become available in the serial buffer rather than reading in a large buffer
    all at once. Continuously read and append the output until there are no more bytes to be read or until the termination character is read. This will avoid any lost data transmission due to overflow.
    Good luck with your program!
    Kileen Cheng
    Applications Engineer
    National Instruments

  • User-specified DAQ interruptions, instrument control through serial communication

    I'm working on an instrument control program, and I've run into a structural problem that I cannot figure out.
    The instrument in question is effectively a thermostat.
    The program has two functions:
    1.)  Background sampling to record temperature in a log over time.
    2.)  Adjust temperature according to user input
    The issue is that the instrument uses EIA-232 serial communication to talk to the PC.
    This prohibits simultaneous execution.  Attempting to send a command while the program is taking a sample will result in serial blockage errors.
    So the program must interrupt background sampling until the specified command has been completed.
    I can't figure out how to do this.
    My best idea was to create a manual pause control.  If the user wants to adjust the temperature, he hits a switch to pause the sampling, sends the appropriate command, then hits the switch again to reinitiate sampling.  This method will suffice, but is not ideal.
    Beyond that, I really have no idea how to prevent the two functions from running into each other.
    Help structuring this program would be greatly appreciated,
    Thank you

    Look into Semaphores (icons with traffic light glyphs)
    Set up a Semaphore resource to the COM port that is wired to two parallel structures.
    One structure would do the background polling, the other would handle setting changes.
    Prior to background poll, lock the resource, then unlock it after the poll. Likewise for the setting change command.
    When a resource is locked, the other process cannot access it until it is unlocked. Be sure to dispose of the Semaphore when ending the program.
    -AK2DM
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    "It’s the questions that drive us.”
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    Attachments:
    SempahoreExample.jpg ‏256 KB

  • How to make Serial Communication in windows

    Hello, I want to do serial communication using windows platform.Sun provides javax.comm package for solaris & unix but there is no any provision for windows platform.Can I use it in Windows Platform.?

    http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876

  • Serial communication to read single character

    Hi! List,
    I want to read single character using serial communication(see the attached VI).
    The initialization of the serial port is taken care.
    TIA
    Attachments:
    Serial_comm[2_read_single_character].vi ‏42 KB

    I'm not sure I can understand you. If you want to read just one single character why can't you do so by just passing 1 to the Serial Read function as the number of bytes to read?
    The diagram of above VI doesn't make to much sense to me I have to admit.
    Rolf K
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Serial communication from simulink to labview

    hello everybody,
    i have problems with establishing serial communication from simulink(where the data is generated) to labview (version 2010).
    i tried everything but it won t work.can you please help me on this one pleaaase.
    thanks ^^
    Attachments:
    projet labview.vi ‏15 KB

    thanks so far for your replies,
    to clarify any confusion this is my system in simulink.
    the data are decimal values
    thanks again, hope i ll receive a reply from you guys soon cause i really need to progress in my project
    Attachments:
    xxx.PNG ‏20 KB
    yy.PNG ‏35 KB

Maybe you are looking for