Problem --serial port reading one character at a time

Hi Friend,
I reading the serial port  one character at a time ,  i specified it in the "serial bytes to read" option in serial port read examples.
The problem is ----------i can able to read  the data.
but only the first character is reading again and again...and "reading string indicator" in the serial port example shows only the first character sent ..only for a single time.since i am reading continously ----aleast the first character should display as many times i running the program
(i am running the vi by run continous option..........)..
please help me ....how to read the character one by one.....
regards
rajasekar

Hi jason...
I can able to read the serial port by 1 byte or 2 byte or 4 byte as i can specify it in the serial port read bytes option..(in visa serial read)..
I need to acquire 4 bytes of data and pass it to the Math-script node..and save these 4bytes of data in array (1 row and 4 column)..
And split this array(just like array-indexing.vi) and processing it each each column separately....
or suggest some method to achieve my task.....please.
one more thing the math-script node is placed in a while loop.....in order to read sequence of bytes continously.......
regards
rajasekar

Similar Messages

  • Reading one character at a time

    Hello
    How can i read one character at a time from standard input (System.in) ?
    I have tried to use
    ir=new InputStreamReader(System.in)
    ir.read().
    But this method blocks until it gets a return key pressed before going forward
    Any other solution?

    public static char readChar() {
    int ch;
    char r = '\0';
    boolean done = false;
    while (!done) {
    try {
    ch = System.in.read();
    r = (char) ch;
    if (r == '\r') {
    System.out.println("Not a character. Please try again!");
    System.in.skip(1);
    done = false;
    } else {
    System.in.skip(2);
    done = true;
    } catch (java.io.IOException e) {
    done = true;
    return r;
    Try this as an method and then use it..
    This code will read will be in response untill you hit the return key but will take only the first character....

  • Question on reading one character at a time.

    Hi. I am assigned a program where I have to read a series of bits (for example: 01010101). Using this I have to make a "graph out of it". The way I am supposed to make a graph is as follows:
    Each bit interval will be represented in the output as a field taht is two characters wide.
    The value of the signal is represented using either + (to represent +voltage) or - (to represent - voltage) and is always the second character in the output field.
    The first character in the output field is either:
    ' . ' = to indicate no change from the previous signal value or
    ' / ' = to indicate a negative to positive transition or else
    ' \ ' = to indicate a positive to negative transition
    Example for input: 01010101 and the output would be . + \ - . - / + \ - . - / + . + \ - / +
    The code that I got so far is that I read the input from the command line as a argument which I know is nothing but I would just like to know how to read the character one by one and make a graph which is totally boggling my mind because I have no idea how I can do it. Thank you for your help.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Encoder
         public static void main(String[] args)
              int b = Integer.parseInt(args[0].trim());
              System.out.println("You spit out --> "+b);

    Alright I sorta got what you were sayin'. The code that I have now is:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Encoder
         public static void main(String[] args)
              String toEncode = String.valueOf(args[0]);
              StringBuffer result = new StringBuffer();
              char lastChar = toEncode.charAt(0);
              char curChar = '0';
              char lastSign = '+';
              int length = toEncode.length();
              for (int i = 0; i < length; i++)
              curChar = toEncode.charAt(i);
              if (curChar != lastChar)
              if (curChar == '0')
              result.append("\\-");
              lastSign = '-';
              else
              result.append("/+");
              lastSign = '+';
              lastChar = curChar;
              else
              result.append(".");
              result.append(lastSign);
              System.out.println("You spit out --> "+result);
    But it doens't work according to what I want it to do. What I need it to do is the following: Lets say we have the input of 01010101, the result we will get is ". + \ - . - / + \ - . - / + . + \ - / +". The reason for this is because of the following: The graph starts on the v all the time. When there is a 0 bit there is no change and when there is a 1 bit there is an inversion of the voltage level so since we started with a 0 bit at v, when we hit 1 bit we would make a inversion to -v and when we hit 0 bit there would be no change. I don't know of what I said is clear to you or not. For this program, what it does for the input of 01010101, the output is
    " . + / + \ - / + \ - / + \ - / + ". Thank you very much.

  • Reading a string one character at a time

    Hi,
    I'm hoping you use SmallBasic for year 10 exam students at my school.  But, I have found a problem I cannot solve.
    I need to be able to read one character at a time from a string (txt file) and convert each char to its ACSII code.
    How do to I read one char at a time from a string to enable processing?
    Thanks for your help.
    Baz 

    Here is an over the top solution that will display the Hex value of the character codes of every character in the file.
    TextWindow.Write("Enter full file name: ")
    filnam = TextWindow.Read()
    contents = File.ReadContents(filnam) 'read the entire file
    TextWindow.Clear()
    TextWindow.WriteLine("File Name: " + filnam)
    TextWindow.WriteLine("Offset: 0")
    col = 0
    row = 5
    TextWindow.CursorLeft = col
    TextWindow.CursorTop = row
    For i= 1 To Text.GetLength(contents)
    ch = Text.GetSubText(contents, i,1)
    chVal = Text.GetCharacterCode(ch)
    ConvertToHex()
    TextWindow.CursorLeft = col
    If chVal < 32 Then
    TextWindow.Write(".")
    Else
    TextWindow.Write(ch)
    EndIf
    TextWindow.CursorLeft = 20 + 2 + (col * 3)
    TextWindow.Write(Text.GetSubText(hexstr,1,2))
    col = col + 1
    If col = 8 Then
    col = col + 1
    EndIf
    If col > 16 Then
    col = 0
    row = row + 1
    If row > 20 then
    TextWindow.CursorTop = 23
    TextWindow.CursorLeft = 25
    TextWindow.Write("< < < Press ENTER to Continue > > >")
    TextWindow.Read()
    TextWindow.Clear()
    TextWindow.WriteLine("File Name: " + filnam)
    TextWindow.WriteLine("Offset: " + i)
    row = 5
    EndIf
    TextWindow.CursorTop = row
    EndIf
    EndFor
    TextWindow.WriteLine("")
    TextWindow.WriteLine("")
    Sub ConvertToHex
    HexValue[0] = "0"
    HexValue[1] = "1"
    HexValue[2] = "2"
    HexValue[3] = "3"
    HexValue[4] = "4"
    HexValue[5] = "5"
    HexValue[6] = "6"
    HexValue[7] = "7"
    HexValue[8] = "8"
    HexValue[9] = "9"
    HexValue[11] = "A"
    HexValue[12] = "B"
    HexValue[13] = "C"
    HexValue[14] = "D"
    HexValue[15] = "E"
    val = chVal
    hexstr = "h" 'Need to force Small basic to concatenate rather than add
    While val > 0
    hexPos = Math.Remainder(val, 16)
    hexstr = HexValue[hexPos] + hexstr
    val = Math.Floor(val / 16)
    EndWhile
    For hi = Text.GetLength(hexstr) To 2
    hexstr = "0" + hexstr
    EndFor
    EndSub
    Enjoy!

  • Serial port reads unconventional characters

    Hi,
         I'm using the serial port to read 32 8bit numbers and have been getting some strange characters read back.
        I've tested the hardware with Matlab which works fine but with Labview I get the following string
        À Ð à Ð àÿÐÿÐÿÐÿÐÿÐÿÐÿÐÿÐÿÐÿÐ À
       Since these are not standard characters I can't seem to convert them to any other format. I've also used an ActiveX control (AComPort) in Matlab to do the same thing and I get the identical string above, so its something to do with the format rather than an error in the reading I think.  However if I use AComPort to read one byte at a time (rather than a string) I get the correct numbers, so could I do the same thing in Labview?
    Thanks for any help
    Emrys  

    hi there
    i bet there's something wrong with the serial port settings
    - Enable Termination Char (T)
    - Termination Char
    - data rate
    - data bits
    - polarity
    - stop bits
    you can adjust these settings with the "VISA Configure Serial Port.vi". please check if the settings are correct.
    you wrote "However if I use AComPort to read one byte at a time (rather than a string) I get the correct numbers", so try 8 databits, 1 stopbit, no parity and disabled termination character or see the documentation of AComPort .
    Best regards
    chris
    CL(A)Dly bending G-Force with LabVIEW
    famous last words: "oh my god, it is full of stars!"

  • How to read from a text file one character at a time?

    Hello
    I wish to read from a text file in a for loop and that on every iteration i read one charachter and proceed to the next one.
    can anyone help me?
    Lavi 

    lava wrote:
    I wish to read from a text file in a for loop and that on every iteration i read one charachter and proceed to the next one.
    can anyone help me?
    Some additional comments:
    You really don't want to read any file one character at a time, because it is highly inefficient. More typically, you read the entire file into memory with one operation (or at least a large chunk, if the file is gigantic) and then do the rest of the operations in memory.  One easy way to analyze it one byte at a time would be to use "string to byte array" and then autoindex into a FOR loop, for example.
    Of course you could also read the file directly as a U8 array instead of a string.
    Message Edited by altenbach on 06-10-2008 08:57 AM
    LabVIEW Champion . Do more with less code and in less time .

  • How do I get the arrow keys to move one character at a time in the address bar or search box?

    I can no longer get the arrow keys to advance or retard "one character at a time" in the address bar, the search box, or on any form in Firefox. This feature works in other browsers without a problem. The "Home" and "End" keys do not work either. How do I fix this behavior?

    How do I configure the AX to connect to the hub's wireless network? It will only scan one base station Airport Express at a time in the Airport Utility. I think what I am trying to do is use the hub as a router to the two AX's. Is there a specific way to set this up?
    To set up the AX to join a wireless network as a "Wireless Client," using the AirPort Utility, either connect to the AX's wireless network or temporarily connect your computer directly (using an Ethernet cable) to the Ethernet port of the AX, and then, try these settings:
    Launch the AirPort Utility.
    Select the AX.
    If not already connected to the AX's wireless network, go ahead and switch to it when prompted.
    AirPort Utility > Select the AX > Manual Setup > AirPort > Wireless
    Wireless Mode: Join a wireless network
    Network Name: <type in the network name/SSID of the wireless network that you want to join or select it from the pop-up menu>
    Wireless Security: None OR, if you are using security on your wireless network:
    Wireless Security: <Select the appropriate level of security for the existing wireless network: WPA/WPA2 Personal | WPA2 Personal>
    Password: <enter your wireless network security password>
    Verify Password: <re-enter the same security password>
    Click Update to write the new settings to the AX.

  • How do I display font one character at a time?

    Right now the way I present my font is it all appears
    instanenous. I don't know if this is even possible or not, but I
    would like to find a way to have the font be displayed one
    character at a time over the course of a variable amount of
    seconds. For example, some of you might recognize this font
    presentation from the game "Phoenix Wright" for the Nintendo DS:
    Click
    here
    for example.
    That is the font effect I'm trying to capture - where the
    font is presented in a character by character fashion. Now
    obviously I could achieve this by putting a new letter on every
    frame, but let's be realistic - that's not the logical way to do
    it. Does anyone know the code/options involved in making this font
    display stylization logically possible? Bonus points if you know
    how to make the characters mouths move with the sychronized font
    and then stop once the text stops =).

    Place a dynamic textfield on your stage and label it myText.
    In frame one place the following code,to increase the write
    speed lower the value of 100 in the setinterval call:
    myText.text="";
    var dText="My text I want to display";
    var dTmr=setInterval(ShowNextChar,100,0);
    var cPos=0;
    stop();
    function ShowNextChar()
    myText.text=myText.text+dText.substr(cPos,1);
    cPos++;
    if (cPos==dText.length) clearInterval(dTmr);
    }

  • Read one word at a time from a text file

    I want to read one word at a time from a text file as it is done by "scanf &s" function in text based programme. It is not possible by " read from text"  function. Suggest me  function or method to solve this.

    The simplest way is to use the spreadsheet string to array function with the space character as the delimiter.
    Note that this won't work unless there is a space character between the words - it won't work with line feeds / carriage returns between the words but you could always split the string into lines first. You may also want to trim whitespace to remove any other non-visible characters (e.g. tab, line feeds) from around the word.
    If you need something more sophisticated that splits based on whitespace (e.g. tab, new line) then you'll probably need to do something with searching the string for these characters (e.g. using a regular expression) and then splitting them yourself into an array.
    Of course...if you actually want to just read one word at a time from the file rather than just split the file into words (I assumed you meant this), you will need to read the file byte by byte using the low level file IO functions, build a buffer of the bytes and check the character you've read to see if it a space.
    Certified LabVIEW Architect, Certified TestStand Developer
    NI Days (and A&DF): 2010, 2011, 2013, 2014
    NI Week: 2012, 2014
    Knowledgeable in all things Giant Tetris and WebSockets

  • Reading one file at a time using File Adapter

    I am using a File Adapter which polls every minute to read files from a Folder. This process picks up all the files in that folder. What I want to achieve is that the File Adapter should read one file at a time. Is it possible to force it to wait for a few seconds before reading the Next file in the Folder. Or is there a solution to what I am trying to achieve? Any help would be appreciated.

    public static char readChar() {
    int ch;
    char r = '\0';
    boolean done = false;
    while (!done) {
    try {
    ch = System.in.read();
    r = (char) ch;
    if (r == '\r') {
    System.out.println("Not a character. Please try again!");
    System.in.skip(1);
    done = false;
    } else {
    System.in.skip(2);
    done = true;
    } catch (java.io.IOException e) {
    done = true;
    return r;
    Try this as an method and then use it..
    This code will read will be in response untill you hit the return key but will take only the first character....

  • Left arrow key does not go back one character at a time

    on my key pad, I cannot backup "over" characters one space at a time  I am not looking to DELETE, merly to backup one character at a time.  I know I can use the function key along with the arrow key for word at a time jump.  I can jump one character to the right by pushing that key but I cannot do that with my left arrow key.  slight annoyance, but I swear it worked before. . .

    The arrow to open the tab history of the Back and Forward buttons has been removed in Firefox 4 and later.
    Use one of these methods to open the tab history list:
    * Right click on the Back or Forward button
    * Hold down the left mouse button on the enabled Back or Forward button until the list opens
    You can look at this extension:
    * Backward Forward History Dropdown: https://addons.mozilla.org/firefox/addon/backforedrop/

  • Read one record at a time

    Hi !
    One of our Java folks here need at function where he reads one record at at time in id order;
    create table url_recs (id number, url varchar2(4000));
    insert into url_recs values(1,'www.fona.dk');
    insert into url_recs values(2,'www.dr.dk');
    insert into url-recs values(17,'www.ihk.dk');
    select read_rec() from dual; - get id 1
    select read_rec() from dual; - get id 2
    select read_rec() from dual; - get id 17
    select read_rec() from dual; - get id 1 - "no more rows - start all over again)
    select read_rec(45) from dual; - get NULL (no rows with that id)
    select read_rec(1) from dual; - get id 1
    The purpose id for some "round robin" trying to get to some internal URL's.
    Can you give me a hint for creating the function(s)
    best regards
    Mette

    Will successive calls come on the same Oracle session? Or across different Oracle sessions?
    If you're going to call the function multiple times within the same Oracle session, you could store the last value returned in a package variable and select the record whose ID is greater than that value every time the function is called. That's unlikely to do exactly what the Java developer is hoping, though, because the Java calls are likely to bounce between multiple Oracle sessions due to connection pooling. And it'll likely require that the Java developer (or app server admin) adds some code when they get a connection from the pool where they reset the package state. Or it'll require that someone develop a method to keep the Java and Oracle session state in sync.
    Justin

  • How to read one bye at a time

    i need to read one byte at a time from a input file. can someone tell me how to do that?

    FileInputStream istream = new FileInputStream(myFile);
    int read_byte = istream.read();API doc work wonders on issues like that

  • Multiple serial ports reading from a shared USB port

    I have a program that reads from 4 flow controllers, which send data through RS232 serial ports. Because the computer is located pretty far away, the vendor suggested to use an Edgeport box to convert RS232 to USB, then convert to ethernet port using a SuperBooster converter. The signal travels long distance in ethernet cable to the computer and get converted back to USB, then to the computer. In MAX, I was able to see 8 com ports from the Edgeport box, and I was able to communicate with my flow controllers.
    The problem is, it will give me some error message occasionally. Sometime it's a VISA Read error, sometime it's a VISA framing error. Could this be caused by the way the signal is transmitted?
    In the program I have four parallel WHILE loops that constantly do READ and WRITE to the 4 flow controllers. Could this be causing the errors? If so, what is the best strategy to design this program?
    Thanks

    I agree with Mike, you will need an error handling strategy that accounts for these errors.  And retries the communications.  This can be a little tricky, but very doable.  I believe some sort of statemachine approach will work best for this. 
    As for your heated probe.  I would make some sort of hardware interlock that will shut it down in case of a coolant failure.  NEVER, EVER trust the computer to be running where safety is concerned, either for personal or hardware.  There are plenty of ICs that can monitor temperature, and have warning, and alarm outputs!  Another option is some sort of watchdog on the communications bus for the coolant control, but I think this is a bit more tricky. 
    Paul <--Always Learning!!!
    sense and simplicity.
    Browse my sample VIs?

  • Serial Port Read Issues

    I have an application that needs to read in a set-length string of 13 data readings seperated by a commas. I have a vi set up that will take the incoming string and seperate it out to its different data points. BUT, when I'm reading in the data over the serial port, I don't know how to wait until I have a complete set of 13 data points before displaying my data. I'm using a vi that extracts doubles from the string to display all 13 data points, and as each point is recieved from my test item, it scrolls through the 13 seperate data displays. All this is placed inside a while loop, so all of my data is coming in, but i'm having trouble seperating it out for display purposes. My test item will be generating the string of 13 floating point numbers seperated by commas at a rate of about 1 set every 1-2 seconds.
    Basically, I need advice on how to read in a full string of 13 data points and after the full string is read in, then display them using an extract_from_string vi.
    Thanks in advance
    jimmyMessage Edited by JMorgan on 03-02-2005 10:50 AM

    Jimmy,
    Is the last data point separated by a comma or by some other character from the beginning of the next data set? If it is a different character, like a carriage return, then all you need to do is to search for that character in the received data. If the stream is continuous and no framing character occurs, then you have to count and hope it never gets out of sync.
    Lynn

Maybe you are looking for

  • 24" iMac screen failure

    In the past few weeks the screen has gone black while using. You can still see a bit of a light behind it so the machine isn't turning itself off, just the video going to black. A few times we even got a red screen with vertical black lines, but now

  • How to delete the item from Delivery?? (Handling Unit)

    Dear SDNs, I have a scenario of HU (Handling Unit). Now here I have a case where the complete cycle is done. But end user now wants to change/delet the item in Delivery. So I have guided them to reverse all documents and it is done. Now delivery is i

  • I FIXED IT! (the "update" problem)

    I'm sure others had figured this out first, but here it is anyway - to all those looking to fix the 2006-1-10 "update" that apple gave us..I have a nano and got this to work. Take note - YOU WILL LOSE YOUR MUSIC IF YOU DO THIS!!! 1. Open Windows Expl

  • What Version of Sun JVM has JDeveloper been qualified with?

    We have a bug that appears in Java 1.5.06. Code worked in 1.5.02. Issue is in the swing library event handling. What version of the JVM has JDeveloper been qualified with?

  • Clock-in Clock-out correction in ESS BP 1.0 2004s sp9

    hi guys, The clock-in clock-out correction application from XSS(ESS-MSS) looks to be incomplete from a process view. In the ESS application I can see that ther eis an aplication for Employees to change clock-in clock-outs. But ther eis no approval me