Problems with serial port synchronization.

Hello to all!
I have an oxygen analyser, the equipment has a serial port for communication, being based the communication on the AK communication protocol.
In order to request to the equipment that responds with the measured value, the following command in hexadecimal is sent:  (02 78474B4FE20 03), obtaining like hexadecimal answer the following: (02 58474B4FE203220323038353030 03), in which it is included the measured value.
I need to have the measurement from equipment in a PC, using the AK protocol and the serial port. For this, I have made a (vi) that it writes the read measure command in the serial port, wait a time (150ms) and read the port, this way everything works correctly, but there is a problem and it is that the communication is very slow due to the delay between the writing and the reading.
If I eliminate the delay, the synchronization between the writing and the reading is lost, appearing readings of value 0. I think that is because the PC read the port and the analyser not yet has responded to the request from PC, and this happens in spite of using the options of synchronization of visa read and visa write vi's, (Do I/O synchronously).
I would need to design a (vi) that hoped that the equipment had sent the last data, and then it sends the reading request again, being able this way to make the communication more fast and to eliminate the erroneous readings.
I have attached two examples, first is (vi) that works well, but has the problem of being slow due to the delay, and the second analyzes the received message to know when this complete and then it writes another message of read to analyser, but it appears to me an error (ocurred AT sights read... Time out) after minutes.
I would thank any aid that somebody could offer to me.
Greetings and thanks!
Attachments:
Test_AK.zip ‏32 KB

I don't have a serial port connected on this machine at the moment (they are becoming rare on laptops!) but try this code as a starting place. I notice in your second example you are basing the read on receiving a specific string, in the one I've made you can set the bytes at port compare to a number equivalent in length. I haven't tried it, as I mentioned before, so I appologize for any errors in my code.
P.M.
Putnam
Certified LabVIEW Developer
Senior Test Engineer
Currently using LV 6.1-LabVIEW 2012, RT8.5
LabVIEW Champion
Attachments:
serial read.vi ‏67 KB

Similar Messages

  • Communicating with Serial Port

    Hi,
    Hi I have an application that i have to communicate with serial port...
    Its working perfectly if am giving all the com settings as constants(pls hav a look @ codea).
    But i want to read the port number and baud reate from text file.When i changed the coding,in the serial
    setting i was not even able to find the port number and baud rate.it was displaying as buffer size.I think the way i connected the port number and baudrate to the clusture may be wrong(pls refer codeb).How do i fix this problem?
    Thanks in Advance....
    Solved!
    Go to Solution.
    Attachments:
    modemsetting.JPG ‏88 KB

    The problem I think is that you don't have a cluster tied to the center terminal of the bundler so most of the values don't have a name. Wire the cluster from above to the center terminal on the lower bundler. BTW, it doesn't matter what values are in the cluster you wire up because they will be overwritten.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Problem with *serial no. profile* in work sheduling view of material master

    Hi ! !
    I am here with a problem with serial no. profile in work sheduling view of material master.
    By mistake for some FHMI type ( PRODUCTION RESOURCE TOOLS )materials, serial no profile exist in 'work sheduling' view. Due to that we are facing problem in GRN.
    when I am trying to remove that with MM02. i m getting a message as Serial numbers already assigned to this material
    Please suggest how to remove serial no. profile.
    Thanks in advance,
    Prab

    Hi,
    go to MMBE and check the Current Serial number...for  FHMI type
    and go to IQ02 and close the Serial number range at the Current number range...
    Now you can assign this serial number range to another material type...
    Thx
    Raju

  • Any way to communicate with Serial PORT using JavaScript

    is there any way to communicate with Serial PORT using JavaScript ??
    Dont tell me to do it in java because I need to this on client side not on server side.
    such as when client pressed the button, a javascript function will be called and in that function I need to communicate with the serial port of that client... That action will not go to server side.

    Is there any way to send a string of bytes to the serial port from the client side ?
    Just a button on the web page that sends out stuff to the comport.
    I was hoping to do this using java script also ..

  • I have Power Mac G5 1.8 single. I have a problem with ethernet port, before it was working with the internet, but now i shows it is connected even the cable is disconnected. I'm running Leopard 10.5. any help

    I have Power Mac G5 1.8 single. I have a problem with ethernet port, before it was working with the internet, but now i shows it is connected even the cable is disconnected. I'm running Leopard 10.5. any help

    Reset the PRAM.
    http://support.apple.com/kb/HT1379
    If that fails, reset the PMU.
    Scroll down the following page and click the G5 link for instructions:
    http://support.apple.com/kb/ht1939

  • Use a HP 34970a with serial port

    Hello,
    I have labview 7.0 and I have to use a HP 34970a with serial port.
    Can anyone say to me any advice to do it?
    Where can I find some material?
    Thanks
    Vincent

    Hi Vincent,
    > I have labview 7.0 and I have to use a HP 34970a with serial port.
    > Can anyone say to me any advice to do it?
    > Where can I find some material?
    Your first step should be visiting http://ni.com/idnet and search for an
    instrument driver for your device (in this case I can promise you will
    find one).
    The "Learn" link on the same page tells you more about instrument
    drivers in general which could be helpfull if this is the first time you
    are working with instrument drivers.
    Rico

  • Communicating jsp with serial port

    Hi, I'm developing an web application that needs to communicate with Serial port. I'm not getting how to communicate with Serial port. I'm building application using jsp. Any one help me Please...

    package serialio;
    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.OutputStreamWriter;
    import java.io.OutputStream;
    import java.util.Enumeration;
    import java.util.TooManyListenersException;
    import javax.comm.CommPortIdentifier;
    import javax.comm.PortInUseException;
    import javax.comm.SerialPort;
    import javax.comm.SerialPortEventListener;
    import javax.comm.SerialPortEvent;
    import javax.comm.UnsupportedCommOperationException;
    * @author SASH
    public class SimpleWrite
    implements Runnable, SerialPortEventListener {
    public String line = "";
    public String line1 = "";
    public String text1 = "";
    public String text2 = "";
    public void run() {
    static Enumeration portList;
    static CommPortIdentifier portId;
    // static String dest = "0517111930";
    static String messageString = "Hello";
    InputStream inputStream;
    static SerialPort serialPort;
    static OutputStream outputStream;
    public void serialEvent(SerialPortEvent event) {
    switch (event.getEventType()) {
    case SerialPortEvent.DATA_AVAILABLE: {
    BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
    try {
    while ((line = reader.readLine()) != null) {
    arata(line);
    // System.out.println(line);
    } catch (IOException e) {
    System.err.println("Error while reading Port " + e);
    break;
    } //switch
    public int getWrite(SerialPort serial) {
    try {
    inputStream = serial.getInputStream();
    outputStream = serial.getOutputStream();
    try {
    serial.addEventListener(this);
    } catch (TooManyListenersException e) {
    System.out.println("Exception in Adding Listener" + e);
    serial.notifyOnDataAvailable(true);
    } catch (Exception ex) {
    System.out.println("Exception in getting InputStream" + ex);
    return 0;
    public static void main(String[] args) {
    portList = CommPortIdentifier.getPortIdentifiers();
    while (portList.hasMoreElements()) {
    portId = (CommPortIdentifier) portList.nextElement();
    if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
    if (portId.getName().equals("COM3")) {
    try {
    serialPort = (SerialPort) portId.open("SimpleWriteApp", 9600);
    SimpleWrite wr = new SimpleWrite();
    System.out.println(wr.getWrite(serialPort));
    } catch (PortInUseException e) {
    System.out.println("Port In Use " + e);
    try {
    outputStream = serialPort.getOutputStream();
    return;
    } catch (IOException e) {
    System.out.println("Error writing to output stream " + e);
    try {
    serialPort.setSerialPortParams(
    9600,
    SerialPort.DATABITS_8,
    SerialPort.STOPBITS_1,
    SerialPort.PARITY_NONE);
    } catch (UnsupportedCommOperationException e) {
    public String arata(String line) {
    System.out.println(line);
    if (line == null ? "250075C54CD9" == null : line.equals("250075C54CD9")) {
    System.out.println(text1);
    return "250075C54CD9";
    } else if (line == null ? "1D00451A3270" == null : line.equals("1D00451A3270")) {
    System.out.println(text2);
    return "1D00451A3270";
    return line;
    this code is working correct getting output at system output terminal but i want use further in as input for my jsp how to get this ?.......
    arata method is also working correct in class but it is not returnig value in jsp?
    plz give me way how to take string as input ...........

  • My laptop macbook pro has a problem with usb port they are not working.

    hi there i have a late 2011 mac pro, its been 2 years of purhase however reary used, now it has a problem with usb port are drawing too much power and usb ports are dissabled from the system. now i can not use usb ports. do yo have solution for it??? cheers

    Reset SMC.     http://support.apple.com/kb/HT3964
    Choose the method for:
    "Resetting SMC on portables with a battery you should not remove on your own".
    Best.

  • Problem with serial communicat​ion PLEASE HELP

    Hello everybody !
    I'd like to ask You for some feedback on my wierdo problem that I got with my program.
    I have built a device that detects changes in magnetic field. It is used for detecting vehicles passing it on a highway. Generally the main components communicate with each other by RS-485 protocol, but I would like to connect the device to a PC. To do so I am using a RS-232 protocol (I have a RS485=RS232 hardware converter).
    Now, I made the program (even two), which generally works, BUT some wierd things are going on sometimes; it happens that I have a problem to get a communication (after that, resetting the device by un-powering it helps, sometimes I have to restart the PC as well) but overall it happens quite not so often. The project itself is for passing one of my subject on the university - so I have to run the whole thing over there, here comes another problem : the program did not work on all of the bunch of PC's that are there. Same thing happens on my notebook. The effect of 'non working' is : I am recieving same data packet that is beeing sent... BTW : notebook does not have a RS232 port and I am using a USB-RS232 calbe converter (to count it out from the reason of problems I have checked it on my main PC and it works almost fine - almost because ocasionally I am getting the same sympthomps as I mentioned before ).
    Other problem is, when it works, that I am loosing communication for couple of hundreds of miliseconds and then it comes back to normal (i can see it on the osciloscope).
    I alredy looked for some answears here and there, and I found some suggestions about using 'buffer cleaning method', unfortunatelly I kinda do not know how to do it, and might that help anyways ?
    I also thought about using VISA drivers, but I am having trouble with it as well - the damn thing just does not work.
    My very bling guess is that everyting that I am expierencing is about using the communication protocol and seting it right. I am attaching both of the programs, PLEASE anyone pretty pretty help I totally ran out of ideas and knowledge and day after day I am turning it on and off on my PC and notebook hoping some miracle will occour ... 
    Many many thanks in advance !
      Best regards
                    Tom
    P.S. the program is very unfinished (man things are just put in), the main thing I am struggling now is getting, and setting the communication protocol right.
    Attachments:
    detektor_3_2.vi ‏141 KB

    The biggest problem I see is in the sequence:
    Write out a string.
    Wait 50 mSec.
    Ask how many bytes have been received.
    Read that many bytes.
    Can you guarantee that the data can make a round trip in 50 mSec?
    You should know that the SERIAL PORT WRITE completes NOT when the data has been sent out the port, but when it has been BUFFERED for sending. In other words it returns and starts the timer BEFORE it is actually sent.
    Also, given that there are 232 -> 485 --> USB conversions involved in both directions, I would bet that you are sometimes not allowing enough time for the data to get back.
    If you can control the protocol of what gets sent back, I would change your receiving logic. I think you should check for a carriage return or some other delimiter, and not react until you get that character (or until a reasonable timeout expires).
    In other words, try synchronizing the two ends. Something like:
    N = Get # bytes at port
    Read N bytes from port (flush any characters waiting).
    Write out command string.
    TimeLimit = NOW + 1000 mSec (or whatever)
    S = ''; (Working string)
    repeat
    N = #Bytes at Port
    If N > 0
    S = S + Read N Bytes
    Found = Search String for Delimiter
    until Found or (Now > TimeLimit)
    If Found, parse string S
    You are also re-initializing the port (SERIAL PORT INIT) every time thru the outer loop - that's unnecessary.
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • ME SDK 8.0 EA Device Manager - Problems with Serial COM-Connection

    I caught a first glimpse at the new ME SDK 8.0 - so far I have been working only with very old JavaME-Stuff on a Cinterion-TC65i-Chip.
    Want to connect my Raspberry Pi via serial COM-Connection with the SDK-8.0-EA-Device-Manager. (due to security reasons I'm not allowed to connect the Pi via LAN/Wifi)
    But the problem is the ME SDK 8.0 EA Device Manager only offers me COM4 (this is my built-in UMTS-Modem) - even though my target-COM-Device isn't busy at all.
    A serial connection via Putty and USB2Serial-Cabel (FTDDI) works fine and I can get on my Raspberry.
    Is there any reason or restriction I don't know for being unable to use my dedicated COM-Port? Or do I have to make any additional adjustments in hidden SDK-Property-files?
    In my opinion the device manager using COM should offer me the same possibilities as an IP-Connection regarding the target-device (transfering my Jad/jar to the device, installing them and starting them).
    There is something in the SDK-get-Started Docu about "Connecting to a UART Device" I'm not really cotton on . Is this information concerning me even though I'm using a Raspberry PI?
    To put my files manually via USB-Stick or Z-Modem on the PI is a tad of inconvinient.
    Any ideas? Or am I completely off track understanding your SDK-Tooling?
    Thx and best regards

    Hi,
    For the Raspberry Pi, tooling over serial port is not supported. The simplest solution is to use standard IP networking over Ethernet. This can be a direct connection between the PC and the Raspberry Pi, as long as the cable is twisted and the IP addressing is correct (e.g. manual IP addressing or DHCP server on the PC).
    Regarding "Connecting to a UART Device": This is meant for attaching and controlling serial devices from the Raspberry Pi, not for tooling connections between the Raspberry Pi and the PC.
    Hope this helps,
    -- Terrence

  • Problems with Serial Communication using Labview 6 and Solaris 8

    I am working on a Driver for a Temperature Controller. But I am stuck at the very basics. I am using Labview 6 and the platform is Solaris 8 on a SUN Ultra 60 Workstation. I can not get the Serial communication to work. When I am running raw (uncompiled) code it works (I can read from and write to ttya and ttyb) but once compiled I get error code 37 (device not found). I have tried the following steps to fix this with no luck.
    1) I made sure that the "serpdrv" file is in the same folder with the executable. I also make sure the serpdrv file is added as a support file when building the app.
    2) I changed from using traditional serial VI's to labview 6's new visa functions. With these "new" VI's when
    I try to initiliaze the visa device and wire a control to the "visa reference" input only 1 serial port shows up (ASRL2, missing ASRL1). I am not sure if this is part of same problem or whole new issue.
    3) I reinstalled both visa and labview 6.0.2 update hoping this would help with no luck
    4) I placed the following entry into the ".labviewrc" file
    labview.serialdevices: "/dev/ttya:/dev/ttyb"
    If anybody has had the same problem I would love to hear about it and if you have any solutions
    Jamie Shea

    Hi Jamie,
    1. Do you have NI-VISA driver installed on the machine on which you are running this executable?? If you are trying to run the executable on the same machine on which the development program has ran fine, then you can ignore this point.
    2. If you have done all the changes that are suggested by other discussions related to this topic, then try changing the Port input to Visa Serial Configure.Vi from a control to a constant and try it. In some case, I have seen this to do the trick. I think this point should solve your problem. If it does do tell me. :-))

  • Just purchased Wndows Vista and having problems with the port for Palm 125

    I just purchased a Windows Vista computer and having problems with getting my Palm 125 to sync with the desktop.  I get an error message saying:  "Com1 not available"  What do I do?
    Thanks,
    Frustrated
    Post relates to: Palm m125
    This question was solved.
    View Solution.

    Sorry, that didn't work.  I get no drop down menu from the Hot Sync Manager for the Serial Port.  What comes up often is:  "The selected port, COM1, is not available at this time.  Hot Sync Manager will open the port when it becomes available." 
    Could it be the Norton Antivirus Firewall that is preventing the Hot Sync Manager to open the Serial Port?  Just a thought.  Thanks for your help.
    Post relates to: Palm m125

  • Problems with USB port and song transferring;

    Hi! I just got an iPod and I am having problems with it. My computer doesn't have a Hi-Speed USB port, even if it's 9 months old. Some of my friends don't have it either but they still are able to transfer songs onto their iPod. For mine, it keeps saying "Do Not Disconnect." I waited for 5 hours last time I got it and it still isn't working.
    I also updated my iPod software today and the iPod icon isn't appearing on the bar to the left in iTunes. I'd really appreciate any help on this! As well as if I really need to do something about the ports or if it could function like this normally.

    Quote from: Svet on 08-December-10, 00:48:07
    Install chipset drivers from MSI web:
    http://eu.msi.com/index.php?func=driverfile&dno=2427&i=0
    +
    NEC USB 3.0 Drivers:
    http://eu.msi.com/index.php?func=driverfile&dno=11189&i=0
    are these the same driver provided with the disc driver? as i already installed both of these..

  • If you're having problems with USB ports, read on...

    i'm reading that alot of people on here are having problems with their front (or top) usb on their cases not working with their k7n2 boards.  i have come across the correct solution to this problem in one of the posts (after having solved the problem on my own), however noone has posted the solution by itself on this forum so everyone can easily see it.
    The trick is to make sure that pin 10 (at least on a K7n2 delta-L), the pin labeled USBOC (USB Open Connection), is wired to NOTHING.  If the connector to your front usb ports is fused into one giant connector and it HAS a wire that will connect to this pin (labeled GND2 or Shield or something), CUT THAT WIRE.  Pin 10 on JUSB2 (at least on a K7n2 delta-L) must be OPEN.  If this pin IS connected to something (even if it is only GND), the motherboard will think something is connected to this usb port and you will get many unknown devices listed in your windows device manager and the rest of your usb ports may or may not work.
    As a general rule of thumb, if a pin on a motherboard is labeled OC for "Open Connection" and you wire something to it, you're asking for trouble.
    If you cannot understand this you should not be attempting to wire a motherboard in the first place. 
    Here is a picture to go along with this discussion.  If you cannot see this picture, I am sorry for it has probably been removed from the place I posted it online as I cannot attach pictures physically to this post.  If someone here has a way to permanently host this picture and post it to this thread permanently, that would be wonderful.
    In summary: all usb ports/headers have only four pins associated with it (VCC, USB+, USB-, GND).  If the connector (whether it's one big connector or individual sockets) to your front/top usb port has 5 sockets, don't connect the 5th socket to anything.  That goes for any case/motherboard combination.  This is what i'm talking about above.  I have no idea why motherboard and case manufacturers have a 5th pin involved in any way on either the pin or socket side.  It is not used for usb.
    EDIT:  I just noticed this has already been discussed in the trouble shooting guide in the above sticky post.  oh well, now we have a pretty picture to go along with it (i hope).

    :-D)Hello guys,
    as promised I come back here to give the results of my tests... and I have to say that you saved my day (even if I had to open back 60 secured cases).
    So the solution was the right one, when I unplugged the "ground" end of the front USB connector cable from the USBOC pin, those connectors finally worked as expected with USB 2.0 compliant devices.
    So thank you really much for this very usefull information !
    And even if maybe it's not only MSI's fault, I still believe that more information on those connectors in the user's manual would be really usefull (who knows what USBOC means except a few people and who could imagine that pluggin on it a "ground" cable would make it unserviceable ??). And who ever saw a user's manual bundled with a case ?? it's pretty unusual  
    Hope that someone at MSI will read that and take it into consideration, not for me (because now I'm aware) but for the thousands other consumers that will feel a little bit "annoyed" with that issue. I don't think that adding one line about it in user's manuals would be so much expensive  
    But I'm quite lucky myself... being able to understand and write english (even if I still have some progress to do  ) gave me the possibility to find the solution... but a lot of my french fellows can't do that... and there's no french forum here... How can they do ? They rely on user's manual
    Best regards,
    Nicolas

  • Problem with Serial Number from MSi ATi HD4870 :/

    Hi all,
    I have problem with my HD4870. I lost the serial number (the small paper on back of card) from card. Have I any chance to get it back? I can take a photo and post it here some S/N and P/N from card, if it helpfull... I lose my warranty, if I can't get it back 
    So, any choice to get it?
    Thanks for answers,
    Mirek.

    Thanks for answers in first,
    I have problem with card - I had it two days in Crossfire with another HD4870 but accidentally when I played Metro 2033 I got some stripes on monitor (purple, blue) and then PC stop working. I had to restart PC and when the system booted to Windows, until 10 second I got the same stripes on monitor. Then my PC didn't boot.
    On my card I have 4 diodes - when I turned on pc, the diodes blinks but now blinks only TREE of FOUR diods.. So I took the card to shop when I bought it, but the shop-assistant told me, that I need this little paper on Card.. :/
    I'm from Czech Republic, so I have a little problem with directly contact to HQ of MSI
    So I have to go again to the shop and tell them, that Serial Numbers what they need are in card?

Maybe you are looking for

  • [Solved]Control of automatic GPU switching in Linux 3.13

    I'm using the Linux Kernel 3.13 of the testing repository, I have a laptop with Hybrid Graphics ATI/Intel: 00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09) 01:00.0 VGA c

  • After downloading latest quicktime update, itunes store will not load

    Has anyone had this same problem after downloading latest quicktime update. iTunes store will not load.

  • Customer LC

    Hi, We are issuing customer our invoice with Letter of Credit. Customer sign this lc as acceptence of invoice. We discount this lc from bank. At the end of the credit period of lc we pay the amount to the bank. How I can map this process with SD Modu

  • Best Practices for starting up and shutting down OAS

    A co-worker suggested that we set all processes on our Application Server to manual, and enter the startup sequence (opmn, em, etc) in autoexec.nt. Is this a best practice? Has anyone done this? I cant find any examples of this online. Does anyone se

  • Regarding 10g certification

    Hi to all, I want some details regarding 10g, and is there certification for doing OCA and OCP as developer ? If so please give details how many papers exist for OCA and OCP. Plz give the information. With Regards, Prakash G.