Termination character for RS232 Instrument

I have an instrument that I am trying to communicate with via RS232.  I am having a difficult time figuring out how to write a command to the instrument using the VISA write VI.  I am able to successfully communicate with the instrument using a software program called Terminal (similar to hyperterminal).  A typical command starts and ends with ^m in Terminal.  For example, here is the command ^md01v00,00^m that returns the heat rate.  How do I write this command in the VISA write VI?  Is the ^m an unprintable character in LabVIEW that is represented in some other format?
Attachments:
Screen Shot.jpg ‏30 KB
test.vi ‏26 KB

Hi SumTumWong,
I'm thrilled to hear that you resolved your serial communication issue.  As for your framing error that occurs, this is a common issue and we have a Knowledge Base article that explains what this error in full and how to resolve it.  The most common reason why this error occurs is that your serial port and device are configured to use a different settings.  The article shows how make sure that the settings of both your serial port and device are configured properly using Measurement & Automation Explorer (MAX).  Let us know if you have any more questions.  Have a great day!
Regards,
Todd Venable
National Instruments
Applications Engineer
NI Prototyping Community

Similar Messages

  • How can I define more than one termination character for RS-232 interface communication?

    Hi,
    I have to communicate through the PC's RS-232 interface with a microprocessor board. I am using the "Advanced Serial Write and Read.vi" out of the LabVIEW examples and it works on principle.
    My problem is the termination character: It looks like I just can set one termination character, EITHER 0xA (so LF / newline) OR 0xD (CR / carriage return), but I have the need to react on various termination characters like "<CR> <LF> <CR> <LF> OK <CR> <LF>" or "<CR> <LF> <LF>"; which I would like to set in a control (this VI will be used in a TestStand sequence).
    Is there a way to do that, so that I can set wichever termination character(s) I need? The property node in "VISA configure serial port" just accepts an unsigned integer, nothing else. Sure I can get it running with the timeout - but this is not very nice and extends testing time unnecessarily.
    Thanks & Regards!
    Regards,
    gedi
    Solved!
    Go to Solution.

    That would be for the write. The poster is asking about the read. For the read you will need to write your own read routine. You will basically need to use a loop and inside the loop use the VISA Bytes at Serial Port to see if there's any bytes available. Read that many bytes, and append them to a string that you build up in a shift register. After concatenation check to see if you've got the termination characters. If so, the read is done. Fairly simple. Be sure to turn off the termination character enable in the VISA Configure.

  • Termination character for serial write

    Hi there,
    (LabView 6.02 on Win2k)
    Trying to communicate with a serial device I open a VISA-session on
    COM1 and it all works fine except that I'm not able to configure a
    termination character.
    I've tried the as well as the VISA property
    nodes. But I never get the desired termination characters (0xA or 0xD)
    sent to the port.
    What am I doing wrong?
    Thanks in advance,
    \Ulli.

    finally I found out the following:
    For the VISA session you have to setup (by means of property nodes)
    not only and
    but also set to "TermChar". Now everything
    works fine :-)
    Bernd-U. Seifert wrote:
    > Hi there,
    >
    > (LabView 6.02 on Win2k)
    > Trying to communicate with a serial device I open a VISA-session on COM1
    > and it all works fine except that I'm not able to configure a
    > termination character.
    > I've tried the as well as the VISA property
    > nodes. But I never get the desired termination characters (0xA or 0xD)
    > sent to the port.
    >
    > What am I doing wrong?
    >
    >
    > Thanks in advance,
    > \Ulli.
    >

  • How can I implement 'WaitCommEvent' in VISA for RS232?

    I am trying to use VISA to control my RS232 device as a beginner.
    I would like to know how I can implement a fuction 'WaitCommEvent' of VC++ in VISA. The usage is as follow(You can check it in MSDN):
    WaitCommEvent(hFile, lpEvtMask, NULL);
    The function waits until any event happens in RS232. For example, if a character is available in buffer, the function stop.
    If I open RS232 connection with CNiVisaSession, what corresponds to 'hFile?.' Or, how I can implement the function in VISA?
    Thank you very much.

    Hi,
    One option for you here that could be very easy is to set the timeout for a very large value, then just make a read call to the serial port. The function will not return until the timeout completes or when you receive the data. You may need to play with the termination character and the number of bytes you read depending on the data that you expect to read.
    Make sure that you take a look at the examples that ship with MStudio.
    I hope this helps.
    Regards,
    Juan Carlos
    N.I.

  • Termination character

    Hello,
    I'm communicating with an 20 years old optical spectrum analyzer with GPIB connection using VISA.
    I having trouble reading the entire data. I've try to use the termination character options to solve this but my instrument use both line feed and EOI termination codes.
    I've found this help text: http://www.ni.com/white-paper/4256/en/
    but could understand it to the end.
    what is the symbol accepting the arrow symbol at and zero constant at the end? where should I put this property node in case I want to read many bytes ending with the above characters? before VISA - WRITE? after VISA read? and how can I combine two termination character? how do I represent two EOI?
    thanks, Avishay

    Specify too many bytes to read and the visa read wil stop on the first end character or eoi that appears.
    For two eoi's read twice.
    greetings from the Netherlands

  • Termination character enable

    I am connected to hardware via an RS-232 cable and am using VISA’s to request and read information from memory addresses. When I encounter a 0x0a (hex) in memory, the VISA Read stops reading because it thinks it has read the termination character. This only happens when a 0x0a is encountered, all other characters from 0x00 to 0xff are read in correctly (provided there isn’t a 0x0a in the location).
    I have set the Termination Character Enable property node to FALSE and it doesn’t seem to help (Ver 6.0.2). Any help on disabling the Termination Character would be appreciated.
    Thanks,
    DH

    I would think that setting the Termination Character Enable to false would prevent this. Maybe something else is turning it back on. If you use the VISA Configure Serial Port.vi (In instrument I/O>>Serial) it will turn this setting back on. So make sure you turn it off after any of these functions. One other thing that have done is set the Termination Character to 0x00, although I'm not sure what would happen if you got a 0x00 (NULL?) back from the port. Also check for other functions that may alter these settings after you set them.
    Hope this helps!
    Brian

  • Why do I get a "termination character was read" warning with VISA read and TCPIP?

    I am using VISA Reads with TCPIP raw sockets without issue with NI-VISA 3.0.1 but when I moved to NI-VISA 4.4 I was getting timeout errors.   The timeout errors went away when I set the termination character enable property to true (which seemed to be default in NI-VISA 3.0.1), but now I get a warning stating that the "termination character was read".   
    Can I disable this warning?   Can I set the termination character enable to default?   How can I get rid of this annoying warning?
    Solved!
    Go to Solution.

    Hey Dagwood,
    Unfortunately there isn't a way to globally change the attribute VI_ATTR_TERMCHAR_EN to VI_TRUE.  I spoke with R&D about possible use of the registries and they say it's not accessible through that.  To address why this change was made, the developer who made the switch isn't around anymore so I can't find his reasoning as an explanation for you.  The best this for you to do in your code would be while initializing, use the VISA Property Node to make the change and until that VISA Resource is closed, this change will remain set to the value you assign.  I'm sorry we cannot provide any other solution for this inconvenience.  Also, if you feel this is a large burden on your programming practice you can definitely submit a product suggestion for the ability to change global default values for VISA attributes.
    Thanks,
    David Pratt
    AES - Test Side Products
    NIC

  • Same error cluster for different instrument drivers?

    Hi All...
    mz question is regarding error cluster wiring for different instrument drivers. As u can see from attached file, i have 3 different devices with drivers. At the beginning i initialize and configure each one by wiring adresses and error clusters individually. After that i want use measruement vi's with an order. That s why I would like to use same error cluster for those 3 different measurment drivers as illustrated in the picture. is it possible?
    second question is that at the beginning in the initializing process, i do not set any order of those 3 devices. VI would try to initialize all of them at the same time which is not possible due to serial GPIB? Do i need to determine any sequences of initializing of devices?
    thanks
    Attachments:
    vi scheme.JPG ‏19 KB

    Your sceme is fine. The error cluster is a generic container to pass any error that can occur from one function to the next. Normally, if a function has it's Error In terminal connected and an error is passed in from a previous function, that function will not do naything except pass the error through so it can be handeled in you code.
    Since your running on serial, just "serialize" your initialization functions using the error cluster to set the order. This way only one will be running at a time. It doesn't matter what order.
    Ed
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.

  • Serial port termination character status?

    Hello,
    I need to read a message from a serial port and I'm having some problems. I used the advanced serial communication example and came up with the attached program. Everything works perfectly fine except for the fact that if no message is sent for 10 seconds as designed the serial read outputs an error. I know normally I can check to make sure there are bytes at the port before I do a read operation which solves this problem. However, when using the buffer to terminate the read once a termination character is provided the bytes at port property always returns 0 so I can't use this as a conditional for reading the port.
    Is there a way to prevent the serial read from timing out in the attached program? Thank you.
    Attachments:
    serial_buffer.gif ‏19 KB
    serial.vi ‏15 KB

    Let me maybe give a bit more details about the application. I want to be able to get any amount of characters as a string that someone inputs in to the serial port. This will be a computer so I can expect the commands to usually be valid but I want to provide some additional redundency incase a person at a terminal is writing commands. The commands might be "measure 110" or it might be "set 23 34". So the amount of bytes being sent will depend on the command. I used 1000 as the byte count on the read just to provide as much room as possible, setting it to 100 doesn't really make a difference in this application, the same thing happens. If someone starts typing in a terminal "measure 110" (for example) but forgets to hit enter for the termination character the program will time out since the error cluster is connected to the stop button of the loop. When this happens the entire program needs to be restarted. Not really ideal.
    If I disconnect the error cluster from the stop button I noticed it works perfectly fine. After 10 seconds of the terminator character not being entered the buffer clears and the loop simply restarts. What I worry about is if there is some other fatal error (such as not being able to connect to the serial device) that the program will keep running. Is this something I even need to worry about?
    Attached is a screenshot of my latest program which works great but like I said I'm just worried about not wiring the status from the error cluster to the stop button since that seems to be what I've always been taught to do. If I wire the byte count to the number of bytes property it will only collect the number of bytes I set, since this will vary based on the command that won't really work in this application.
    Attachments:
    serial_buffer.gif ‏20 KB

  • Serial Recieve with termination character

    Hi All,
    I have developed a seqence fileto transmit data on the serial port and loop back to recieve the data on reciever of same port. I'm transmitting "Test
     Serial" (Note: I'm not transmitting "Test\\rSerial") and recieving the data with termination character "carriage return".I'm using ASCII value 13 for the carriage return,but the recieve is not terminating on carriage return.
    It seems Teststand is not able to recognize "13" or "\r" is seen as 2 character.
    I'm attaching the sequence file for your perusal.It would be great if somebody can suggest me ways to make this work.
    Thanks in advance.
    Regards
    VDC
    PS: IVI serial driver need to be installed.You need to select Serial driver in device driver installation
    Attachments:
    SerialReadWrite_Term.seq ‏23 KB

    HI,
    I tried to find this dll, where is it located?
    If this is using "IVI" then you could see every action in NI-Spy !
    I watched you code. Another thing you could try is disabling the caching. Try Cache=0
    now data shold send very time to your device by the IVI engine
    Juergen
    =s=i=g=n=a=t=u=r=e= Click on the Star and see what happens :-) =s=i=g=n=a=t=u=r=e=

  • How use any digital out for rs232

    hi !
    how use any digital out for rs232 for LPC2368,2378 ? is it realy ?
    thanks for answer

    Sergiv,
                 I don't know which LabVIEW Embedded product you are using (LabVIEW for ARM or the Microprocessor SDK) but there are shipping examples that walk you through basic DIO and Serial communication (for the LM3S8962) that you should be able to port over to your hardware. The two shipping examples are called DIO.lvproj and Serial Comm.lvproj. You can find these shipping examples in the Example Finder (Help>>Find Examples..) under the section called Toolkits and Modules and then under the ARM section.
    Grant H.
    National Instruments
    LabVIEW Product Marketing Manager

  • Termination character enable is FALSE but active

    When opening a new VI and starting to write code (in the other words, no special initialization is done to the serial port settings, as yet), the Term Char Enable indicates FALSE. The reads do get terminated with \n (\x0A). After a little while, I found in the support that actually one needs to check a different attribute (ASRL End In), in order to have the correct picture. Is this behaviour by design (??!!!???), or is it a bug?
    Sincerely,
    Albert Lysko

    In VISA Configure Serial Port, setting Enable Termination Char to true (the default mode) does two things. It sets the VISA Message Based Settings property Termination Character Enable to true, and the Serial Settings property Serial End Mode for Reads to termchar. The serial end mode for writes is not set in the function and if you want to terminate each write operation with a termination character, you have to set Serial End Mode for Writes to termchar.

  • SR830 data storage for rs232

    Hi,
    I found a LabVIEW code here which can storage data from input signal (e.g.A/I)in SR830 and transfer it by the GPIB.
    I used function generator to generate a sine wave with frequency:30Hz& Vp-p:100mVolt , conencting to SR830.
    Clearly ,I got a correct result when i used the code by GPIB communication interface(left graph).
    Than,I tried to change the communication interface RS232 to accept the same signal,but it has mistakes(right graph).
     Here is original code "data storage for GPIB"
    Here is rewrite code for RS232 by myself,but what's wrong i did?
    Attachments:
    SR830 DATA STORAGE EXAMPLE.VI ‏54 KB
    scan test1.vi ‏43 KB

    The SR830 expects three integer arguments (separated by commas) for the TRCA? query:
    * i = 1 or 2 specifies which buffer to download from
    * j >= 0 specifies the starting point
    * k>=1 specifies how many points to download
    If you know k, you can calculate the exact number of bytes in the response. For your code, which downloads 4000 points at a time, that will be something like 60 kB (if memory serves, the response in ASCII transfer mode is 15 bytes/value). Make sure that you're not hitting any timeout or serial buffer size limits with a transfer of that size.  
    Edit: You have your bitrate set to 9600 baud (1200 bytes/second) and a 10 second timeout. That will read 12 kB before timing out, or 1/5th of your transfer. The 830 supports baud rates up to 19,200, which will help, but you'll also need either a longer timeout or to transfer your data in smaller chunks. 

  • ENET-232/4 doesn't seem to work for some instruments

    I have an ENET-232/4 and it works for some analog-digital interfaces I'm using but doesn't work for other instruments. I tried using a Shimadzu LC2010 with it, it configured OK, but the instrument wouldn't start a run. I tried a Thermo TraceGC and it wouldn't even configure through it. But simple A/D interfaces (PE Nelson boxes, SS420X, etc.) are working fine.
    Are there limitations on the type of instrument that can be run through a ENET-232/4?

    Possibly - if the software is written with hard timings (like it writes a command, waits 10 ms for the reply, then writes a seconds command, etc.) then its going to run into problems communicating over a high latency communication link.
    Sometimes these timings are adjustable - are there any options in the program for adjusting communication timeouts?

  • Terminating Event for BUS2017 Custom Method

    Dear Experts,
    I have an issue with the Terminating Event of the Workflow for BO : BUS2017. The event is getting triggered but receiver is not being picked.
    I have created two events GR_103 and POST_105 in the Custom BO ZBUS2017 by delegating it to BUS2017. GR_103 is the triggering event for my workflow which I have triggered in the POST_DOCUMENT Method of the Implmentation for BADI : MB_MIGO_BADI.
    GR_103 is triggered while doing MIGO (Goods Receipt) for Movement Type 103. My Workflow is triggered perfectly and then I have used a Dialog Asynchronous Task in which I have called the MIGO Transaction for Releasing the GR Blokced Stock using the Movement Type 105. I have created a Custom Method POST in the BO ZBUS2017 and I have used the FM: MIGO_DIALOG to call the MIGO. I am trying to raise the POST_105 event in the Method MB_DOCUMENT_BEFORE_UPDATE of the Interface IF_EX_MB_DOCUMENT_BADI.  I have defined the Terminating Event for the asynchronous Task as POST_105.
    Now the event POST_105 is triggered, but SWEL says 'No receiver entered'. Even the SWEINST shows the object data as the current Work Item along with Object Key, but still receiver not picked. When I try to trigger the same event in a test report by using call transaction, then the event triggers and work item gets completed without any issues.
    Please advise.
    Below is my terminating event code.
      READ TABLE xmseg INTO wa_mseg INDEX 1.
      CONCATENATE wa_mseg-mblnr wa_mseg-mjahr INTO l_objkey.
      IF wa_mseg-bwart = '105' .
        CALL FUNCTION 'SWE_EVENT_CREATE'
          EXPORTING
            objtype           = 'BUS2017'
            objkey            = l_objkey
            event             = 'POST_105'
          EXCEPTIONS
            objtype_not_found = 1
            OTHERS            = 2.
      ENDIF.
    Regards,
    Raju.

    Have a COMMIT WORK after the function call. (At least test it - I am not sure if it will have some effects in your BADI - at least you will know whether the issue is about missing commit).
    And please use SAP_WAPI_CREATE_EVENT instead of the old function you are using.
    Also, make sure that the events will look exactly the same in event monitor SWEL when triggered from your code and when using test tool. Maybe there is some minor difference/mistake (object key, etc.) that you haven't noticed.
    Regards,
    Karri
    Edited by: Karri Kemppi on Feb 7, 2012 8:14 AM

Maybe you are looking for