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.

Tags: NI Software

Similar Questions

  • serial port read.vi

    Anyone know where I can find

    serial port read.vi

    Open driver.vi series

    or the serial.llb library which is the latest version and it's for labview 7.0

    I also need _serpup.llb which is the last version more.

    serpdrv


  • 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

  • How use the serial port read and display the text but not scroll off the screen?

    I'm new-ish/return user fan of Labview and trying to change the example VI "Advanced serial write and read VI" is the part of the dev suite 2012.  I need to use the string box for ALL of the text from a serial port, always adding and just roll off the screen when the actuals come to the serial port.

    What actually arrived more than bytes (or no bytes AT ALL!), during reading time text, current rolls out of the box in the chain.  Even when receiving 0 bytes, screen is removed.  I'm not very familiar with the locations of functions and even worse to understand obscure references to functions, so please keep very basic answers so I can follow.

    Just to be clear, I need window of the chain behave as HyperTerminal does always displays the data and it is not pushed by window arbitrarily.

    Thank you

    Steve

    A long shot.

    Is that what you want?

  • Error when executing VISA Serial Port reader

    Hi all

    I work with some lithium-ion batteries that gives every second through a RS-232 codes. With these codes you can get the battery voltage and other things.

    To read these values and store them in excellent I created a labview program using the player of VISA. I tried to run the program several times and it worked well at the start.

    After that, I also called in a function of data acquisition to read other values from a module NI 9206. When this change was made to the program the problem arose. I am able to get values and run the program for a while. But in a few minutes, the program gives an error saying "Error - 1073807252 occurred at VISA read in reader.vi series" (I have attached a screenshot for this).

    If anyone knows why this problem occurs? Any suggestions would be helpful. I'm new to read VISA and do not know why this error occurs.

    I have attached to VI.

    1. with the data acquisition function
    2. without the data acquisition function

    Thank you
    Piraux

    As the message says you do not read the serial data fast enough. As you say, the device sends data every second. If you do not read these data at least this fast, possibly the series buffer will be overflow because of no bytes will be replaced. Your acquisition loop is guaranteed to be more than a second. The DAQ Assistant takes a second to get the data because it is the time that you specified. Reduce the number of samples or place the DAQ Assistant, in a separate loop.

    p.s. Please clean up the code a bit. Get rid of all these statements of cases who do nothing and do not use local variables - particularly the response string series.

  • serial port read on WinCE 4.2

    Hello!
    Ive got a project, I need to read the port COM on Windows CE. Can I do executeables bulit on Win7 with LV2011, which will focus on the target devic with opus WinCE system? I am new in this task. What should I do on the target device, and how should I have to build the exe or the installer on the developer's PC? Will be working under this VISA?
    Thank you for your reply and your place!
    Kind regards

    Gabor M.

    Sure. You need not install anything on the target. Microsoft ActiveSync will take care of everything. You can download a trial version of the module, install it on the host PC to see how it all works.

    On the host computer, you just need to build a VI using LabVIEW Mobile Module and then just build it as you build a normal exe. All this gives a kick and read manuals linked above; It soon becomes clear.

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

  • 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

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

  • 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

  • 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 =)


  • 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

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

Maybe you are looking for

  • Satellite on L9W - B Mini - touch pad does not

    Hello I recently bought a Toshiba mini click, and I think my touchpad is defective because it does not at all, does not meet the clicks or movement and never has. I tried to reinstall the 3 different versions of the driver swing.I tried to reset the

  • P2-1334: Hard Disk short DST failed

    My computer would not start: he would stay with the logo "hp" with a black screen. I ran a test start and while the check of processor, memory test and Smart hard drive tests all pass, the short DST hard drive failed. Failure ID is: M0FX2C-0007LA-PXP

  • Debounce counter signal digital filtering is not possible?

    Hey all,. When you read a flow meter signal at lower bitrates, the signal bounces. Because these bounces are count in addition to pulse correct, this leads to an output of counter unreliable. With a range of joint, I can see the behavior that bounces

  • Read a data point every time via the sound card

    Hello! I'm reading the output of an amplifier to lock that cannot be connected to my PC. So I decided to read througn my mic. To do this, I connect channel 1 or 2 for my microphone. However whenever I do a reading I can not simply take a while but on

  • Message scam or reality

    "I have a message that came the Christmas period, when I turn on he says" since windows 1 ASSETS there was material changes. You must activate in 2 days "is an authentic message from Windows? My son says attention virus scam possible. I have Windows