Unexpected hexadecimal 00 send over serial communication

Hi,
I'm connecting a Tesa tt20 with a serial port. TT20 measures thickness and returns a 6 digit fractional number (0.0000). Communication works fine on most desktops and/or laptops. I have to say that i throw away the first measurement, because values where not to be trusted.
In one case, the following occures :
Sometimes there are gaps between the numbers.
Something like this : 1. 23 or 0.0 2
Examining this string in codes display, the gap appears to be \00 or in very rare cases \s
When we connect a laptop on the same TT20, communication works fine
It seems to be a problem with the desktop, some kind of setup -parameter ?
I was wondering if anyone has encoutered the same problem ?
Thanks in advance
Regards
Christine

Centerbolt,
I gathered a bit of info.
The same cable is used on desktop and portable
It seems to be an optical RS232
In attachment you will find the communications spec for the TT20. Not much to go on. But i am not a specialist on this.
I am using labv 8.2.1
You are right about the timing. I will make a version where i will make sure that the wait comes before the property node
Many thanks
Regards
Christine
Attachments:
RS232_UK pg80.jpg ‏73 KB

Similar Messages

  • How to send data using serial Communication

    I want to make serial communication using RXTXcomm.jar file.I was written the code.From this I got the list of serial ports avilable on pc but then after when I was tring to send command to machine which is attached to port it didn't gave any reply.
    Tell me that how to send command to port?

    This is how I do it:// open port, get ownership
    SerialPort serialPort= (SerialPort)portId.open(APPLICATIONNAME, timeout);
    // no framing and no threshold
    serialPort.disableReceiveFraming();
    serialPort.disableReceiveThreshold();
    // communication speed, parity, stopbits and databits
    serialPort.setSerialPortParams(BAUDRATE, SerialPort.DATABITS_8,
         SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
    // no handshaking or other flow control
    serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
    // timer on any read of the serial port
    serialPort.enableReceiveTimeout(TIMEOUT);
    // open streams for reading and writing
    InputStream is= serialPort.getInputStream();
    OutputStream os= serialPort.getOutputStream();... then you use the 'os' stream for writing and the 'is' stream for reading.
    kind regards,
    Jos

  • Sending File Over Serial PORT

    Hi,
    I'm able to read/write data over serial port using Java Comm APIs in Linux.
    Can anybody please tell me how to write/read a file over Serial port?
    Is it similar to sending a file over network?
    An early response is appreciated...

    Same stream I/O as used over the port works from a file. Dead simple.
    Also dead slow. If you want to do large amounts of data, use a RandomAccessFile and read a big chunk at a time into a byte array. Then send the byte array.

  • User-specified DAQ interruptions, instrument control through serial communication

    I'm working on an instrument control program, and I've run into a structural problem that I cannot figure out.
    The instrument in question is effectively a thermostat.
    The program has two functions:
    1.)  Background sampling to record temperature in a log over time.
    2.)  Adjust temperature according to user input
    The issue is that the instrument uses EIA-232 serial communication to talk to the PC.
    This prohibits simultaneous execution.  Attempting to send a command while the program is taking a sample will result in serial blockage errors.
    So the program must interrupt background sampling until the specified command has been completed.
    I can't figure out how to do this.
    My best idea was to create a manual pause control.  If the user wants to adjust the temperature, he hits a switch to pause the sampling, sends the appropriate command, then hits the switch again to reinitiate sampling.  This method will suffice, but is not ideal.
    Beyond that, I really have no idea how to prevent the two functions from running into each other.
    Help structuring this program would be greatly appreciated,
    Thank you

    Look into Semaphores (icons with traffic light glyphs)
    Set up a Semaphore resource to the COM port that is wired to two parallel structures.
    One structure would do the background polling, the other would handle setting changes.
    Prior to background poll, lock the resource, then unlock it after the poll. Likewise for the setting change command.
    When a resource is locked, the other process cannot access it until it is unlocked. Be sure to dispose of the Semaphore when ending the program.
    -AK2DM
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    "It’s the questions that drive us.”
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    Attachments:
    SempahoreExample.jpg ‏256 KB

  • VISA Read function Read buffer problem in serial communication

    Hi,  I use VISA write and read function in serial communication app, the device continuously sends 0x00 if it is not receive a request from Labview program running on PC.
    And the request sent by labview is programmable. I met a weird problem, each time the request changes, the VISA read buffer output port still shows the last request firstly, from second time, shows the right request.
    It works like: Req code: ... 50, 51,51,51,50....;  VISA Read buffer: ...50, 50, 51, 51, 51, 51, 50....
    Please refer to the program.
    Attachments:
    readOne_test.vi ‏21 KB

    How are you running this?  You don't have a while loop around it.  Is it part of a larger VI?  Please don't tell me you are using the run continuously button.
    You don't have any wait statement between you VISA Write and your bytes at port.  So it is very likely the receive buffer is still empty since you didn't give your VI time to wait for the device to turn around and give a reply.  If you read 0 bytes, your VISA read string will be empty.  How does your decoder subVI (which you didn't include) handle an empty string?

  • To read 512 bytes using serial communication

    I want to read 512 bytes of data using rs 232 with the timeout of 30ms. I am using "Serial read with timeout -Palm.vi". Is there a limitation of the number of bytes I can specify to this VI?
    Thanks!!
    Attachments:
    Serial_Read_with_Timeout--Palm.vi ‏63 KB

    Hi software enigineer,
    It is not possible to transfer 512 bytes per 30 ms here. To do this would require a baud rate of 136533 (512*8/.03) and the maximum possible baud rate is 115000. The recommend baud rate for a serial transfer is 9600, which would mean transferring at most 36 bytes if the timeout is kept at 30ms. Moreover, there is usually some overhead involved in serial communication, and I would recommend sending a little less than the maximum 36 bytes every time too.
    On another note, I noticed that in your block diagram, you are using the Bytes at Serial Port vi. Definitely use the output of this vi to determine how many bytes to read at a time and read the bytes as they become available in the serial buffer rather than reading in a large buffer
    all at once. Continuously read and append the output until there are no more bytes to be read or until the termination character is read. This will avoid any lost data transmission due to overflow.
    Good luck with your program!
    Kileen Cheng
    Applications Engineer
    National Instruments

  • Midlet with access to IrDA/serial communication on PDA urgently needed!

    Hi folks,
    our solution needs access to the IrDA or serial communication from within a midlet. Unfortunately this is not possible with the current MIDP implementation. The mobile we are using has additional vendor specific classes, but still IrDA fails when connecting to other mobiles or PDAs. Therefore, we are looking for a KVM on WinCE/Palm which provides access to the IrDA or serical communication channel in order to develop our application on a PDA while waiting for MIDP 2.0 to come.
    Please send me some feedback ;-)
    Cheers Harald

    Indeed the serial port access to the IR port is supported in the latest WSDD releases.

  • How LV handles sending of serial communiation bytes?

    Hi!,
    I have some questions regarding the manner in which LV performs serial communication. My questions are:
    1) Does LV convert my Hex into Binary or do I need to feed Binary string to the write vi?
    2) Do I feed the complete message frame (Device Address + Function + Register Address + Data + CRC) as one string? If yes, then should each byte be separated by space or comma? If no, then am I to write each byte separately using the write vi in a loop?
    3) Does LV attach the necessary start and stop bits (as per my port config) with the string to be written? Will it do this for each field and the message?
    4) Does LV ensure that the LSB is transmitted before the MSB?
    Thanks and Best regards,
    Gurdas
    www.qagetech.com
    Gurdas Singh
    PhD. Candidate | Civil Engineering | NCSU.edu

    Hello,
    1). Termination characters are relevant for a read function in the sense that if your instrument appends a termination character to the strings it writes, then you can terminate your read function with that character by simply reading some number of bytes, say 100. That is, if you specify reading 100 bytes and you receive a termination character on the 30th byte, your will stop reading and not read another byte for that execution of the read function (if of course you have termination characters enabled). Termination characters are relevant for write operations in that if your instrument expects a termination character when it reads the serial port, you will have to include one in your write string. This is usually just a linefeed or carriage return character, and how your instrument communicates should be documented in the manual.
    2). The format of the string that your instrument expects is completely dependent upon the instrument. You should be able to find a list of the command strings in the user manual; if not simply contact the manufacturer and they should be able to provide you with that information.
    3). This one seemed to be ok in your response.
    4). First, it is important to note that how you choose to define the string (hex or normal ascii display) will not affect what is sent (as long as you are defining the same string. For example, the ascii character '#' is represented in memory by a single byte (8 bits) which define the number 35 (decimal), which is equivalent to hex 23 and binary 00100011. The idea behind sending data LSB first refers to sending the least significant BIT first for a given byte. For the '#' character, this means that format of the frame of data (as it is often referred to as) will have the least significant bit sent first (the 1 on the right side of the binary representation in this case). It is VERY IMPORTANT TO NOTE that you need NOT be concerned with this when writing to and reading from the serial port. The UARTs (Universal Asynchronous Receive and Transmit) will take care of actually pulling in the frames, interpreting the data portion correctly, and putting it into memory for you (actually in most UARTs it gets put into a dedicated FIFO first, but don't worry about that either). All you have to do is use the read function and you will read in bytes just as they were sent!!! Now that we have clarified that a bit, let me answer the other part of your question which was effectively which byte gets sent first if you write a string of bytes. Suppose I write the string "I love the serial port!" to COM1 and read it into COM1 also (this can be done be performing a loopback test; simply connect pins 2 and 3 on the DB9 standard serial connector... these are the receive and transmit pins respectively). If I were to read only 1 byte, I would read in the 'I' byte. If I did not close the serial port, but read again 1 byte, I would read in the space character shown after the 'I' character. Basically, the first letter you type in your write string will be the first letter received when read back in by whatever port you are connected to. If initially you read 10 bytes, you would simply read the first 10 bytes of the string; in the above example this would be the string "I love the" where the white space characters are counted.
    5). I think all of the items in question 5 can be addressed with the following:
    If you are continuously being sent data, and receiving at your serial port, then you can continuously read that port and you will be returned the oldest data in the buffer. If you would like, you can read 1 byte at a time and you will always get 1 byte; if it makes sense to read 4 bytes at a time, you can do that. Essentially, the number of bytes you read from the buffer is arbitrary, and once the data has been read from the buffer by the read function it is no longer there. The example I gave above talked about reading 1 byte at a time and shows this idea. If you perform a read multiple times you will simply read data from the buffer in the order in which it was written to the buffer (ie. you will read starting from the beginning of the string). If multiple writes occur, the consecutive writes will simply add to the buffer, effectively concatenating consecutive writes to the end of what is already in the buffer. There will not be any separating characters unless those character are actually written into the write-string. There are some finer issues with how fast the read function will return with data dependent upon the read FIFO size on the UART (which can be set in software for most modern UARTs), but this will only affect read function return times on the order of a few milliseconds... you should not have to worry about this at all (it has to do with how many bytes are stored into UART FIFO memory before it interrupts the processor on your machine and actaully transfers those bytes into memory where your read function has access to reading them... the buffer referred to previously in this message has referred to the memory your read function reads from, and not the FIFOs mentioned here)!!! In general, you can put your read function in a loop, and continuously read data from memory, where again you will read the data in the order it was sent (see the above example).
    Best,
    JLS
    Sixclear

  • Serial communication with forms developer

    How I can send character to a serial port with form developer 6.0 on winNT 4.0?
    Thank you, P. Guerriero.

    If you're using a serial connection can you talk to it using HyperTerminal, or equivalent serial communication program? You should check this first.
    More than likely the issue is with termination characters. Check the documentation to determine what termination characters need to be used when sending commands, and what termination characters are used to indicate the end fo a read. For commands it's usually just a carriage return, and for reading data it's usually a linefeed.

  • Java Serial Communication (Student)

    Hey there,
    Im new to this forum and currently a full time student (not in any type of computer programming). I am currently working on an assignment in Java Programming and I am having difficulty with having my program executing the scenario i want.
    If anyone is willing or available to help me, I will post the code I currently have and explain where I am encountering problems.
    The program is a basic serial communication applet, that has two buttons and a textfield. The first button is supposed to send the text in the textfield (writeButton) and the second button will be used to read the text (readButton).
    For now I am creating two separate applets, one to write and one to read, with only one button "performing" an action in each.
    Thanks

    Ok I got rid of the code that I don't think I need and added the actionListener.
    The program compiles with no errors, but will still not send the messageString.
    Do you see where the possible errors are?
    import java.io.*;
    import java.util.*;
    import javax.comm.*;
    import javax.swing.JApplet;
    import java.awt.event.*;
    import java.awt.Graphics;
    import java.applet.*;
    import java.awt.*;
    public class ProjectWrite_test_2 extends JApplet implements ActionListener
         static Enumeration portList;
         static CommPortIdentifier portId;
         static String messageString = "Hello, world!\n";
         static SerialPort serialPort;
         static OutputStream outputStream;
         //public static void main (String [ ] args) {
         String OutString;
         TextField textFieldWrite;
         Button writeButton;
         Button readButton;
              public void init()
                    writeButton = new Button ("Press to Write");
                    writeButton.addActionListener(this);
                    readButton = new Button ("Press to Read");
                   Container window = getContentPane();
                   window.setLayout(new FlowLayout());
                   window.add(writeButton);
                   window.add(readButton);
                    textFieldWrite = new TextField(50);
                   add(textFieldWrite);
                    String outString = textFieldWrite.getText();
                   public void paint (Graphics g)
                             String s = textFieldWrite.getText();
                   g.drawString(s, 40, 50);
              public void actionPerformed(ActionEvent c)
                        portList = CommPortIdentifier.getPortIdentifiers ( ) ;
                                  while (portList.hasMoreElements ( ) ) {
                                       portId = (CommPortIdentifier) portList.nextElement ( ) ;
                                       if (portId.getPortType ( ) == CommPortIdentifier.PORT_SERIAL) {
                                            if (portId.getName ( ) .equals ("COM1")) {
                                                      try {
                                                           serialPort = (SerialPort)
                                                           portId.open ("SimpleWrite", 2000);
                                                      } catch (PortInUseException e) { }
                                                      try {
                                                           outputStream = serialPort.getOutputStream ( ) ;
                                                      } catch (IOException e ) { }
                                                      try {
                                                           serialPort.setSerialPortParams (9600,
                                                                SerialPort.DATABITS_8,
                                                                SerialPort.STOPBITS_1,
                                                                SerialPort.PARITY_NONE) ;
                                                      } catch (UnsupportedCommOperationException e) { }
                                                      try {
                                                           outputStream.write(messageString.getBytes());
                                                      } catch (IOException e) { };
                             }

  • Serial communication with Omni Link

    Has any body had any success communication with an Omni Link 5000 using LabVIEW?
    Thanks.

    If you're using a serial connection can you talk to it using HyperTerminal, or equivalent serial communication program? You should check this first.
    More than likely the issue is with termination characters. Check the documentation to determine what termination characters need to be used when sending commands, and what termination characters are used to indicate the end fo a read. For commands it's usually just a carriage return, and for reading data it's usually a linefeed.

  • Applet- RS232 serial communication

    Hi,
    Can any one tell how to do applet -RS232 serial communication?Do i signed applets? any secuirty policies to incorporated?
    Thanx
    /JP

    you need to install the jre, and place the win32.dll at JavaSoft\JRE\1.3.1_06\bin, that properties file place at JavaSoft\JRE\1.3.1_06\lib, comm.jar at JavaSoft\JRE\1.3.1_06\lib\ext\
    and in ur code try to use it to open ur com port
    public String test() {
    String drivername = "com.sun.comm.Win32Driver";
    try
    CommDriver driver = (CommDriver) Class.forName(drivername).newInstance(); driver.initialize();
    catch (Throwable th)
    {* Discard it */}
    drivername = "javax.comm.*";
    try
    CommDriver driver = (CommDriver) Class.forName(drivername).newInstance(); driver.initialize();
    catch (Throwable th)
    {* Discard it */}
    portList = CommPortIdentifier.getPortIdentifiers();
    while (portList.hasMoreElements()) {
    portId = (CommPortIdentifier) portList.nextElement();
    if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
    if (portId.getName().equals("COM2")) {
    //if (portId.getName().equals("/dev/term/a")) {
    try {
    serialPort = (SerialPort)
    portId.open("SimpleWriteApp", 2000);
    } catch (PortInUseException e) {}
    try {
    outputStream = serialPort.getOutputStream();
    } catch (IOException e) {}
    try {
    serialPort.setSerialPortParams(9600,
    SerialPort.DATABITS_8,
    SerialPort.STOPBITS_1,
    SerialPort.PARITY_NONE);
    } catch (UnsupportedCommOperationException e) {}
    int i=0;
    while(true)
    try {
    messageString="hi";
    System.out.println(i++);
    outputStream.write(messageString.getBytes());
    } catch (IOException e)
    System.out.println(e);
    messageString=String.valueOf(e);
    return messageString;
    and yet u need to signed the applet
    1. Compile the applet
    2. Create a JAR file
    3. Generate Keys
    4. Sign the JAR file
    5. Export the Public Key Certificate
    6. Import the Certificate as a Trusted Certificate
    7. Create the policy file
    8. Run the applet
    Susan
    Susan bundles the applet executable in a JAR file, signs the JAR file, and exports the public key certificate.
    1. Compile the Applet
    In her working directory, Susan uses the javac command to compile the SignedAppletDemo.java class. The output from the javac command is the SignedAppletDemo.class.
    javac SignedAppletDemo.java
    2. Make a JAR File
    Susan then makes the compiled SignedAppletDemo.class file into a JAR file. The -cvf option to the jar command creates a new archive (c), using verbose mode (v), and specifies the archive file name (f). The archive file name is SignedApplet.jar.
    jar cvf SignedApplet.jar SignedAppletDemo.class
    3. Generate Keys
    Susan creates a keystore database named susanstore that has an entry for a newly generated public and private key pair with the public key in a certificate. A JAR file is signed with the private key of the creator of the JAR file and the signature is verified by the recipient of the JAR file with the public key in the pair. The certificate is a statement from the owner of the private key that the public key in the pair has a particular value so the person using the public key can be assured the public key is authentic. Public and private keys must already exist in the keystore database before jarsigner can be used to sign or verify the signature on a JAR file.
    In her working directory, Susan creates a keystore database and generates the keys:
    keytool -genkey -alias signFiles -keystore susanstore -keypass kpi135 -dname "cn=jones" -storepass ab987c
    This keytool -genkey command invocation generates a key pair that is identified by the alias signFiles. Subsequent keytool command invocations use this alias and the key password (-keypass kpi135) to access the private key in the generated pair.
    The generated key pair is stored in a keystore database called susanstore (-keystore susanstore) in the current directory, and accessed with the susanstore password (-storepass ab987c).
    The -dname "cn=jones" option specifies an X.500 Distinguished Name with a commonName (cn) value. X.500 Distinguished Names identify entities for X.509 certificates.
    You can view all keytool options and parameters by typing:
    keytool -help
    4. Sign the JAR File
    JAR Signer is a command line tool for signing and verifying the signature on JAR files. In her working directory, Susan uses jarsigner to make a signed copy of the SignedApplet.jar file.
    jarsigner -keystore susanstore -storepass ab987c -keypass kpi135 -signedjar SSignedApplet.jar SignedApplet.jar signFiles
    The -storepass ab987c and -keystore susanstore options specify the keystore database and password where the private key for signing the JAR file is stored. The -keypass kpi135 option is the password to the private key, SSignedApplet.jar is the name of the signed JAR file, and signFiles is the alias to the private key. jarsigner extracts the certificate from the keystore whose entry is signFiles and attaches it to the generated signature of the signed JAR file.
    5. Export the Public Key Certificate
    The public key certificate is sent with the JAR file to the whoever is going to use the applet. That person uses the certificate to authenticate the signature on the JAR file. To send a certificate, you have to first export it.
    The -storepass ab987c and -keystore susanstore options specify the keystore database and password where the private key for signing the JAR file is stored. The -keypass kpi135 option is the password to the private key, SSignedApplet.jar is the name of the signed JAR file, and signFiles is the alias to the private key. jarsigner extracts the certificate from the keystore whose entry is signFiles and attaches it to the generated signature of the signed JAR file.
    5: Export the Public Key Certificate
    The public key certificate is sent with the JAR file to the whoever is going to use the applet. That person uses the certificate to authenticate the signature on the JAR file. To send a certificate, you have to first export it.
    In her working directory, Susan uses keytool to copy the certificate from susanstore to a file named SusanJones.cer as follows:
    keytool -export -keystore susanstore -storepass ab987c -alias signFiles -file SusanJones.cer
    Ray
    Ray receives the JAR file from Susan, imports the certificate, creates a policy file granting the applet access, and runs the applet.
    6. Import Certificate as a Trusted Certificate
    Ray has received SSignedApplet.jar and SusanJones.cer from Susan. He puts them in his home directory. Ray must now create a keystore database (raystore) and import the certificate into it. Ray uses keytool in his home directory /home/ray to import the certificate:
    keytool -import -alias susan -file SusanJones.cer -keystore raystore -storepass abcdefgh
    7. Create the Policy File
    The policy file grants the SSignedApplet.jar file signed by the alias susan permission to create newfile (and no other file) in the user's home directory.
    Ray creates the policy file in his home directory using either policytool or an ASCII editor.
    keystore "/home/ray/raystore";
    // A sample policy file that lets a JavaTM program
    // create newfile in user's home directory
    // Satya N Dodda
    grant SignedBy "susan"
    permission java.security.AllPermission;
    8. Run the Applet in Applet Viewer
    Applet Viewer connects to the HTML documents and resources specified in the call to appletviewer, and displays the applet in its own window. To run the example, Ray copies the signed JAR file and HTML file to /home/aURL/public_html and invokes Applet viewer from his home directory as follows:
    Html code :
    </body>
    </html>
    <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    width="600" height="400" align="middle"
    codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,1,2">
    <PARAM NAME="code" VALUE="SignedAppletDemo.class">
    <PARAM NAME="archive" VALUE="SSignedApplet.jar">
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
    </OBJECT>
    </body>
    </html>
    appletviewer -J-Djava.security.policy=Write.jp
    http://aURL.com/SignedApplet.html
    Note: Type everything on one line and put a space after Write.jp
    The -J-Djava.security.policy=Write.jp option tells Applet Viewer to run the applet referenced in the SignedApplet.html file with the Write.jp policy file.
    Note: The Policy file can be stored on a server and specified in the appletviewer invocation as a URL.
    9. Run the Applet in Browser
    Download JRE 1.3 from Javasoft
    good luck! [email protected]
    i already give u many tips, i use 2 weeks to try this to success, hopw that u understand that, a result of success is not important, the process of how to get things done is most usefull!

  • Having issues with simple serial communication.

     I followed a tutorial online to start learning basic serial communication. The tutorial involved shorting pins 1 and 3 on the Comm 1 port, and writing a simple program (attached). I edited the program a little, to show the varied results that I get when trying to write and read a simple phrase via serial port. 
    Could someone explain what causes the kind of result shown in "Serial Comm Example.png"? I believe it has to do with timing. Why would only parts of the phrase be transmitted?
    Thanks,
    Sarah
    Solved!
    Go to Solution.
    Attachments:
    Serial Comm Example.vi ‏30 KB
    Serial Comm Example.png ‏139 KB

    sarahzig wrote:
    The tutorial involved shorting pins 1 and 3 on the Comm 1 port
    Shouldn't that be pins 2 and 3?  On a standard DB-9 serial port, pin 2 is the Recieve and pin 3 is the Transmit.
    Now for your code...
    1. Move the Configure Serial Port to be before the loop.  You only need to configure the port once.
    2. Close the port after the loop.
    3. Handle your error after the close.
    4. Stop your loop on an error or the stop button was pressed.  You will need an OR in there.
    5. No need for the Flush Buffer function.  Remove it.
    6. Using the Bytes At Port is a dangerous thing.  It introduces all kinds of interesting race conditions.  Instead, tell the VISA Read to read the number of bytes you expect to read.
    6a. Alternatively, be sure to send an End Of Line character at the end of your sent data and set the number of bytes to read to something a lot more than you would ever expect to read.  The VISA Read will stop reading when it a) sees the number of bytes it was told to read, b) sees the termination character (currently enabled and set to a Line Feed, which is part of the End Of Line), or c) the timeout happens.  Whichever happens first.
    7. With 6, the wait is no longer needed.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions

  • Emulator support serial communication?

    Hi all
    I'm trying to implement some serial communication using mobile to write to usb. But I'm surprised that is it possible to do with using emulator?
    Here the problem is
    String ports = System.getProperty("microedition.commports");this thing always return null when run it on my mobile. I used k510i to test this and finally got to know that jp6 (k510i) does not support serial communication.
    But when this run on emulator it gives output string as COM1, COM2.
    So my question is can we use emulator to do this, hence emulator does not have usb cable and does any one has an idea to convert emulator to make enable this?
    If can please tell me how?

    Sorry to say you that you can not touch your PC hardware from the emulator. Because the emulator runs KVM
    as its runtime over the JVM. Thus if you want to touch the hardware of your PC then you have to request your
    JVM from the KVM to communicate with the hardware and return you the response. Which is not at all possible.
    But if you still want to use the COM1 and COM2 then run two different instances of the emulator and start a serial
    communication between two emulators like a chat application.
    Shan!!!

  • Arduino due and Labview wirelss serial communication using Xbee

    Hello.
    I am controlling a mobile robot using the Arduino due and labview
    PWM value caculated on the labview is sent to Arduino due and then Due controls the robot.
    These communicate wirelessly by xbee.
    Now, I'd like to increase the communication speed between Arduino due and Labview.
    but, when i set the value of the "Wait(ms)" function to below 10ms  in Labview, communication has unstability.
    so please let me know how increase the communication speed.
    thank you.
    -experiment image-
    https://www.youtube.com/watch?v=oZdMCdHlDhM
    - Arduino source-
    #include <string.h>
    int PWM1 = 5;
    int DIR1 = 4; //direc
    int PWM2 = 6;
    int DIR2 = 7; //dir
    float readNumber = 0;
    float In1, In2, pwm, newtime, A;
    float newposition1 = 0;
    float newposition2 = 0;
    unsigned int Aold1 = 0;
    unsigned int Bnew1 = 0;
    unsigned int Aold2 = 0;
    unsigned int Bnew2 = 0;
    volatile long encoder1Pos = 0;
    volatile long encoder2Pos = 0;
    int encoder1PinA = 8;//Encoder A pin
    int encoder1PinB = 9;//Encoder B pin
    int encoder2PinA = 11;//Encoder A pin
    int encoder2PinB = 12;//Encoder B pin
    int Direction1, Direction2;
    float pwm1_limit=255;
    float pwm2_limit=255;
    float count_old = 0;
    float power1_old, power1_old2, power1_old3, power1_old4, power1_old5;
    void setup() {
    // put your setup code here, to run once:
    pinMode(DIR1, OUTPUT);
    pinMode(DIR2, OUTPUT);
    Serial.begin(115200);
    Serial.flush();
    Serial2.begin(115200);
    Serial2.flush();
    pinMode(encoder1PinA, INPUT);
    digitalWrite(encoder1PinA, HIGH); // turn on pullup resistor
    pinMode(encoder1PinB, INPUT);
    digitalWrite(encoder1PinB, HIGH); // turn on pullup resistor
    pinMode(encoder2PinA, INPUT);
    digitalWrite(encoder2PinA, HIGH); // turn on pullup resistor
    pinMode(encoder2PinB, INPUT);
    digitalWrite(encoder2PinB, HIGH); // turn on pullup resistor
    attachInterrupt(encoder1PinA, d1EncoderA, CHANGE);
    attachInterrupt(encoder1PinB, d1EncoderB, CHANGE);
    attachInterrupt(encoder2PinA, d2EncoderA, CHANGE);
    attachInterrupt(encoder2PinB, d2EncoderB, CHANGE);
    void loop() {
    if(Serial2.available()>0){
    String first = Serial2.readStringUntil('!');//랩뷰에서 받는 2개의 값을 분리하기 위한 소스("!"앞까지 끊고, "@"앞까지 끊음 ex)123!456@을 받으면 123과 456으로 나눔)
    String second = Serial2.readStringUntil('@');//http://stackoverflow.com/questions/29504679/splitting-a-comma-separated-string-through-serial-arduino
    float x = first.toFloat();//위에서 분리된 문자를 float형으로 바꿔줌
    float y = second.toFloat();
    newposition1 = -encoder1Pos; //Encoder signal
    newposition2 = encoder2Pos; //Encoder signal
    count_old = 0;
    float power1 = x;
    float power2 = y;
    if(power1 >= 0){
    Direction1 = LOW;
    else{
    Direction1 = HIGH;
    if(power2 >= 0){
    Direction2 = HIGH;
    else {
    Direction2 = LOW;
    power1 = abs(power1);
    power2 = abs(power2);
    if(power1 > pwm1_limit){
    power1 = pwm1_limit;
    if(power2 > pwm2_limit){
    power2 = pwm2_limit;
    digitalWrite(DIR1, Direction1); //HIGH = back, LOW = forward
    digitalWrite(DIR2, Direction2); //HIGH = back, LOW = forward
    analogWrite(PWM1, power1);//PWM Speed Control
    analogWrite(PWM2, power2);//PWM Speed Control
    String strValue = String(newposition1);//숫자를 문자형으로 변환
    String Q = "!";
    String strValue2 = String(newposition2);
    String stringThree = strValue + Q + strValue2;//문자 합치기
    Serial2.println(stringThree);//Send encoder pulse to Labview
    else {//when Serial communication stop
    float count = count_old+1;
    if(count > 10000){
    newposition1 = 0; //Encoder initialization
    newposition2 = 0; //Encoder initialization
    encoder1Pos = 0;
    encoder2Pos = 0;
    else{
    newposition1 = newposition1; //Encoder signal
    newposition2 = newposition2; //Encoder signal
    count_old = count;
    Serial.println(count);
    //Encoder Read//////////////////////////////////////////////////////////
    void d1EncoderA()
    Bnew1^Aold1 ? encoder1Pos++ : encoder1Pos--;
    Aold1 = digitalRead(encoder1PinA);
    void d1EncoderB()
    Bnew1 = digitalRead(encoder1PinB);
    Bnew1^Aold1 ? encoder1Pos++ : encoder1Pos--;
    void d2EncoderA()
    Bnew2^Aold2 ? encoder2Pos++:encoder2Pos--;
    Aold2=digitalRead(encoder2PinA);
    void d2EncoderB()
    Bnew2=digitalRead(encoder2PinB);
    Bnew2^Aold2 ? encoder2Pos++:encoder2Pos--;
    }

    piZviZ wrote:
    Only data rate working is 9600  between labview and launchpad(arm cortex m4).Where all data rates work between Arduino serial port monitor and launchpad(arm cortex m4).
    Since the only thing that changed is the Launchpad, then that must be the issue.  Are you sure this device can handle more than just the 9600 baud rate?  Are you sure you are even setting the baud rate on this device?

Maybe you are looking for