reading serial port control

I am trying to establish a connection to an external device via the serial port. This is done in a while loop that sends a request to the association is trying to get a response if a response is not received a new rewuest is sent, etc. At the present time, this procedure does not work. I am considering two explanations for this. The first is that the loop does not wait long enough for a future response and continuous pumping motions, the other is simply that there is something wrong with the algorithm of reading, which don't take correctly into the serial port information.

Have you even considered that the "application of the association" that you send is not correct. More often than not, the reason why you get nothing to read is because you not write properly. You have not posted anything related to this function and display of an image is not the best way to get help in this matter. For certain types of entries, it is important to determine whether your control/string constant is set to normal display, '-' display Codes or hexadecimal display.

Tags: NI Software

Similar Questions

  • When a character appeared reading serial port

    How to wait for some specific characters occurred in the serial port (e.g. port COM1 RS232 on PC) and then they recover at the port?

    I want to communicate back with a motor controller that uses ASCII strings such as commands and responses. It formulates a response to any command sent, and the response contains exactly a termination character (that I can specify during installation) at the end of the response string. Sometimes also, it sends a message when there is no order issued, for example a disc error message. There is no simple way and reliable when the controller is going to speak, when he won't, and the message will be exactly how many time, but we do know that each message will have this stop only at the end character. I would like to interpret the entire message in my code, that is to say, I would like to retrieve the string of all the characters from the previous endpoint character up to and including the most recent stop character. I think it means that I would have a VI that returns the message string and does not stream until the stop character appeared and was added to the response string. Or, Alternatively, a loop that adds entire messages to a queue of strings.

    All the screw example I found seems to rely on a certain number of milliseconds to wait or to know how many bytes to read, in order to use VISA Read.

    So far, I use a loop which seeks bytes in the buffer, retrieves everything to add to a string of shift register and test if there is a character of the string endpoint, all extract up to and including the stop character, if so. This feels very awkward and expensive for what should be a common task. Is this general law approach, or did I miss something in a simpler way?

    I read on the communication by Message and characters of endpoint, approach that sounds functionally similar to this, but it seems around standards of SCPI and my motor controller does not support this. In any case example Finder does not get a single hit on 'Message '.

    Thank you!!

    It really looks like you are doing things a lot more difficult it must be. Look at the VISA configure Serial Port. It has a character of endpoints allow and end characters entries. If you wire a real (or leave that he unwired) entry activate, read VISA will end automatically when you specify the stop character is detected. As long as the number of bytes to read is larger that the largest string that you expect to read, there is nothing else you need to do. That's how examples of shipment are put in place and discussions about the characters of the termination. Should there be nothing related to sustainable intensification of CROPS. If you do not get a message in your specified time-out, you get a time-out error.

  • serial port control

    Hello

    is it possible to control, using labview, the inputs and outputs of a port series as they were digital simple power channel?

    for example, to use to turn a relay or to read the State of a switch

    I looked for examples of labview, but they show only complex hardware communication using strings...

    Thanks in advance

    Paolo

    You can control the handshaking lines request to send (RTS) and DTE ready (DTR).  You can read the lines of handshaking DCE ready (DSR) and Clear to send (CTS) as digital inputs.

    They are accessible through the property nodes in the reference under settings series VISA / Modem line settings.

    Be careful of any load that you apply to them or you enter in terms of voltage and current signals if you do not FRY your computer.

  • reading serial port constantly and update the string buffer

    Hi guys,.

    I am facing a problem in reading the data in series using LabVIEW.

    I have an unknown size of data to be read on the RS-232 (Serial) and using read write serial.vi (example) I have read the data permanently and monitor for chain DONE on the buffer, but the channel indicator that displays the output not updated data.

    Chain should:

    1 2 3 4

    5 6 7 8

    I don't see one character at a time on the indicator.

    This is the screenshot of the vi

    Is there any method which will help me to do this?

    Hi Dave,.

    Thanks a lot... you helped me finish all my work... "Always small things blink quickly.

    See you soon,.

    Sailesh

  • serial port read one character

    Hello

    I'm new to the forum, so I don't know if I'm posting this question in the right place.

    However, my problem is I'm trying to communicate via serial rs-232 port and the goal is to read and write the question (code) of the device.

    The Unit regularly sends a "perpetuate" character S. When I read this character, I write the question and receive the response. Then a S appears again and I bravado the code, read the answer and so on...

    The problem is that when I try to do everything at once (read S, send the code and read the answer) and it 14 times before reaching the 1st code again once, labview is very slow. (3-5 seconds to perform this tasks 14 and restart the process). I think that the program becomes slow because that way I'm not using all the S which inflamed the writing and reading process.

    So, I wanted to read character by character (byte-by-byte) and then create a table with the answer. The problem is that the buffer sends answers with several bytes and I can't build an array in 'real time', beacause if I read (read VISA) only one byte, then I would be lost all the others.

    I think that chains concantenate and shift registers are part of the solution, but I have too many problems until I get to the part.

    So, please help me to read a single character and doesn't lose not the other bytes sent by the buffer, in order to fix the process, because I want one second per second refresh. The device emits a flow rate of 19200 baud.

    Thanks in advance

    I think that if you connect the value 1, the reading serial port function, you will receive a byte, and you won't lose the rest.

    The rest are stored in the buffer. If you use the previous function again, you will get the next byte.

  • Questions about serial port read and write at the same time

    Hi I create a user interface for the communication serial port, where there are essentially 2 front panels, where the user enters commands one and the other where the prints of UART is delivered. I thought initially using a state machine but the reading and writing may be independent sometimes and so I can't rely on States. I searched a bit on the forum and he left me even more confused. Help, please.

    (1) in a thread that sessions visa duplicated has been used for writing and reading at the same time, is it recommendable? How will this affect performance?

    (2) essentially when the vi is reading data are it must constantly view as well, however, someone said that it takes too much memory to use shift registers, so how do I go about this? If using a State in queue after the loop of reading it affects the playback loop and be sequential?

    In addition anyway is to move the cursor to the latest data from the indicator

    (3) for the control of the user input, assumes that the user has entered an order in the control and press ENTER, then writing visa is launched, but if it comes in another string and press enter then write must be called again... is - it possible? will detect the previous commands in the control of compensation?

    (4) according to my understand the expectation for the event do not monopolize resources and writing can go in parallel, am I right?

    Thank you. I have attached a very basic vi which took me to the point, but I want to make it more robust. Please help especially in the part of the user interface.

    su_a,

    (1) you can have only one session to a port. Several UART can handle full duplex so performance is not affected.  At flow rates of high data and large amounts of data, buffering and latencies of BONE can become a problem.

    (2) who told you that shift registers using too much memory? Shift registers are usually the best way to transfer data from one iteration to another. String concatenation inside a loop (registry to offset or not) causes the chain to develop and may require re-allocation of memory.  Your VI never clears the string so its cold length become very large.

    Generally, you do not have an active cursor on an indicator.  If you want to always display the most recently received characters and turn on the vertical scroll bar use a property node to keep scrolls to the bottom.  This can be annoying for users if they attempt to manually move the scroll bar and find that the program continues to move it back automatically.

    (3) if the user has changed the value in the chain of command, when he hits enter the modified value event fires.  Simply strike brace does not change the value and does not trigger the event.  Not control need to be erased, but the value that he has to change.  If you want to send the same command again, have a button send a command may be a better choice.

    (4) write is a case of the event.  It is not in parallel with anything.  The structure of the event do not monopolize resources.  The other loop will run while it waits.

    The event loop will not stop when you press the STOP button. Probably it wll take two command: change events of value after JUDGMENT before any loop stops.  Replace the Timeout event (which never expires) with a STOP: value change event and a real wire of this judgment to the Terminal endpoint.  Remove the local variable.  Make mechanical locking when released.

    Lynn

  • Parity errors & read on Serial Port framing

    Hello, I am writing a program that reads the serial port IR thermometer. Intermittently I get parity so many framing errors and can't explain why or find a way to remedy. All the parameters of the series were double checked and controlled. I don't get any errors when you use HyperTerminal yet, when I do test bed in MAX, I see these mistakes from time to time. I tried the suggestions of the knowledge base for these as presenting a delay between the Visa set up and read the Visa or flushing buffer issue before reading, but none worked. Any idea or ideas would be appreciated.

    In addition, while searching through discussions on parity and framing errors, I saw a when a user recommends the following: "use wait event triggered by the stop character and when the error occurs, I just deleted the error, empty the buffer (wait the next stop character) and reread." If that sounds like a good solution, how would I go about its implementation?

    I've attached a screenshot of my reading series loop so you can see what I'm doing. I do about the error code control timeout is.

    Given that you have activated the stop character, you should not use the bytes to the serial port. You shouldn't have to delay or any function buffer flush.

    PS, You also have to change the way your loop exits.

  • 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.

  • Time GPS, Position, Velocity.vi - error-1073807360 reading was held at node (arg 1) .vi property VISA set up a Serial Port (Instr)

    We receive information such as the Latitude and Longitude of a receiver Garmin GPS18xLVC via a serial port on our PC using LabView 7.1.  Successfully, I connected the GPS on the serial port and tested with HyperTerminal.  I tried reading GPS time, Position, Velocity.vi several times and still receive the following error message: error 1073807360 has occurred to the property node (arg 1) visa configure a Serial Port (Instr) .vi.  I think it has something to with the configuration of the VISA series under vi.  Any suggestions would be greatly appreciated.

    Thank you

    I understood the question, that I had with the time reading the GPS, the Position, the Velocity.vi.  The vi. "do not open" port com automatically and so I had to modify the NMEA GPS Subvi reading to first open the port (VISA open command) and then continue with other operations.  Once I did this it started to work very well.  I don't understand why this feature has been left out because it won't work without it.  I tested the code with a receiver Garmin 18xlvc and it seems to work fine.

  • 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

  • P7000 control via serial port

    I just discovered that there is no module for 9178 chassis to interface with the drive of the P7000. We can use the serial port on the P7000 to control directly from Labview? What would be the best way to fight against it? P7000 tools to operate the stepper throughout the day.

    Thank you for your response. Using portmon, that we could determine the commands used with tools P7000. We have since modbus code embedded in the labview code and are able to control the speed and direction through the serial interface. I hope this fix can help others in the future.

  • 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.

  • read the serial port PIN +.

    Hello!
    Ive got a question on the serial port. I don't want to make any communication on the port. I want to directly connect an instrument (later), the pin of the connector series #2. On the PIN, I need to read impulses. I am able to read the port pin series, who is active? I know, I can do it on the parallel port. With the port. VI, I give the address of the port, check the D0 PIN for example and the result I can indicate on a led indicator. I want to do the same thing on serial port, because later the target pc will be ve no parallel port. Is this possible? Can you give a statement of departure?
    Thank you very much for your help!
    Mr. Gabor

    You can read the down state from some other lines, DTR, RTS, etc.. There is an example that comes with LabVIEW. Open example Finder (help-> find examples) and search for "Troubleshooting Serial Line Monitor" example (just search "series").

    This can be considered an e/s digital interface a poor man, depending on what you are doing, you can be better with a 'real' digital i/o interface.

  • How to read a serial port?

    Hello

    I am a complete newbie to Labview and hoped that one of the benefits could point me in the direction of a tutorial on how to acquire data from a serial port. I downloaded some programs here, but I really have no idea of what is happening in their. I also tried looking for the tutorial and through the forums, but all I've found is too specific and would really like to know how to go about reading data.

    Thank you!

    Search for series in the Finder for example of NOR (help > find examples) then choose the basis series write and Read.vi.

  • Reading and saving data of two serial ports

    Hi, I googled similar questions in the forum, but I don't have an answer for my problem so I'm posting it here.

    I would read and record data of two balances throgh serial ports. I have a drop down menu in VI, I can choose the availabe ports on my pc. But it is still only one that works. So I only get one data scales them.

    I usually get to choose 6 ports, but only one of them works. So I'm wondering if this is something that has to do with my pc or the VI?

    I've attached a screenshot of my VI.

    Thank you =)


Maybe you are looking for