Serial IO using LabVIEW CLFN

BACKGROUND
I have written LabVIEW wrappers for a DLL device driver. One function of the DLL responds to hardware interrupts and one input to this function is a pointer to a user function (to be called when an interrupt occurrs). Since a LabVIEW CLFN can not accept a pointer to a function I wrote a wrapper DLL which accepts a Dynamic User Event Reference and internally calls PostLVUserEvent(userRec2, &testData);
so far so good.
The PROBLEM:
Another input to the function accepts TYPE which defines the communication protocol. Options are ARINC 429 (an aviation standard), serial 232, serial 485. I tested this originally using ARINC429 and everything runs great. When 232 is selected, immediately upon an interrupt LabVIEW locks up requiring Task Manager to quit LabVIEW, or in somecases powering down the PC. In C code the sample runs fine. The problem (in LV) appears to be in handling the interrupt only when serial is selected. My wrapper DLL includes three header files: #include "extcode.h" #include "hosttype.h" & #include "std429.h"  I have confirmed with the client that their header "std429.h" includes serial IO and serial prototypes (I was hoping that was the issue). Would there be any other #includes necessary (or any other "known quirks") with using LabVIEW to access Serial IO through a DLL?
thanx
lmd2
Lawrence M. David Jr.
Certified LabVIEW Architect
cell: 516.819.9711
http://www.aleconsultants.com
[email protected]

Okay, more information: the code seems to be working to a point. The action that we are using to trigger the interrupt is keyboard input from a hyperterminal configured to 9600 baud. The VI runs fine until I type a single letter. At this point the processor gets pegged (Task Manager is open and minimized). Within the event structure I have just an increment (for the time being). Hitting a single letter should trigger a single interrupt and I should see my probbe go from 0 -> 1. Because everything is bogged down (processor pegged) the probe doesn't update for a while but when it does it says over 7K. As I am typing this I just saw another update (I have NOT typed more than 1 letter) the probe now reads 27084
So what should have been a single one time event seems to have latched somehow ON and is continuously firing and using 100% of my processor.
This make sense to anybody?
thanx
lmd2
Lawrence M. David Jr.
Certified LabVIEW Architect
cell: 516.819.9711
http://www.aleconsultants.com
[email protected]

Similar Messages

  • How to transfer file from PC to PC via serial port using labview

    I need to transfer files(.txt, .doc, .xls) from PC to PC via serial port using LabVIEW. Is it possible to transfer files, if so how to transfer?
    Solved!
    Go to Solution.

    Yes, it is possible to transfer files with the serial port using LabVIEW.  Files are just collections of bytes and the serial port is pretty good at shipping bytes from one PC to another.  You need to connect the serial ports together with a null modem cable.
    First, take a look at the example for serial communication.   In LabVIEW, go to the Help menu and select "Find Examples...".  From there you can search for "serial" or navigate to Hardware Input and Output >> Serial.  Select the "Basic Serial Write and Read.vi".  Experiment with that example to gain confidence on the serial communication methods.
    Next, it's time to learn about how to read and write files.  For that, the examples could be somewhat confusing since they all deal with files that are presumed to have data of a specific type in them.  I would recommend just getting familiar with the functions on the File I/O palette.  Specifically, get to know the following functions.
    Open/Create/Replace File - On your destination side, you'll need to create the copy of the file that you are trying to transfer
    Close File - When you are finished reading from or writing to a file, you should close it.  It cleans up the memory being used and finalizes any write operations that are still floating in the write buffer.
    Read From Binary File - The best way to read from a file when you do not really care what type of file it is.  In your case, you just want to get those bytes read and sent out so they can be written down at the destination.
    Write to Binary File - At the destination side, this is what will store those bytes to the file you created with number 1.
    Get File Size (under the Advanced File Functions sub-palette) - You need to know how big the file is so you know when you are finished.
    OK, so once you are able to create files, write bytes to them, and read bytes from existing files you can move on to transferring.
    The basic method I would suggest is to have the user specify a source file on the source PC and a destination folder on the destination PC.  Then, find out the size of the source file using number 5.  Divide that size number by the number of bytes you feel like transferring at once.  The serial buffers are usually around 32k (if I remember correctly) so do not exceed that.  Now begin sending data by reading some number of bytes and wiring that string output to the VISA Write function.  On the destination side, you'll want to be monitoring the serial port for bytes and reading them when they arrive.  Wire that string to the Write to Binary File function to add them to your destination file.
    That is the basic outline of how to do it.  You have to be careful not to overload the write and read buffers on the serial ports.  Initially you can use delays on the sending side to make sure the reading side has enough time to digest.  To get things moving faster, you can bring in some flow control.
    If all that sounds a bit intimidating, there are Alliance Member companies out there (such as PrimeTest Automation) who can write such code for you and even provide a turnkey solution for you.
    Happy wiring,
    Dan Press
    Certified LabVIEW Architect
    PrimeTest Automation

  • Communication through RS232c serial interface using labview

    i am trying to communicate with a device through RS232c serial interface using labview 6.1....i have tried to run the example "Serial communication.vi" provided in 6.1 and it doesnt work....do i need any special hardware or do i need to configure my hardware to communicate through RS232c...
    thanks in advance
    shri

    Seems like I placed a small (maybe 30ms) delay at the end of the serialcommunications.vi structure.. for some reason my PC didn't like running as fast as it tried to go. Also look into the actual serial communication.vi and open the vi's inside it - check that the port setting (0 or 1) are ok, the baud rate (probably 9600) are ok. I'm running with only three wires in my application, TX, RX and Common. The PC may need to be rebooted to enable the com port - or use device manager and see if it says the com ports 0 and 1 are both OK..
    Try buildinga loopback plug with TX to RX, RX to TX, and Common to Common and see if hyperterminal (or other serial communications program works - there is also Loopback.VI in the NI library somewhere that can be used. Good Luck!! Dave

  • How do I control serial power using LabView?

    I need to use LabView to alter the voltage coming from the serial port. Is it as easy as writing to the serial port? I know that if you write to the serial port that it'll produce a binary number, does this binary number correspond to a voltage.

    If you want to create a scalable voltage value coming from the serial port you must have a Dig -> Analog conversion circuit.
    If your goal is to vary a voltage from 1 - 10 vdc, then you must create:
    1) a an external circuit that will convert/buffer digital serial interfaced binary values to analog values (ni makes these things)
    2) labview code that transfers info to serial port. (driver/etc)
    hope that helps!
    did that answer your question?
    Chances are if you have seen VI in the forest it hasn't fallen.

  • Problems with Serial Communication using Labview 6 and Solaris 8

    I am working on a Driver for a Temperature Controller. But I am stuck at the very basics. I am using Labview 6 and the platform is Solaris 8 on a SUN Ultra 60 Workstation. I can not get the Serial communication to work. When I am running raw (uncompiled) code it works (I can read from and write to ttya and ttyb) but once compiled I get error code 37 (device not found). I have tried the following steps to fix this with no luck.
    1) I made sure that the "serpdrv" file is in the same folder with the executable. I also make sure the serpdrv file is added as a support file when building the app.
    2) I changed from using traditional serial VI's to labview 6's new visa functions. With these "new" VI's when
    I try to initiliaze the visa device and wire a control to the "visa reference" input only 1 serial port shows up (ASRL2, missing ASRL1). I am not sure if this is part of same problem or whole new issue.
    3) I reinstalled both visa and labview 6.0.2 update hoping this would help with no luck
    4) I placed the following entry into the ".labviewrc" file
    labview.serialdevices: "/dev/ttya:/dev/ttyb"
    If anybody has had the same problem I would love to hear about it and if you have any solutions
    Jamie Shea

    Hi Jamie,
    1. Do you have NI-VISA driver installed on the machine on which you are running this executable?? If you are trying to run the executable on the same machine on which the development program has ran fine, then you can ignore this point.
    2. If you have done all the changes that are suggested by other discussions related to this topic, then try changing the Port input to Visa Serial Configure.Vi from a control to a constant and try it. In some case, I have seen this to do the trick. I think this point should solve your problem. If it does do tell me. :-))

  • "how to read serial port using labview 6.0"

    sir i am doing a project and is in a need to extract data from serial port. can anyone help me

    This link, and the links from it, are a great place to start:
    http://zone.ni.com/devzone/conceptd.nsf/webmain/8DECBF3E0B714BF3862568F9006E7851?opendocument
    2006 Ultimate LabVIEW G-eek.

  • Serial Communication using Labview with Tiva C launchpad ARM cortex M4

    I am able  to comunicate perfectly  between labview and launchpad at 9600 baudrate..When i trying to communicate with bauadrate of 115200 labview gives error "specifed state of attribute is not valid"
    I tried to communicate with serial monitor comes with arduino and its well work with it at 115200 baudrate...
    Awaiting for your replay!!!

    piZviZ wrote:
    Only data rate working is 9600  between labview and launchpad(arm cortex m4).Where all data rates work between Arduino serial port monitor and launchpad(arm cortex m4).
    Since the only thing that changed is the Launchpad, then that must be the issue.  Are you sure this device can handle more than just the 9600 baud rate?  Are you sure you are even setting the baud rate on this device?

  • How can I use LabVIEW to send the equivalent of a CTRL D (in VT 100 format) out the serial port of my computer?

    I am trying to write a vi that interfaces with a piece of OEM equipment that is set up to talk with a VT 100 terminal. I can't seem to locate the ASCII equivalent string (if there is such a thing) of a CTRL D. Is there a vi that emulates VT 100 commands?

    If I recall, CTRL-D is EOF on most ASCII tables.
    You'd probably have to use an escape sequence
    or if you can use an unsigned 8-bit that might be
    easier.
    In article <[email protected]>, TLS
    wrote:
    > How can I use LabVIEW to send the equivalent of a CTRL D (in VT 100
    > format) out the serial port of my computer?
    >
    > I am trying to write a vi that interfaces with a piece of OEM
    > equipment that is set up to talk with a VT 100 terminal. I can't seem
    > to locate the ASCII equivalent string (if there is such a thing) of a
    > CTRL D. Is there a vi that emulates VT 100 commands?

  • Using serial Ports in LabVIEW

    i am using LabVIEW 6.1 on windoes NT 4.0. what modes are supported? i need to use RS 422. is this possible?

    Be very careful about installing non-standard serial cards in a PC
    running NT. The NTSERIAL driver will try to control these non
    standard cards (but won't be able to) and won't let the manufacturer's
    driver control it unless you follow the card manufacturer's
    instructions to the letter. Typically this involves installing the
    manufacturer's software FIRST, setting the configuration, setting any
    dipswitches or jumpers on the card, and THEN LAST, powering down,
    installing the card, and powering back up. BUT PLEASE FOLLOW THE
    MFG's INSTRUCTIONS, not mine if they differ.
    Blackbox makes an RS422/485 card and I believe so does NI.
    Douglas De Clue
    LabVIEW programmer
    [email protected]
    Sanjay wrote in message news:<50650000000500000063
    [email protected]>...
    > 1) The standard/built-in serial ports on your computer are almost
    > certainly not RS-422 compatible (they're actually almost certainly
    > RS-232). NI (amongst other serial vendors) sells RS-485 serial
    > interfaces that are fully RS-422 compatible.
    > 2) From a software standpoint you can use the VISA-Serial VIs
    > (recommended) or the I/O compatibility VIs to control either RS-232,
    > RS-422 or RS-485.

  • I have developed one application software using Labview 8.5 in which i am collecting data from 5 temprature controllers on serial line.

    I have developed one application software using Labview 8.5 in which i am collecting data from 5 temprature controllers on serial line.
    This software is done and successfully installed on customer side.
    Now the customer want this software to be run on server and some fixed number of clients should access this with some login security.
    Is this fascility available with National Instruments in which i can installed this standalone application in server and allow some clients to access this with
    proper login?
    Regards,
    Vaibhav

    Yes, that is possible. Multiple clients can access the VI using Web Publishing tool and control the VI operation. However, only one client has the control of the VI at one instance. The client needs to right click on the web page displaying the front panel of the running VI and ask for control and then release control after the execution to let other clients to ask for the control subsequently. The LabVIEW VI needs to be running upon the server computer since closing LabVIEW also closes the Web Publishing server and disconnects the currently connected clients. 
    Please check this link http://zone.ni.com/devzone/cda/epd/p/id/3797
    You might want to create a stand alone executable for the same and then publish it over the internet for access by your desired clients. In that case, check this link http://digital.ni.com/public.nsf/allkb/3A0087DBE9D31F9286256B19000A2DAE?OpenDocument

  • Using LabView to serial interface my microscope how I make a user interface to make the stage move by pressing buttons?

    I have used LabView very little and am trying to write a program to control a microscope. I want to be able to give it commands such as to get the stage to move left, right, forward, back, and return to zero. I'm having trouble implementing the code into my block diagram. I've been reading LabView 8.6 tutorials for a couple of weeks and I'm still learning. What I know that  is that I need a event structure inside a while-loop for the user interface but I've been stuck.
    Thanks for any help! If you need me to try and provide more information please say so.
    Attachments:
    Button.vi ‏21 KB

    Alright so my serial port code should be inside a while loop unfortunately it doesn't work whenever I enter a command to move the stage. It sits there maybe I'm missing something.
    So let me give you an overview to what happens in my code, so the configure serial port is very crucial. The VISA Write writes the bytes to the port. The first VISA Write takes the string to write command. I connected the second VISA write to make it easier whenever I enter a command, the \r will iniate the command as a whole. Example L\r will move the stage to Left once, ending up at VISA Read then closing. All of this found in separate case structures.
    Now the user interface to control the the movement of the microscope is one of my issues, making several attempts to make it work yielded no results. My best work not the best but a attempt is attached, also one of the things with this I'm having trouble with is getting the button to talk to the stage. On previous buttons I worked on I could press the button and light up an LED on the front panel, I thought the same principle would relate to the movement of the stage, no such luck.
    I hope I cleared up some misconceptions on my part, I appreciate your patience.
    Attachments:
    OptiScan.vi ‏14 KB

  • How do I establish serial communicat​ion using LabView to two stepper motors using a motor controller​?

    I currently use an off the shelf motor controller to run my two stepper motors. It already has integrated a firmware software that sends commands to operate each motor. I would like to create an interface where I can send these commands using LabView. If someone can point me in the right direction I would appreciate it.

    Look at the examples for the serial VISA vi.  Something like Basic serial write and read.vi is a good starting point.
    Have you searched for a LabVIEW driver  at the NI LV driver network?   Asked the vendor?
    If you write your own driver with the serial VISA vis remember to open and configure the port only once at the beginning and close it at the end of your program. 
    Message Edited by Henrik Volkers on 07-13-2009 04:21 PM
    Greetings from Germany
    Henrik
    LV since v3.1
    “ground” is a convenient fantasy
    '˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'

  • Can I use LabVIEW to load data directly into system memory? The serial card I'm using isn't supported by NI nor does VISA recognize it. I'm using a Win32 function to read the data from the card and now I want it to go directly to system memory.

    Can I use LabVIEW to load data directly into system memory from a VI? The serial card I'm using isn't supported by NI nor does VISA recognize it. I'm using a Call Library function to read the data from the card and now I want it to go directly to system memory.
    The data is being received at 1Mbps.
    Thanks

    Two questions:
    One, if it's a serial card, then presumably it gives you more serial ports, like COM3, COM4, etc. If so, VISA would see the COM ports, and not the card directly. The drivers for the card should make it so that you see the extra serial ports from the OS. If you don't see the extra COM ports from VISA, then it sounds like the drivers for the card are not installed properly. Do the extra COM ports show up in Device Manager?
    Two, you said that you're using a Call Library function to get the data and you want to put it into system memory. Errr.... you just read the data and you have it in memory by definition. Are you saying you need a way to parse the data so it shows up on a graph or something?

  • I use LabVIEW 7.1 but I have some problem when, I use LabVEW to read the data from serial communication

    I use LabVIEW 7.1 but I have some problem when, I use LabVEW to read the data from serial communication.
    I use LabVIEW to read the data from serial communication then, i open the example (.vi) from Serial Communication - Advanced Serial Write and Read  from LabVIEW Example. BUT it have some error message that : Error - 1073807202 occured  at property node in visa configure serial port (instr).vi -> advance serial write and read .vi
    this error code is undefined. no one has provide a description for this code, or you might have wired a number that is not an error code to the error code input.
    I don't know why? please help me. thank you.

    When I copy that code into "Explain Error" I get: "VISA:  (Hex 0xBFFF009E) A code library required by VISA could not be located or loaded."
    You may have a bad install of VISA or the wrong version of VISA loaded. Try re-installing VISA. You can get the latest version from the NI support site: http://digital.ni.com/softlib.nsf/webcategories/85256410006C055586256BBB002C0E91?opendocument&node=1....
    Also ensure that you are not pointing the example towards a serial port that does not exist.
    Please let us know what you find and what gets this working for you.
         Rob

  • I never used LabView but need to generate a RS-233 serial output string that contains an IRIG timestamp based on a contact closure. Is LabView an appropriate tool to do this? How much does it cost to get started with the product?

    I never used LabView but need to generate a RS-233 serial output string that contains an IRIG timestamp based on a contact closure. Is LabView an appropriate tool to do this? How much does it cost to get started with the product?

    Labview isn't cheap, but it would certainly allow you to build a program (set of vi's - virtual instruments) that would do what you describe. Where would the timecode information come from? Your vi, or program, would: Start up, initialize the serial port, loop until a trigger happened, read the timecode (from where?), output that timecode out the serial port in a loop until you pressed the stop button. There is a free evaluation of Labview software available from NI - the base product itself runs about $995.
    - Dave

Maybe you are looking for