Problem: read bytes to serial port

Hello, I need to communicate with an external device with serial port. I have to write a command to my device string, and then it should play with 64 bytes of data. I built a function of READING-WRITING and I use it in a loop (I have to read a lot of 64-byte block)

Sometimes, I have the following problem:

(1) I have send the command string, I wait with "Bytes to the serial port" whereas I have more then 60 bytes, then I read.

(2) sometimes happen that the read function cannot read all 64 bytes, so the net for cycle, I have in the receiver buffer mor than 64 and the program to stop working. (does not work well)

I need to be sure that after writing the command I have 64 bytes, so I red all the 64 bytes so the next loop for, I have the buffer of the empty receiver.

I enclose my writing reading function. Please refer to the block diagram (there are a few notes).

Thank you

In no place in your program see the VISA configure the Serial Port. It's always a good idea to include this that even if you use the default settings. I suspect this is one of the default settings which is wrong with you. By default, playback is set to end when a character is considered. This means that if you have a 10 hex (ASCII LF) in your stream, playback stops until the specified number of bytes is read. Put in a VISA set up the Serial Port and connect a constant False to the stop character allow entry.

Tags: NI Software

Similar Questions

  • VISA from read/write to serial port - unable to implements several orders of writing!

    Hello

    I'm new to Labview and I'm reading from a pressure through a virtual serial port USB sensor. I am able to read the port when you use HyperTerminal

    The code sequence that I should write to the port in order to obtain measurements using hyperterminal is the following:

    ' *' (2A hex)-online start and the responses of the port by asking 'Command', I should then enter

    FF-online measurement select the port must ask the 'mode', so I should enter

    0 has-online measurement of high resolution mode and it was then that I should start receiving action.

    The port is always answer by errors when I write the start command or the FF one. I tried to establish a sequence stacked to write the three commands then read the port, I added some delay between the three of them, but it does not work.

    Now I made really simple and removed the stacked sequence and just put the three commands one after the other and try to remedy not to not on the code.

    I'm really stuck at this point, could someone help me please? I read a lot fo articles on the forum, but I can't solve this problem

    Thank you

    I have attached my VI and the SCP1000 documentation (I can provide other versions of my demo if necessary)

    The reason for your problem is a frequent misunderstanding even among experienced programmers. Take a look at this thread

    http://forums.NI.com/NI/board/message?board.ID=170&thread.ID=417750

    In your data sheet, then they return codes like 0xFF or 0x0A so has a single byte of average value. Then you in your-active code constant writing FF\n is so this equal to values in format hexadecimal 46460A and your instrument do not understand. But it will include FF0A. In order to solve your problem, you would type in \FF\n in your '-' chain helped codes. Remember too, if you type in \32 it will be converted to character 2 this being 0 x 32 50 decimals and code ASCII 50 is equal 2

    Take the time and change the display format of string between '-' display and Hex display and you will see the difference

    Hope this helps

  • Visa read byte at the port

    My visa to read, I feed in the bytes in the property node port as input for the number of bytes to read (it's 4 bytes).  However, the output of the read visa give only 2 bytes.  It seems that a few bytes have been lost during the read operation?  Why is this?  It is an easy to see what is in the buffer of the serial port?  Thank you!

    Yik

    You likely the session VISA set to end readings when he sees a stop character and VISA reading is to see the stop character, and ending the reading, regardless of the number of bytes you told to read. If you want that it explicitly read that much then you must disable the option "Activate the stop character" in VISA set up a Serial Port.

  • Reading codes ascii serial port and their trace

    Hello

    I am trying to build a VI that reads data (ascii values) of the serial port.

    I am trying to build a Phonocardiogram wireless. I have a microphone that acquires the heart sounds. These signals is amplified and sent to an A/D converter to digitize it. the digital signal are sent to a base unit. UNTV signals received by the base unit must be sent to a computer (via a serial port to display).

    I would like to build a VI to draw ascii data received through the serial port.

    I would like to draw these values so that the plot resembles an analog signal (the one I had before an A/D converter).

    Can someone give me help?

    Thanks in advance...

    HII

  • Communication serial port IRP_MJ_READ

    Hello, I would ask you serial port communication. I am currently apply for communication with my engine not to not (Microcon), but it does not work. If I try to connect with the original software, my serial port monitor gives me values

    IRP_MJ_WRITE when I write some values and

    IRP_MJ_READ when I try to read from the serial port

    But when I'm using LabView, I can only send IRP_MJ_WRITE function by using the component to write VISA (if this one works well), but when I use VISA component read my serial port monitor gives me only IRP_DEVICE_CONTROL. Do you have any sugestion where can be a problem? I don't know how to get this function IRP_MJ_READ using LabView VISA component.

    You watch the using PortMon software? The only thing I see here is that the order that you send, there could be a space that you could have made while typing,

    or

    You're still motor control software running step by step when running the labview? In this case, there will be conflict.

    When you use software original stepper motor and when you send the command wirte down the hexadecimal value (see portmon or any other monitoring software) and try to send back the same hex values using labview. Sending a command, sending of hex are the same but just give it a try,.

    Use bytes depending on the port before VISA to read all available data.

    Search for Microcon network drivers driver Instrument in the Web site OR if you want a quick and simple solution.

  • Serial port doesn't work is not on the installed machine

    Hi people.

    I developed a labview program that reads from the serial port. It works fine on my development machine, but when I install it on a different machine, it will not work. I tried several facilities. Both the automatically selected installallers and checking the DURATION of NI-VISA 15.0. I also see shared components VISA 5.6.0 (64-bit) in installed programs. Do I need to add additional drivers or anything like that.

    I would assume that selected installers automatically chooses everything. I am blind as to what is the problem.

    Select this option.


  • How to connect Agilent 8163 b via the serial port

    I have a problem connecting to the serial port with Agilent 8163 b. The driver that I use is driver_vxipnp_816x_4_1_4.exe. The problem always message display "Visa resource not found. Check the HPIB-Bus address"when I use the components inside the"hp816x tree.vi ". However, I have no error if I use normal read and write VISA.

    Y does it can someone help me answer my question? Thanks in advance.

    Thanks for the reply.

    I face a problem that you use with GPIB-USB-HS due to the physical dimension, as shown. The width between the remote locking connector (FIR) and (w1) GPIB connector to the appliance is too small for the GPIB-USB-HS (w2) connect to this topic. If I unplug the connector RIL, tunable Laser will not be activated. So I have a few questions as follows.

    1. the LabView can always activate the tunable Laser if I unplug the connector at RISK in my case via GPIB?

    2. the LabView is compatible with GPIB connector (model x 10833) Agilent?

    3. is there a way to solve the problem posed by the RIL connector unplugged?

    The drop box

    P/S: version please is 4.84 to 8163 b.

    Thanks for the help and I'm too new in this field.

  • HP Compaq 6000 Pro AT492AV: Serial Port PCI Driver help - HP 6000 AT492AV Windows XP Pro

    Due to former software compatibility issues, I run Win XP on my computer HP Compaq 6000 Pro AT492AV.  I installed a new copy of XP OEM and have solved all driver except for 2 problems:

    (1) PCI Serial Port, here's the info from Device Manager:

    PCI serial port

    PCI bus 0, device 3, function 3

    PCI\VEN_8086 & DEV_2E17 & SUBSYS_3048103C & REV_03
    PCI\VEN_8086 & DEV_2E17 & SUBSYS_3048103C
    PCI\VEN_8086 & DEV_2E17 & CC_070002
    PCI\VEN_8086 & DEV_2E17 & CC_0700

    (2) unknown Device, here's the info from Device Manager:

    Controller of Interface LPC Intel(r) ICH10D - 3A1A

    ACPI\IFX0102
    * IFX0102

    I'd appreciate any help you can provide!

    All the best

    Hello:

    You need these drivers for devices...

    1.

    This package contains the Intel Local Management Service (LMS) and the support of Serial - over - LAN (SOL) for Intel Active Management Technology (AMT) for the supported desktop models and operating systems. This software is part of the Intel Digital Office Initiative.

    FTP://ftp.HP.com/pub/SoftPaq/sp45001-45500/sp45367.exe

    2.

    This package provides the device driver for the Infineon Trusted Platform
    Module (TPM 1.2) in office supported running models taken Microsoft support
    Windows XP operating system.

    FTP://ftp.HP.com/pub/SoftPaq/sp40501-41000/sp40553.exe

  • The VI "VISA set up the Serial Port" will only work at 9600 baud

    I wrote a Serial Port RS232 RW.vi monitor of ' "which works for most. The problem is that it will not meet the alternative port configuration settings... For example: the default RS232 serial port configuration is:

    (COM1, 9600 baud, 8 data bits, 1 stop bit, no without parity)

    As a test, I use a Null Modem cable to connect to my LabView Com1 port to another PC running RealTerm Serial Port Monitor... Using my "RW.vi RS232' newly designed with the port settings of (COM1, 9600 baud, 8 data bits, 1 stop bit, no without parity), I can send and cannot receive data back throughout the day no problem...

    However, if I configure the port "RW.vi RS232" all other configurations, such as (COM1, 2400 baud, 7 data, 1 stop bit, odd parity bits)... He will not take the expected risks and continues to operate @ 9600 baud rate etc.

    Then, I changed the settings default "RS232 RW.vi" (2400,7,1, Odd)

    He still refuses to derogate (COM1, 9600,8,1, no...)

    I also went in the Device Manager of Win XP on the system of LabView and configured manually Com1 2400,7,1, Odd

    and yet,... work at the "RS232 RW.vi" @ 9600,8,1, none

    Everyone can test my VI in the car and see if they have the same problem of not being able to see the new changes in the Port configuration settings... other than (COM1, 9600,8,1, no...)...?

    FYI... Unfortunately my LabView runs on Version 6.0, you may need to up-conversion of the attached vi

    Instead of simply appreciate the comments, you need to implement.

    Having closed VISA inside the loop is definitely the problem.  And Crossrulz is 100% correct about the problem being that the serial port gets zero to default baud rate after the closure of the port.  Here's the proof.

    Note that while may have set the port settings manually in the Device Manager, these parameters are reviewed by the pilot VISA.  If you look in the measurement and Automation Explorer under devices and Interfaces > serial and Parallel, you'll see the default settings using the VISA driver.  If you change this setting, your program will work as desired.  But this is not the appropriate fix.  The correct solution is to get the VISA close out of the while loop.

    The port settings are established in this order.

    1. by Windows device drivers.

    2. by the VISA driver as set in MAX.  Since you are using VISA, these settings will be automatically replace #1.

    3. by the port settings, you set programmatically in your LabVIEW program.

  • Change Windows 7 default serial port settings

    I need help how do I change the way Windows 7 control a default serial port COM1.  I use a serial cable very easy to control the special with external hardware.  The serial cable only use the RTS and DTR, GND pin of the cable and does not require special hardware drivers.  I used the camera on several versions of Windows 95 to XP without any problem at all with serial ports.  With Windows 95 - XP serial COM1 port's RTS and DTR lines defined 'stop' by default.  I just upgraded to a new computer with Windows 7 and now have a problem with the serial port.

    For my problem, I need to have the serial port to be 'stop' default until load control software and specifically opens the serial port to turn on the external device.  Using a serial port data Tester (a lot of green and Red led) I see that as soon as Windows 7 starts, it automatically sets the lines DTR, RTS and TD to serial port as "HOT" (high voltage).  This is not acceptable because it activates the external hardware until the control software is loaded!  Similarly when the control software is closed and the serial port is released in Windows 7, the serial port DB, RTS and TD lines are again defined as "HOT" (high voltage) by Windows.

    Computer: Dell Optiplex 745
    Windows 7 Pro 64 bit with SP1 installed
    Serial port on motherboard: Intel ICH8/ICH8R LPC Interface Controller 2810
    Serial driver: Microsoft 6.1.7600.16385 (is up-to-date)

       Settings for COM1:
       -------------------
       Baud Rate:     9600
       Data Bits:     8
       Parity:        None
       Stop Bits:     1
       Flow Control:  None
    

    I spent hours looking at the Manager of devices/port settings and try to find anything online with no luck.  Is it possible that this is because of the way Windows 7 plug-n-play manages the serial port?  How can I turn it off then the port by default as if it was on XP and earlier versions of Windows is 'off '?

    Thanks, Dave

    I need help how do I change the way Windows 7 control a default serial port COM1.  I use a serial cable very easy to control the special with external hardware.  The serial cable only use the RTS and DTR, GND pin of the cable and does not require special hardware drivers.  I used the camera on several versions of Windows 95 to XP without any problem at all with serial ports.  With Windows 95 - XP serial COM1 port's RTS and DTR lines defined 'stop' by default.  I just upgraded to a new computer with Windows 7 and now have a problem with the serial port.

    For my problem, I need to have the serial port to be 'stop' default until load control software and specifically opens the serial port to turn on the external device.  Using a serial port data Tester (a lot of green and Red led) I see that as soon as Windows 7 starts, it automatically sets the lines DTR, RTS and TD to serial port as "HOT" (high voltage).  This is not acceptable because it activates the external hardware until the control software is loaded!  Similarly when the control software is closed and the serial port is released in Windows 7, the serial port DB, RTS and TD lines are again defined as "HOT" (high voltage) by Windows.

    Computer: Dell Optiplex 745
    Windows 7 Pro 64 bit with SP1 installed
    Serial port on motherboard: Intel ICH8/ICH8R LPC Interface Controller 2810
    Serial driver: Microsoft 6.1.7600.16385 (is up-to-date)

       Settings for COM1:
       -------------------
       Baud Rate:     9600
       Data Bits:     8
       Parity:        None
       Stop Bits:     1
       Flow Control:  None
    

    I spent hours looking at the Manager of devices/port settings and try to find anything online with no luck.  Is it possible that this is because of the way Windows 7 plug-n-play manages the serial port?  How can I turn it off then the port by default as if it was on XP and earlier versions of Windows is 'off '?

    Thanks, Dave

    Dave,

    I can't believe that you have not answered this question.  I had the same problem as you trying to control my radio interface.  I just came by for a Dell Optiplex over the weekend and noticed the same problem.  I was searching the Web for an answer when I found this post.  I am happy to say that I found the solution to my Optiplex and how it works for you.  I went into the BIOS and set the UART protection on.  Makes no sense to me because I'm a software guy, only an amateur on the hardware side.  I left the BIOS and the serial port works as it should like in XP.
    Steve
  • Sometimes the lost bytes, reading the serial port

    Hello!

    I'm reading the serial port data (flow rate 57600 baud rate) that works very reliable so that I do not open any other window

    or minimize/restore my window of the application during the program is running. Then a byte of incoming data will be lost.

    I get a string of 30 bytes each 50 m in most of the cases the first byte is lost, sometimes one in the middle.

    This occurs not only on a PC.

    Is this a problem of LabVIEW or Windows?

    Are there settings that can solve the problem?

    Best regards

    JK78

    I solved the problem.  

    There was a bug in my program who become visible only if a window has been reduced or restored.

    When there are two or more messages in the buffer VISA, the separation of the messages was incorrect.

    Array index corresponded to false so that the first byte of the second message was at the end of the first

    and so the second message in the buffer seemed incomplete.

    In normal operation, the playback loop runs so fast, never both messages are in the buffer.

    Thanks for all replies.

    JK78

    Either way, I work with LabVIEW 2009 and serial interface hardware motherboard. With XON/XOFF flow control

    is not possible in my application because all the hex values from 00 h to FFh may appear in a message.

  • Visa reading reads all bytes to the port

    I have a camera that I communicate via the Serial Port. I have a standard communications protocol. For a particular command, I know that the exact number of bytes expected in return. I send my order. I see the correct number and exepcted to bytes in the port. I then read the number of bytes in the port. However, the VISA read returns only the first two bytes.

    I contacted success with this camera and this Protocol for more than 130 commands unique and different. There are only about 6 orders in which the read visa does not read all the bytes in the port. Anyone know why that would happen?  I expect to see 6 bytes. I see 6 bytes. I have visa read the command with 6 bytes. The visa read returns only the first 2 bytes. It's very very frustrating. I can do this exact process even with a different command. I expect 45 bytes of this command. I see 45 bytes with this command and I read 45 bytes with this command.

    I don't think that it is device connected as I can converse with success with the same camera on the same computer with the same cable of connector using non-LabView. It seems to be a problem strictly related to labview and VISA read the order. If someone could help that would be greatly apprecicated.

    Thank you.

    What is the exact byte stream that await you in return with this command?

    Instead of opening VISA, use the configuration Serial Port VI.  In this way, you can override the default values.  It looks that your instrument using all the defaults VISA of speed in baud rate, start and stop bits, etc.  However, in the VISA software, there is a failure to use a termination character, and this character is 10 (0x0A).  If you use the configure Serial Port, you can tell the pilot VISA do not use the stop character.

  • whille prob get bytes to the serial port for serial communication

    Hi all

    I have one using the series write vi to send the command to the instrument. the answer I get is read NICU playback vi. I use between read and write the serial port bytes accumulate bytes. BU what I observed is quite strange. When I run the vi with the debugger, I could c the bytes to port series is 201 and what I get in buffer is only 133.

    any1 can guess at what the problem would be b?...

    You don't show the function of VISA set up a Serial Port, but I guess you have the active stop character. Playback will end automatically when the character is detected and you should never allow when you try to read hex.

  • Read the Serial Port with termination Char?

    Hi, I have a particular piece of hardware that I'm communicating which sends a stop character 0xAh at the end of the data written to the port. I have trouble reading the data from the port where I only get half of the data due to synchronization problems. I know that it's related to be looking at the bytes to the port property node and read the bytes that probably replacing end setting tank. I have the correctly defined termination char, so, how did a survey for serial data to the port without using the bytes to the port method because I don't think that it works when you use the termination char port method. Anyone know this issue?

    Simple VI that explains what my main VI by defining the term tank and using the bytes to the method of port that is not working properly and causes problems of loss of data from mark is attached.

    Thank you.


  • read byte serial number

    Hi all

    I have a small application that consists of reading data from a serial port using the VISA READ function. The data source that I am trying to acquire the serial port is a microcontroller that sends a word or a byte (8bits). However, when you try to download the programming code in the microcontroller, the programming software backup code in the HEX file into the chip.

    It's all just an explanation into the problem.

    in oreder to get my application actually, I used the attached VI have not program but adds some functions for multiple purposes. The Vi works perfectly and everything works fine, but it seems that I had some misunderstanding here.

    what I'm trying to understand here is why a function (hexadecimal string to number) is used for as much that I have configured everything to read bytes (8bits)

    I am very confused

    any suggestion would be appreciated.

    Thank you

    Converted to 8.5 and attached.

    You can also use

    http://zone.NI.com/reference/en-XX/help/371361H-01/Glang/byte_array_to_string/

    http://zone.NI.com/reference/en-XX/help/371361H-01/Glang/string_to_byte_array/

    to perform the conversion.

Maybe you are looking for

  • Firefox allows the printing of files PROTECTED on my server. WHY?

    All other browsers RESPECT the fact that a PDF is password protected and does NOT allow this file to be printed. Fire Fox violates this rule, and let's users simply of pass protection and print the files. It really SUCKS! He should fix it to conform

  • How can I erase browsing history?

    I don't know how to clear my browsing history. Can you help me please?

  • Problems turning on computer

    I have a Tecra A2-everything worked yesterday but when I try to pass on all the computers that comes is "NTLDR is missing press CTRL + ALT + DEL to restart", but when I do this the same message arrives.

  • Loop for update

    Hello First of all I am new to labview, I'm reading 8 checkboxs vals and every box I am queuing a unique val witch will be a test. I have a problem with my loop it will just refresh and your stay in val 0 (only a single iteration) VI is attached, can

  • Don't boot to desktop-Boot computer ups always come with "no input signal" for monitor

    Thanks for the research on this issue.  So first of all, he could start after a few attempts in the end goes to the blue screen error at approx. 5 min. I started this path several times that in "safe mode with network" to try the many suggestions of