Send DAQ measurement results through serial ports

Hi, All
I use PCI-6034E for measurement. After DAQ gets data, I send them to another computer through serial port (com1). I write a Virtual C++ program, which calls NI-DAQ library functions to implement DAQ data sampling (multiple channel scan) and sends measurement data to another computer through serial port under request. DAQ data sampling and serial communication are implemented in two threads. They are running concurrently. They share a global memory for measurement data. The serial communication thread will do infinite wait and send data only when another computer sends a request through serial port.
I met two problems. First, when I reduce the size of DAQ measurement buffers (piBuffer and halfpiBuffer, I us
edouble buffer model), DAQ measurement is often interrupted by the message "[DAQ_DB_HalfReady] returned NI-DAQ warning 10846. Your application was unable to retrive data from the background acquisition buffer fast enough so the unretrieved data was overwritten with new data. ...". I want to get run time data so I need to reduce the buffers as small as possible. How can I solve it ? The second problem is that the serial port gets error data (nothing) from measurement computer sometimes, especially when DAQ initializes itself and finishes work. It looks like that there is a conflict between DAQ and serial port. Does anyone have similar experience about this? Any suggestion?
Thank you in advance.
Le Cai

Le Cai,
You are correct that the number of scans to read is equal to half of the buffer in double buffer mode. I was mistaken and referring to a standard (non double buffered) operation. However, you can increase the size of your buffer without affecting the period of your acquisition. A buffer of 60 is quite small and, as such, will be more prone to overflow errors. The rate is actually set through the DAQ_Rate() and DAQ_Start() functions. For more information on these functions and how to configure the scan rate, please see the NI-DAQ Function Reference Manual.
NI-DAQ Function Reference Manual for PC Compatibles
http://digital.ni.com/manuals.nsf/websearch/1630A0B68738B269862567C1007A2912?OpenDocument&node=132100_US
A good place to start would be the example titled, "DAQdoubleBuf.c" which ships with the NI-DAQ driver. If you installed the examples for Visual C++ when you installed the NI-DAQ driver you should be able to find this example in the \Program Files\National Instruments\NI-DAQ\Examples\VisualC\AI folder on your computer. This example would be a good template as it is very close to what you are trying to do.
If you observe that you only receive the overflow error when you are operating the two threads, thus ruling out the buffer size as being a potential problem, you may want to examine whether or not your second thread is placing a lengthy exclusion on your data buffer during the period when your first thread is trying to move the data. If your first thread has to wait during the half-buffer transfer this could easily cause the overflow, as the acquisition would be running but the transfer would be paused. Instead of placing a mutual exclusion around one piece of global memory you could try using a queue instead. A queue approach will allow you to pass the data from the first thread into a queue to be read, when convenient, by the second thread. In this method the first thread would never have to wait as the transfer would just be a handoff.
Regards,
Justin Britten
Applications Engineer
National Instruments

Similar Messages

  • Want to use dotNet with teststand, but unsure how to send commands through serial port

    I have a loCom communication dll used to send and recieve commands through serial comunication for a particular product.  I the past they have used a LabVIEW wrapper to send and recieve commands, using this particular dll.  I would like to just use testStand for the DOTNET Dll.  I can get the commands, know the inputs and outputs required, however I can not figure out how to send the commands to the serial port.  Anyone have any exprience doing this in TesSTand?

    hallawt,
    With your .NET code module, you should be able to call it directly, most likely as a parameter in the .NET method.
    What are the inputs for the method you're trying to use?
    Also, could you clarify where you're starting to have problems in your project?
    Regards,
    Renée M
    Applications Engineer
    National Instruments

  • File transfer of larger size through serial port

    Hi
    I need to transfer files of larger size may be around 20Kb through serial port. Can some one suggest some idea or can provide any sample VI for achieving this. i guess we cannot send the complete file at a stretch, so we may need to form some packets and then send. If i am right i need some help for achieving this.
    Padhu

    You may want to use something like the XMODEM protocol. 
    I believe you can find a version of XMODEM that can be used with an NI-VISA session located here on the OpenG forums.
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness

  • How to send a smartform result through mail?

    How to send a smartform result through mail?

    HI,
    YOu can convert the output of Smartform into a attachment say PDF file & then send it across through mail.
    Refer following program:
    <a href="http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm">http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm</a>
    Best regards,
    Prashant

  • Send command to modem using serial port and capture the response in the labview

    hello.
    I am doing my shool project.
    I want to send command to modem using serial port and get the response in the labview.
    When i run my program and enter"AT", only messy code will be displayed.
    can anyone help me? thanks 

    Dora0512 wrote:
    Thanks for you all. My partner got it already.
    I am doing send sms part.
    Can anyone tell me why my program is not so steadily?
    It means this program can run. But somtimes I cannot receive sms. sometimes can
    Basically, it is not well-written from both a LabVIEW and a communications point of view.  Unfortunately, I can't elaborate because today is an exrtremely busy day at work.  I'm hoping this bump will prompt someone to help you with your problem.  If you could also provide us with the programmer's guide or the manual for your equipment, that would be extremely helpful.
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • LV acquire the print information from the embed board with Linux system through serial port

    I want to acquire the print information by LV from the embed board with Linux system through serial port, like the window hyperterminal tool?
    I try to use VISA serial config function to achieve it ,but lost and prompt that is error like attachment.
    I can't sure that my idea is reasonable.
    help me
    thanks a lot!

    I ended up finding the answer to my problem. After pointing a client directly at one of the DPS systems, I saw the following error in the logs:
    [27/Jul/2009:17:11:47 -0400] - OPERATION  - INFO  - conn=3688 op=4 BIND RESPONSE err=12 msg="The server is not configured to pass through control 1.3.6.1.4.1.42.2.27.8.5.1" etime=0After adding that control OID to the allowed-ldap-controls, I could login via password auth. Adding this control also allowed for password changes to work from a client system.

  • Create and Send an array of hex code to a device through serial port

    My name is Tina Drew,
    I am working programming a project involving an RFID system. In order to get the project to work the way that I desire, it must send a hex code of 01 to start the device and 6A to run in continuous mode. I have part of the program by the device does not appear to be responding to the hex signal. Maybe my programming is incorrect. In addition, it will not read the information from the microreader through the serial port. It says that the time has expired before the operation can be carried out. What should I do? A sample of the program is attached.
    Please contact me as soon as possible at 410-651-7604 or [email protected]

    You forgot to attach your program. It happens to the best of us. I sure wish NI would move the darn attachment button next to or before the submit button.
    Things to check:
    Baud Rate
    Number of stop bits
    Parity bit
    DCE device talking to DTE or vice versa. If both devices are DCE or both DTE, you must use a null modem cable.
    You can use Hyperterminal to see if you can communicate with your device manually (On the hyperterminal screen, hold down the Alt key and type 001 from the numeric keypad, not the numbers from the top row above the letters, a smiley face will appear if the device echos back the character. If it don't, you can setup hyperterminal to display the character - look under file-properties-settings-ASCII Sending-Echo typed characters locally). If you receive a good response, this will tell you if you have the correct baud rate, etc... After proving that this works, make sure your vi's serial port configuration match your hyperterminal settings. You can use a breakout box to determine if you have a good DCE-DTE match. DCE will assert the RS232 signals DSR, CTS, and CD. DTE will assert DTR and RTS. By hooking up a breakout box on one end of the com link, you can see which LEDs are on and this tells you whether you have a DCE or DTE. Most computers are DCE. Modems are DTE. Your device would have to look like a modem to the computer as far as RS232 signals go.
    - tbob
    Inventor of the WORM Global

  • Sending a floating point through serial using VISA

    how do I send a floating point number through a serial port to my microcontroller using VISA Write

    I would recommend the Flatten To String because of being able to change the endiness.  Some systems want Big Endian while others want Little Endian.  It is best to specify.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Control Camera Attibutes through serial port using VISA commands

    Hi there,
    I'm using a Basler acA2000-340kc camera through an PCIe-1473R FPGA as frame grabber.
    I would like to be able to configure the camera through the serial port just in LabView, not using a third-party as Pylon (which I can do now).
    According to this forum post 
    http://forums.ni.com/t5/Instrument-Control-GPIB-Serial/My-Basler-acA2040-180km-NIR-is-not-visible-in...
    this is possible just taking the VI posted here
    https://decibel.ni.com/content/docs/DOC-5049
    and converting from IMAQ to VISA, as RIO frame grabbers cannot use IMAQ. I have been trying to do this by changing the IMAQ vi to their VISA equivalents, but I have no good results.
    Does anyone know which are the steps to go from that piece of code to one that can be used to control the camera in my case?
    Thanks a lot,

    Hi i.popa,
    Basler makes the Basler Binary Protocol Library for serial communication with their cameras. If you make sure you're running the serial server section of your FPGA code to keep the serial port open, you should be able to use calls from this library to communicate with your camera. We have a community example with more information on using the Call Library Function Node to call a DLL. This DLL will take care of all the processes needed to write from and read to the registry, so this implementation will probably be similar to the example program you listed above, using calls to this library instead of the IMAQ Serial functions.
    Good luck with your application!
    Emily C
    Applications Engineer
    National Instruments

  • Help with reading information coming from a software into LabVIEW through Serial port

    Hi,
    I am new to LabVIEW and also an amateur in using RS232 for communication. I have this software that has these icons like speed increase/decrease, elevation up/down, start/stop. Now, when I click these buttons on the software, they perform the appropriate functions. For example, if I press start button, the signal must go through a serial COM port into LabVIEW to start the machine. How do I do that? How do I find what format the code word is when I press a button on the software? And how to decode the information to read whether the button pushed is start etc...? Any help would be appreciated.

    I may not be perfect, but I'm all I got!

    That information would be in the programming manual for the device you're controlling. Unless you have a device that has no documentation or you cannot get the documentation that's the first place you should look. If you cannot get the documentation at all then you've got some reverse-engineering to do. To do this you will either need a serial port sniffer (a hardware device), or you can try to use a software-based port capturing program. On Windows PortMon is the most prevalent. This will show you how the port was configured (baud rate, stop bits, etc). Warning: the information is technical.
    As far as how to get it running in LabVIEW, you should take a look at the serial port communication examples that ship with LabVIEW. The most problems occur in figuring out how to (a) terminate a write command, and (b) determining when to stop reading. For (a) this is typically done by appending a carriage return or linefeed to the command. This is device dependent. For (b) this is usually done by the byte stream ending with a character like a linefeed. Again, this is device-dependent. 
    You may also want to peruse this KB article: Serial Instrument Control Tutorial. There are also lots of tutorial on the internet for basic tutorials on serial port communication.

  • To send multiple operation commands to serial port

    My AC power source is able to communicate to PC via serial port using LABView and I can perform any operation by giving commands in Hex individually, But when it comes to the parallel operation of all the commands or to put them in a particular sequence. I am failing to do so.

    You can only send 1 command at a time.  That is just bus communications 101.  But you can string together many VISA Writes to send the individual commands, one after the other.
    But since if sounds like you are doing this on a GUI based instance, what you want to do is configure the port before your loop and close the port after the loop.  Then inside your loop you just have an Event Structure to key off of the different controls changing values.  You just send the command you need to inside of each event case.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions

  • URGENT: Capturing data through serial port

    Hi,
    My problem is with the use of javax.comm API. I have an RFID tag reader connected to
    the serial port. It is a handheld reader and reads tags when its trigger is pulled. The
    data that is read is sent to the serial port. This is what I want to capture.
    I tried to test the reading operation by running the SimpleRead sample. What I see is
    that I pull the trigger once to read 1 tag, but that generates 3 DATA_AVAILABLE events.
    The tag ID that is read is 16 bytes, preceded by a 3 byte AIM Identifier (that declares
    the following data was read from an RFID tag, and not a barcode which has different
    AIM Identifiers for the different symbologies - but I digress.) By inserting some println's,
    I was able to see that the 19 bytes of data are read 8 bytes at a time. The first 8 bytes
    are read on the first DATA_AVAILABLE event, the next 8 are read on the second event
    and the last 3 bytes are read on the 3rd DATA_AVAILABLE event.
    This is strange & not good for me. How can my application know that the data read in
    these 3 separate DATA_AVAILABLE events is to be concatenated to form a single
    tag ID? Why is the single trigger-pull & tag read operation broken up into chunks of
    8 bytes? Is there some configuration setting that will give me the behavior I want?
    (I cannot rely on the length of the tag ID being 16 bytes always, because the same
    reader will also be reading barcodes where the data may have varying length)
    Thanks for any help. This is really urgent.
    - Ajoy

    please use the [ code ]and [code ] tags for code.
    I don't think you have a problem with the code, it's more like understanding how to make it work.
    to make the read method return.You do not have a read() method.
    The code is behaving as it should.
    You need to use the SimpleRead class as a thread, add and remove the Serial port listener as needed.
    You read all data available, then send it to a method to parse the buffer.
    You can count how much data was read so you know how much to parse.
    I never used receive threshhold.
    Here is example (sample)of my serial port reader
    //SerialIO
       public void serialEvent(SerialPortEvent event) {
            switch(event.getEventType()) {
                  case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
                break;
            case SerialPortEvent.DATA_AVAILABLE:
                this.dataManager.readData();
    //DataManager
    public void readData() {
         String str;
         int     bytes = 0;
         long endTime, now;
         try {
              while (this.owner.isComPortOpen
                   && (SerialIO.inStream.available() > 0)) {
                   bytes = SerilIO.inStream.read(this.buffer);
                   if (bytes > 0) {
                   if (bytes > this.buffer.length) {
                        System.out.println( ": Input buffer overflow!");
         **Here is where you parse your buffer
                   sendDataToParser(bytes, buffer);
              } catch (IOException ex) {
                   System.out.println( ": Cannot read input stream");
          * Stops the serialEvent listener
         protected void stopSerialEvent() {
              SerialIO.serialPort.removeEventListener();
              try {
                   Thread.sleep(2000);
                   flushInputStream();
              } catch (InterruptedException e1) {
                   // TODO Auto-generated catch block
                   e1.printStackTrace();
          * Starts the Serial event listener
         protected void startSerialEvent() {
              // TODO Auto-generated method stub
              try {
                   SerialIO.serialPort.addEventListener(SerialIO);
              } catch (TooManyListenersException e) {
                   // TODO Auto-generated catch block
                   //System.out.println("startSerialEvent in dataManager");
                   e.printStackTrace();

  • How to set the number of packets to be send per second to the serial port in labview

    hi.
                  i have to send data to serial port such that each packet of data should be send at a rate of 4 packets per second?? how can it be done??
    thanks and regards
    Solved!
    Go to Solution.

    What defines a packet?
    You just need to have a while loop that has a wait timer in it of 250 milliseconds surrounding your VISA write function.

  • Send to the request by serial port

    HELP !!!
    Bonjour... et merci de bien vouloir me dépanner ...
    J'ai une application où un automate programmable (TSX57 de Schneider El.) doit communiquer avec un PC par une liaison série RS-232 pour échanger des informations.
    Du côté du PC, j'ai Labview 6.1 comme outil de développement avec IMAQ Vision Builder.
    Je désire que l'automate donne un signal au PC (par le port série), pour que ce dernier exécute un Vi, préalablement généré par IMAQ Vision Builder, qui émettra des informations via l'automate.
    Avez-vous un exemple en Labview ou des explications claires qui me permette d'émettre des caractères "à la demande" du récepteur ???

    Vous devez m'excuser parce-que je ne peux pas essayer une reponse en Francais, mais...
    You will need a loop running in which you read one or more characters from the serial port (using a suitable timeout) and maybe accumulate them in a shift register until you determine that a valid message has been received (or your program has to exit). Then you either carry out your processing or discard the message if it is invalid. I'm sure that looking at the VISA examples will help you work out how to do this. The VISA termination character property can be very useful if your messages are always terminated with a known character such as a CR.

  • How to send files between computers through 8080 port?

    I'm programming an application in JAVA and I need to send one file from my computer (in which I am) to another remote computer through port 8080 (I can configure and install what I want in this remote computer if needed).
    I'm thinking about using servlets and JSP but I don't know if this is the better solution and I don't know how to do it.
    I guess I could install a web server (tomcat) in the remote computer and make a servlet and a JSP (with a formulary to select a file). Then from my computer I could connect to the remote website and select a file, then make a submit, the servlet would proccess the request and it'd upload the file from my computer to remote computer (in which web server is hosted). The problem is that I don't know how the servlet can get the file from my computer and upload it to the remote computer.
    The idea is similar to email at Hotmail,Yahoo... when you select a file as and attachment and then it's uploaded to the server.
    Well, it seems complicated and I don't know if it's the best way to do it. But the most important it's that I can only use port 8080 (due to an intermediate proxy (in my computer side) that I can't configure).
    Please, help, it's very urgent.

    I have a simple servlet class that should get you started.
    http://www.discoverteenergy.com/files/UploadServlet.java
    Here is the MultipartRequest class
    http://www.discoverteenergy.com/files/MultipartRequest.java
    (which was given to me by somebody and is similiar the one from oreilly that a lot of people use: http://www.servlets.com/cos/index.html
    The servlet will show you how to invoke the multipart request. Its one line really:
    MultipartRequest multi = new MultipartRequest(req, uploadDirectory, maxFileSize);
    Hope this helps.

Maybe you are looking for

  • Bluetooth connection - Keeps connecting / disconnecting in car.

    Hi,  I've recently got a Z2 phone and i love it all apart from when I get in my car. It connects, disconnect, connects, disconnnect, and so on and so on for as long as Im driving. I've done all I can think of. Reset the phone, unpair the devices etc.

  • Setting access for one user

    Hi, Our client has ACS server and implemented AAA fro logging into switches and routers through ACS which is being cofigured RADIUS . They are telnet into rotuers and switches from any user but they are want to setting access from only one user . Can

  • Host Credential error

    I tried to perform backup using EM and received error that the password is not correct. I am sure that I entered the password and user name of the database server correctly in the host credential grid.

  • Compass App not in updated ios 7, any thoughts?

    I just updated my iPod Touch, current generation, to ios 7, and the compass app is not there. Any thoughts on how to remedy this?

  • Titles Far Far Away Text Color

    I cannot flush the yellow text color from the Title selection Far Far Away. Can anyone tell me how to do this? All other Titles in iLife 06 work fine.