Sending characters VISA serial connection

Hello.
I am working on a project where I have to write characters to a PIC in the style of a train controller that controls the direction of a train simulation.
I have the basic serial reading and writing working. Labview initially sends a 'S' to start the simulation on the PIC. Then it waits for the PIC to send characters relating to what station the train arrives at. Labview then lights the relevant LEDS on the front panel and then tells the PIC to move with a 'M' 
However, I need to add some extra functions. I want to be able to send additional commands to the PIC such as 'J' to jump a station. 'E' to end the simulation and 'R' for reverse, so the train goes back a station instead of forward. I need these commands to be sent to the PIC when the 'M' is considered.
So basically user sends a 'J' 'E' or 'R' then send 'M' however I am having trouble with this and not really sure where to put it.
I've attached my VI so if anyone could give me some useful hints I would be very grateful!
Attachments:
Simulation2.vi ‏26 KB

Looking at your code more closely... why do you have your Start button wired to the "Enable Termination Char" input of VISA Configure Serial Port?  That doesn't make any sense, nor does the comment next to it.  Outside the while loop, why are you reading a local variable of each indicator and then writing that same value to the indicator terminal?  That's not doing anything.  It would be better to get rid of the local variables entirely.  For example you could do something like this:
Now, on to your question.  What do you mean by "how will this affect my code"?  Try writing it and see.  Start by just duplicating the code you have now, but with a shift register, an enumeration, and 4 cases (matching the 4 states in your current sequence structure). Once that works, you can probably simply add some code to the first case that checks if any command button has been pressed, and if so, send the corresponding character to the serial port.

Similar Messages

  • VISA (Serial port) commands fail in the VI, but work in VISA test panel

    Hi, I have an instrument which has a usb connection. When I connect it to a Windows 7 PC, it automatically picks up the driver and shows up as a "USB Serial Port (COM7) (Manufacturer is FTDI). 
    When I open up NI MAX, this device shows up as COM7 (ASRL7::INSTR) under "Serial and Parallel". And, when I click on Open VISA Test Panel, and try the "*IDN?" command, it works OK.
    However, the VI (which just sends a VISA command "*IDN?") gives me a time out error (0XBFF0015) or a device/resource not present error ( 0XBFFF0011). Attached is a screenshot of the VI. 
    Any ideas why?
    Thanks. 
    PS: I went through the process to create the VISA-USB driver, but that has some other issue, but I am trying to understand why this occurs. This device also has a GPIB port and when I use a USB-GPIB adapter, it works very well. 
    Solved!
    Go to Solution.
    Attachments:
    problem_vi.JPG ‏24 KB

    SysB1 wrote:
    Hi, I have an instrument which has a usb connection. When I connect it to a Windows 7 PC, it automatically picks up the driver and shows up as a "USB Serial Port (COM7) (Manufacturer is FTDI). 
    When I open up NI MAX, this device shows up as COM7 (ASRL7::INSTR) under "Serial and Parallel". And, when I click on Open VISA Test Panel, and try the "*IDN?" command, it works OK.
    However, the VI (which just sends a VISA command "*IDN?") gives me a time out error (0XBFF0015) or a device/resource not present error ( 0XBFFF0011). Attached is a screenshot of the VI. 
    Any ideas why?
    Thanks. 
    PS: I went through the process to create the VISA-USB driver, but that has some other issue, but I am trying to understand why this occurs. This device also has a GPIB port and when I use a USB-GPIB adapter, it works very well. 
    Look up the examples that ship with LabVIEW.  What you have there isn't quite complete - for serial VISA.  While GPIB will work great with what you have, serial VISA requires you to configure your serial port and is a little more complicated to read.
    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.

  • How to use HyperTerminal to send characters to the cRIO

    Hello, I built an RS232 serial cable using three wires interface of serial port (Rx, TX, GND). And I connected it between my computer and the cRIO. I would like to ask is it possible to use HyperTerminal to send characters to the cRIO? What vi. do I need to do so?
    And is my cable interface correct? Do I need to connect other pins besides Rx, TX and GND?
    Thank you very much for helping.

    So did it or did it not work when you typed words in by hand in hyperterminal?  I'm not clear on this from your response.
    What kind of things are you trying to send?  What code do you have on your SBRIO to handle the other end of the communication.
    It could mean your connection failed.  It could mean you have the wrong cable between the two (null modem vs. straight through), it could mean you aren't sending the data in the same way the code on the RIO is expecting.  Look at such things like any termination characters you send at the end of the message.
    It's kind of hard to help without know more details of what you are trying to do and whether it is working for you in Hyperterminal or not.

  • VISA serial not working right in Windows 7

    Howdy.  I wrote a fairly straightforward VISA serial read and write program in LV 2010.  I use VISA write to send a query through the COM port, then use VISA read to get the response and display it for the user.  I do this for several more addresses, then go back to the first one, and then it continues to loop over and over. It works fine when I run it as a vi on my computer, and it runs fine when I compile it and run the executable from my computer as well.  My computer has Windows XP.
    However, when I transfer the exe to a laptop running Windows 7, it either works sporadically, or not at all.  I know LV is installed correctly because a couple other small programs work fine, and as I said this one will occasionally communicate, although usually I'll see the wrong address being displayed.
    At first I thought it was my code, but no matter how many different methods I tried, it would always work perfectly fine under XP, but awful under Windows 7. Then I ran into Windows 7 USB and COM port driver issues with a different, nonrelated software program, so now I'm beginning to suspect it may be Windows 7 that's the culprit and not my code.
    ETA:  LV is the only program running on the Windows 7 laptop, so I know there is nothing else trying to use the COM port.  Plus, I have shut LV completely off and restarted to make sure LV itself isn't still holding the COM port and that didn't help either.
    Anyone else run into something like this?
    Amateur programmer for over 10 years!

    Actually my LV code is talking through a standard DB9 COM port.  It was another software application I use that communicated through a USB-to-COM converter that I found worked fine via plug-n-play in XP but I had to go through multiple steps to finally get it to work under Windows 7.
    Here's a sample of my code.  This is step 4, so I've already established my COM port settings earlier.  It sends out a query, in this case "MD 8009", and the microprocessor will echo back the query plus a value, like "MD 8009 75".  The serial communication in this device is very slow, so I send the message, then I have to loop for a while until I see a response that includes the original string plus more data.  If I don't see a reply that looks correct after so much time, I try sending the query again 20 more times before I give up and flush the I/O buffer then move on to the next address.  If everything works well, I store and display the data, flush the I/O buffer, then move on to the next query.
    Amateur programmer for over 10 years!
    Attachments:
    Com port LV.JPG ‏90 KB

  • How send data to serial port from forms 6i

    How send data to serial port to activate hardware connect.
    The hardware is a drawer for cash the point of sales.

    Andres,
    I do the exact thing you are looking for,
    I spool out a text file using text_io
    the file will either contain a double ^G or an epson escape sequence, depending on the drawer type connected.
    I then copy this file to the port using a copy function id d2kwutil
    Works perfectly, but god knows how I'll do it if we want to run the point of sale over the web :)
    John

  • What property settings to I need to set in order for VISA Serial Read to read ASCII exactly like the legacy serial read vi?

    I have successfully built a vi which communicates with a piece of equipment via the serial port using ASCII characters. I am trying to replace the older versions of Serial Read and Write VIs with the VISA Serial Read and Write VIs. The VISA Write works fine, but the when reading data coming from the "box", the VISA Read VI returns string data with foreign looking characters instead of the usual correct ASCII characters as shown by a dumb terminal which is in parallel with the serial data line. Is there a special property node which needs to be configured on the VISA Serial Read vi, or do I need to set something on the VISA Configure Serial port v
    i?
    Why aren't the VISA serial vis compatible with the older serial vis?
    Thanks...

    Usually, garbage characters are an indication of a baud rate or parity mismatch, or maybe a stop bit or number of data bits setting. Make sure that you have configured your port correctly with VISA Configure Serial Port. I have used VISA serial successfully many times.
    - tbob
    Inventor of the WORM Global

  • Handle Event for Characters At Serial Port in an eventstructure

    I want to write an event driven application for serial communcation without polling for characters at serial port, instead I want to have an event case in the event structure for this event. Is this possible and how can i do it?

    You should be able to execute the example that I posted with an event structure in parallel. I modified the last example so that on thread is waiting for the serial event and then another thread is executing an event structure that just increments a counter. You should be able to increment the counter any time you want and the serial event will complete as soon as a message is read independent of one another.
    Unfortunately, I don't know how to (and I am not sure you can) setup an event structure to work with VISA or DAQ events. If you put your VISA Wait on Event inside of your event structure it will hold and prohibit any other events from executing until it is done. However, if any event fires it will block the other
    events until it completes. If you uncheck the box under the your event properties you can prevent the front panel from locking. This will at least queue up the events.
    I hope this helps out. Attached are some examples.
    -Josh
    Attachments:
    visaRead.vi ‏42 KB
    visaRead2.vi ‏49 KB
    visaRead3.vi ‏49 KB

  • VISA Serial Break does not work

    In my application I need to send a BREAK to wake up my instrument. I have tried using VISA SERIAL BREAK but it doesn't work. Interestingly enough that there is another VI under Functions->Instrument I/O->I/O compatibility->Serial Compatibility->Serial Port Break which works. Can anybody tell me how to use VISA SERIAL BREAK or send me a sample of code please?
    Thanks a lot,
    Konstantin.

    Hello Konstantin:
    Thank you for contacting National Instruments.
    Some instruments need a serial port break longer than 250ms to wake the instrument (which is the minimum time for the VISA Serial Break.vi). Do you get any error message with the VISA vi? What do you exactly mean by it doesn't work?
    What is the VISA version that you have? I hope you have the latest one available from ni.com > Support > Product Reference > Drivers and Updates > Current Versions.
    If you have any questions, please let us know.
    -pavan b.

  • Reading/Writing character commands to serial connection

    Hey! I'm currently working on a project where part of it is to write a labview program to read and write commands through a serial connection to our PIC24F16KA304 board.
    I basically have no knowledge on labview, I've been messing around on it for a few weeks trying to get myself familiar with it but I'm not having much luck.
    Essentially I'm programming a train simulation control box. The PIC board will have a sensor that is connected to a train track that sends the character 'A' (for arrived) when a train stops at the station to lab view. I then want to be able to tell Labview to turn a LED on relevant to the station and then respond with the character 'M' for move. I need to repeat this situation for 6 stations
    I also need to be able to 'R' for reversing the simulation, 'J' for jump (miss a station) and 'E' for end
    If anyone with a bit more experience and knowledge then me can help I would be eternally grateful!

    ChrissyC87 wrote:
    I suggest that you read some of the LabVIEW basics: http://www.ni.com/gettingstarted/labviewbasics
    A state machine would be a good starting point for this project (and your understanding of LabVIEW).
    You can always wire constants to VI inputs on the block diagram instead of having controls on the front panel that you have to type into. Just right click on the VI >> create >> constant.
    The LabVIEW basics will help you out with all of these simple problems. 
    Good luck,
    -CC 
    Mega-Dittos!
    My thoughts exactly. Adding to what Chrissy posted...
    Your question reads like "How do I unlock the door to my car and win the Daytona 500?" The first part is simple (use the constants like Chrissy said) but the second part is much more invloved.
    plese take the advise posted above and go thorugh the tutorials and learn to use state machines. AS yo udo this other questions will come up and you should feel free to start a new thread on ech question. Stick with it, play nice and we'll get you to the finish line.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • PC Suite - no USB and Serial Connection Type avail...

    I have been trying to solve this problem for days now. I have Windows XP and Nokia 5310. After I installed Nokia PC Suite, there is no USB or Serial connection type in the Connection Manager; it only has Blue Tooth and Infrared conection available. I have install and uninstalled PC suite and used PC Suite Cleaner to clean the installation. I also went into the add and remove program in the control panel and click on "change" to fix the Nokia Connection Manager and Nokia Connectivity Cable Driver. It still didn't work. The thing is that the first time when installed PC Suite on my laptop, it did have USB connection option. Later after uninstalled PC Suite and reinstalled it, it start to have this problem. I am extremly frustrated. Can anyone help please?

    Thanks for your reply. I have solved the problem by following your instruction below:
    Go to Start --> Settings --> Control Panel --> Software, there you need to uninstall all Nokia software (Nokia PC Suite, Nokia Cable driver, PC Connectivity Solution ...)
    Download and run Nokia PC Suite Cleaner
    Reboot your computer
    Download and install PC Suite here.
    Connect your phone via USB cable (if possible use a different USB jack) and follow the instructions on the screen.
    Maybe when I uninstalled Chinese version of PC suite, the order in which it was uninstalled was not the one you suggested above. So,I followed your instruction and uninstall order to uninstall PC Suite again. I also uninstalled all the antivirus, spyware, and firewall before I reinstall the PC Suite. It worked; then, I reinstalled all the other security software again after I had reinstalled the PC Suite. Although it worked, I still didn't know what exactly cause the problem the first place, PC Suite version, Security protection software, or the order which it was uninstalled? All it matters is it's working.

  • Using usb as serial connecting to cisco router not working

    Tried using ZOC and securecrt and both shows only /dev/tty-Bluetooth.....
    any ideas how can I use USB as serial connection to router?

    Hi and welcome to the forums!
    GREAT FIRST POST!! Very clear and specific. You don't know how rare that is
    Is the laptop in a docking bay?
    Content "encryption" meaning Content protection is turned off, right?
    Are you able to backup and sync with the Desktop software?
    Do you have the correct folders on the card?
    Blackberry, music, ringtones, pictures, videos, voice notes?
    (blackberry has to be first).
    Last one, how did you format the card?
    Thanks
    Update device drivers manually:
    http://www.blackberry.com/btsc/search.do?cmd=displ​ayKC&docType=kc&externalId=KB13336&sliceId=SAL_Pub​...
    Message Edited by Bifocals on 11-19-2008 08:36 PM
    Click Accept as Solution for posts that have solved your issue(s)!
    Be sure to click Like! for those who have helped you.
    Install BlackBerry Protect it's a free application designed to help find your lost BlackBerry smartphone, and keep the information on it secure.

  • Hello I have an adobe CC id (removed) and I'am using the trial version, please send me a serial number for complete registration

    Hello I have an adobe CC id [removed] and I'am using the trial version, please send me a serial number for complete registration
    [personal information removed... Mod - https://forums.adobe.com/docs/DOC-3731]
    [This is an open forum, not Adobe support, please do not post personal information]

    Creative Cloud chat support (all Creative Cloud customer service issues)
    http://helpx.adobe.com/x-productkb/global/service-ccm.html

  • Memory problem using visa serial functions in my vi

    The last few days i created an application that reads data from one of
    serial ports (contactless card reader). Today i noticed that my
    application had crashed and Windows had displayed a message that my
    system was low on virtual memory. I reset the system and i re-run the
    application, having the task manager opened. I noticed that the memory
    usage of my exe was taking more and more memory (starting from
    21.520KB) as the seconds went by. In 5 minutes my app was using
    25Mbytes! What i do in my application exactly, is opening the serial
    port  then i enter the main while-loop, then every 2 seconds i read
    from the  serial and write them to a tag.
    I have used standard visa serial functions of Labview. When I trace my
    application and simultaneously run TASKManager of windows to see the
    memory, I saw that after running every Visa function memory usage goes
    up!!!
    what must I do? Please help me to overcome this problem.
    Thanks,
    M.Naghipourfar

    Trust me, people use serial communication with LV all the time without losing memory. I can't check the example at the moment, but If it had a problem someone would have caught on to it by now. In any case, even if using the serial VIs causes the memory usage to go up, it shouldn't be dramatic, definitely not enough to crash the application and consume all memory.
    Like I said, post your code (there is an attachment field when you write your message and you can save all your files into a single file by opening the main VI and selecting File>>Save with Options>>Development Distribution) and we will probably be able to find your problem.
    To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
    In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).
    Try to take over the world!

  • RT Network Shared Variable and Visa Serial Instr class

    Hi,
    I'm using Labview 2009 SP1 with the RT module. I've had no problems creating a RT Target application and a Host PC application which are interconnected using Network Shared Variables, until I came to the COM ports fitted to the RT Target (PXI Embedded Controller and 2 x 4 port COM cards).
    I can configure and use the COM ports in the RT Target application providing I use constants to define which COM port to use, i.e. VISA OPEN function accepts hardcoded "COM2" , (VISA Serial Instr class).
    But I want to pass the COM Port resource name from my host application. 
    Is there a suitable Network Shared Variable I can create ? or how do I change the string value (COM Port name) of the VISA Serial Instr class variable in the RT Target application ?
    thanks,
    Gary.

    Hi there Gary,
    Thanks fot the post. I think I have found something that may be if use to yourself.
    http://labviewwiki.org/Functional_global_variable
    This is the functional global variable.
    Take a look at it and let me know what you think!
    Many thanks,
    Liam A.
    National Instruments
    Applications Engineer

  • Proper serial connections for Sun Fire v250

    I recently purchased a (gently) used Sun Fire v250 for use as a workstation. The machine had a graphics card installed by a previous owner, but I accidentally reset the factory defaults on the SCC (I was having a boot problem, and apparently a brain problem).
    My question is, how do I connect over serial to make the default boot up options 'screen' instead of 'ttya'? I know from the oracle docs that I need a specific type of serial cable, but I'm unsure where exactly I can go about finding this. Also, once I get the cable what software (for *NIX or windows) can I use to reset the SCC?
    Thanks,
    John Lambert
    Dychron, Inc.

    984429 wrote:
    I recently purchased a (gently) used Sun Fire v250 for use as a workstation. The machine had a graphics card installed by a previous owner, but I accidentally reset the factory defaults on the SCC (I was having a boot problem, and apparently a brain problem).
    My question is, how do I connect over serial to make the default boot up options 'screen' instead of 'ttya'? I know from the oracle docs that I need a specific type of serial cable, but I'm unsure where exactly I can go about finding this. Also, once I get the cable what software (for *NIX or windows) can I use to reset the SCC?
    Thanks,
    John Lambert
    Dychron, Inc.Search for a cisco console cable .... this is a typically a 9 pin to RJ 45 ... usually less than say $10 on at least well known auction site.
    If you laptop/desktop does not have a serial get a usb to serial converter as well.
    If you have a linux desk OS then it is possible to connect to a serial connection ... from solaris you would use tip .... from linux typically use 'cu' (built it) ... if I remember correctly.
    Or use recent versions of PuTTY from windows. ... which can also be configured for serial.

Maybe you are looking for