Visa Read problem from a PIC24's UART port

Thanks for taking the time to read my post.
I am using Labview 8 on Win XP CPU 3.4, 2GB RAM PC.
I am using a microcontroller PIC24 (on the Explorer 16 development board), which I have programmed to acquire an AC singal at a rate of about 4 kHz. The PIC24 has a 10bit ADC and the acquire value is then padded to16bits in total (format: 000000xxxxxxxxxx).
The serial setting for the pic and my Labview program are 115200, 8 data bits, no parity, 1 stop bit.
In order to send the acquired value to my PCs serial port (Remember UART = 8-bits of data only) I divide the 16 bit word into MSB and LSB. I then send the MSB and LSB 8-bit value one after the other.
The total data rate for this communication is about 64kbps.
The problem is that when I run the code I have written in Labview the CPU usage shoot up to 70% and I also see buffer overruns (a non continuous sine wave). If I a time delay in my while loop the buffer overruns increase.
Also if I try and use the ‘bytes at port’ VI the data I get is meaningless.
I would be grateful if someone can look at my code and give me some suggestion as to how I could make the ‘Visa Read’ VI more efficient.
Regards
Alex
Attachments:
Serial Client for PIC24.vi ‏101 KB

Dear all,
I do not know if you have been following my post, but I am still getting buffer overruns (a non continuous sine wave) when using VISA Serial Read.
The only way to avoid this, is by making the VISA Read VI, read 2-bytes at a time (with no time delay in the main while loop). However, when I do this I see the CPU usage shoot up to around 60% (which is something I would expect anyway, as the main while loop is executing as fast as possible).
I have attached the working code below and would appreciate ANY comments BIG or small.
I am still puzzled as to why when I connect the ‘Bytes at Port’ Property Node, the data I get is not correct.
I have gone through the Labview Examples, as well as the LV Basics 1 course examples (which are similar) and I have also looked in the Labview for Everyone / Labview Graphical Programming books.
However, I have found the examples to be far too simple, for what I am trying to achieve.
I am seriously thinking of purchasing the LV Instrument Control Self-Paced Course, but I am not quite certain this would help me much. I have read the Course outline provided by NI, but this did not provide me with more valuable information.
Can anyone that has ‘done’ this course advice me as to whether the material contains info on ‘high’ speed acquisition using VISA Serial Read/Write?
The course is slightly price at a cost of around £240(with academic discount) and as far as I understand the courses examples (might) use two HP instruments (Multimeter and Function Generator) and a Tektronix oscilloscope, all of which I am not in direct contact with.
Regards
Alex
Attachments:
Serial Client PIC24-Serial - Read 2-bytes.vi ‏42 KB

Similar Messages

  • OSB proxy mail read problem from inbox

    Hi,
    I have made one osb process.It is reading data from one particular mailbox.For that I have configured one proxy,and mentioned one service account in that proxy configuration.It is working fine in my local server and printing logs(I have put some log activity in message flow).
    But when I deployed it to one cluster env,It is not printing anything in logs.But I think it is reading data from mailbox.I have set post read action to archive and the mails are archived properly in cluster env,so I am assuming that osb proxy is reading mails.
    Anybody has any idea of the above problem?

    Did you check in weblogic console, if you click in your proxy service (the one which consumes from email server) -> Operational settings, is logging enabled?
    In your pipeline, are you logging at the end of the message flow? Do you mind adding a global exception handing and log there as well?
    This is what I can think of. Otherwise, try to use a report action from your proxy, just to see if the issue is the logging or the consumption.
    If none of this work, I would stop of the managed servers, leave only one running. Then you have a couple of options: Enable tracing or run a tcpdump. These 2 will be the source of truth of what is going on.
    Regards,
    Fabio Douek

  • Visa read problem

    Hello!!
    I made a program that reads data from an Arduino microprocessor. Once I realize the exe and connect Arduino, the program starts reading the data, but only for a few minutes ... then it stops and i have to disconnect and reconnect Arduino....any ideas?
    Thanks a lot!

    Hi
    when you disconnect your arduino, do you turn off the power? If yes, it may be a memory issue in your arduino. I've worked once with Arduino, and we had an issue with data stacking over and over in the arduino
    Giuliano Franchetto
    Student at the l'Ecole Nationale Supérieure des Mines de Saint-Etienne, cycle ISMIN (FRANCE)

  • VISA read Problem: After a while the device stop responding

    Hi everyone,
    I am facing a really strange bug that anything that I have done could not solve it. I have a PIC device that I made myself communicating with LabVIEW by a RS232 -> USB converter. Everything seems to be ok, but suddenly (it can last 30, 45 or 50 seconds), LabVIEW stops receiving data and any buttons do not respond anymore, not even the stop button. I have to remove the usb converter to get the buttons to respond again, and then I got the error:
    Other programs that opens this same terminal can communicate with my device for hours without errors. I sure open the session and only close after the while loop. Can anybody help me?
    Solved!
    Go to Solution.

    Hello,
    Same problem for me! It can last 1 hour or 5 hours but at some point the two parts of the program that have a RS-485 to usb stop. This program was working perfectly until I changed the computer. The OS was vista (32 bits) and it is now 7 (64 bits). This is the only thing that has changed.
    I also found that if more parts of the program are running this problem appears earlier. It was definitely not issue before since the program could be running for weeks.
    Thanks for your help.

  • Macbook won't read card from Canon G10 in USB port

    I can't copy Canon G10 RAW files from an SD card via a USB card reader onto an aluminum MacBook. I tried using Adobe Lightroom (the way I usually do this on another machine) to import the files but it couldn't recognize them. I tried to copy the files into a folder on the Desktop but I got a insufficient priveleges message. It seemed to copy the file names but tnot the files. When I tried to remove the card I got a "File is in use and can't be removed" message.
    The card reader and the card work fine on a 24"Intel iMac.
    Another USB card works fine in the card reader on the MacBook, too.
    I'm puzzled.

    Some added info, i CAN boot the bricked machine into Safe mode, but at reboot I get stuck in the same cycle again.
    Oh, and in SafeBoot, the Macbook still tells me that no Airport card is installed, even though I know it does (and it's not knocked loose or anything).....

  • We want to read data from weigh bridge and display in oracle forms & store

    Sir/Madam,
    in our organisation we had one requirement. i.e is reading data from weigh bridge using serial port, displying that data in oracle forms and when ever user click save button we store that into my oracle database. we are using oracle 8i and forms 6i and windows OS environment. we don't know reading data from serial port and placing that into form items. please help me as early as possible if there is any property available in d2k regarding this requirement .
    thank you,
    vishnu

    There's no property in Forms that makes you read serial ports, but as far as I know you need to know the API of the machine which you want to read data from (it should come with machine's manual) and then it will be easy to store it in forms item.
    Tony

  • VISA Read over USB Problem: After a while the xBFFF0015 Timeout Error occurred

    Hi,
    I have trouble using labview with my non-NI USB device:
    The device is an analog input DAQ board. I was able to setup communication with the board using a VISA driver specifically created for this board and direct FW calls using the product's firmware specification provided by the manufacturer.
    This method has been working pretty good so far, but when I try to get large amount of data (64k samples @100ksps), the VISA Read returns the 'VISA: (Hex 0xBFFF0015) Timeout expired before operation completed.' error.
    Please see the attached screenshot of the block diagram for details.
    First, an 'analog input scan start' command is sent to the DAQ device, and then the vi tries to read all collected data from the device, once the right amount of data retrieved, or no more data is available the data collecting process (the while loop) ends and an 'analog input scan stop' command is sent to the DAQ device.
    The data collection starts with no problem, but after a while, in loop# 400, the VISA Read hangs and then returns the error mentioned above.
    I tried to increase the time out value, but it didn't help, the error occurred after the same number of loops, the VISA Read got hosed and the error occurred after the longer timeout expired.
    I also tried to add some delays in the loop, but it didn't help either.
    I am not sure what do I miss here and I would highly appreciate if anyone could give me some guidance how to solve this issue.
    Thanks,
    John
    Attachments:
    usb-read.png ‏18 KB

    I just wanted to specify that this is not an NI board avoiding to make people think this is a hardware issue. And I think that the rest of the code is irrelevant in this case.
    I believe that I don't use the VISA functions correctly. I assumed that someone who used these functions before would be able to point out the obvious steps missing in the data collecting process using the VISA functions.

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

  • VISA Read gets incorrect data from serial connection

    I am having difficulty using the VISA functions in LabVIEW to read data from a virtual COM port. Data is being sent from a serial to USB chip via a USB connection using OpenSDA drivers. I have a python program written to read from this chip as well, and it never has an issue. However, when trying to achieve the same read in LabVIEW I am running into the problem of getting incorrect data in the read buffer using the VISA Read function.
    I have a VISA Configure Serial Port function set up with a control to select the COM port that the device is plugged into. Baud rate is default at 9600. Termination char of my data is a newline, which is also default. Enable termination char is set to true. A VISA Open function follows this configuration, and then feeds the VISA Resource Name Out into a while loop where a VISA Read function displays the data in read buffer. Byte count for the VISA Read is set to 20 so I can read more of the erroneous datat, however actual data will only be 6-12 bytes. The while loop has a wait function, and no matter how much I slow down the readings I still get incorrect data (I have tried 20ms thru 1000ms). 
    The data I expect to receive in the read buffer from VISA Read is in the form of "0-255,0-255,0-255\n", like the following:
    51,93,31\n
    or
    51,193,128\n
    And occasionally I receive this data correctly, however I intermittently (sometimes every couple reads, sometimes a couple times in a row) get incorrect readings like this:
    51,1\n
    51,193739\n
    \n
    51,1933,191\n
    51,,193,196\n
    51,1933,252 
    51,203,116203,186\n
    Where it seems like the read data is truncated, missing characters, or has additional characters. Looking at these values, however, it seems like the read was done incorrectly because the bytes seem partially correct (51 is the first number even in incorrect reads).
    I have search but haven't found a similar issue and I am not sure what to try from here on. Any help is appreciated. Thanks!
    Attachments:
    Serial_Read_debugging.vi ‏13 KB

    The first thing is that none of the error clusters are connected so you could be getting errors that you are not seeing. Are you sure about the comm parameters? Finally, I have never had a lot of luck looking for termination characters. You might want to just capture data and append each read into one long string just to see if you are still seeing this strangeness.
    What sort of device is returning the data? How often does it spit out the data? How much distance is there between it and your computer? Can you configure it append something like a checksum or crc to the data?
    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

  • How to read three parameters for exemple temperatur​e,current and voltage from the same port with visa read and separate them in a table

    Hi i want to read parameters with visa read, from three sensors related to  pic16f877a, using  module xbee ..but i want to make every one from those parameters (temperature, voltage and current) in a table ..it's the first time i use Labview so i don't know if ther is a solution for my problem so if any one have any idea please help me. thnx in advance. 

    [email protected] wrote:
    Hi i want to read parameters with visa read, from three sensors related to  pic16f877a, using  module xbee ..but i want to make every one from those parameters (temperature, voltage and current) in a table ..it's the first time i use Labview so i don't know if ther is a solution for my problem so if any one have any idea please help me. thnx in advance. 
    The short answer is: "Yes, of course."  But you are going to have to do the legwork and learn LabVIEW basics before we can offer meaningful help.
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • Visa Read Overrun Problem

    Dear all,
    I am using VISA Read Function to read data coming from my Hardware.
    The data is coming really fast. The H/W is sending 1600 bytes after every 10ms.
    I am using Event Structure(timeout event) to check whether 1600 bytes are at port or not. Timeout is set to 1ms. i even tried with 0ms.
    Baud Rate = 3000000.
    but the program is giving Buffer Overrun problem when i am trying to read data using VISA Read.
    I have set the buffer size to 64000 but with no success. The problem still seems to persist.
    i have played around with Receive buffer of COM Port in device manager. i tried all the values from 64 to 1600, again with no success.
    every time i run the program i get an error stating,"A character was not read from the H/W before the next char arrived" at VISA Read Function.
    and i am not doing anyother processing other than Reading data from the Port in the timeout event. 
    What could be the problem?
     Thanks,
    Ritesh 

    Ritesh,
    The over-run is still caused by the driver of the hardware.  What you are observing is that the driver is able to keep up with bursts of data coming into the port.  So for the first few thousand bytes coming in, there is no error.  However, after a while, the driver falls behind and cannot keep up (hence the over-run error).
    How does FTDI recommend that you use their ports in LV?  VISA may interact with the driver in a different way or set properties to different values.  All of this can have an impact on how the driver performs.  Also, this DLL that they provided may not return overrun errors the same way that VISA does.  The malformed string may just be missing data that was missed because of an over-run error.
    You have not mentioned anything about the types of flow control that are available to you.  The only real way to prevent over-run errors in data intensive communication is to have ways to hold-off the data (flow control).  Since the data will be interrupted for a fraction of a second, the driver will have a chance to get the data out of the hardware in time.  Communication will automatically resume once the data is read out of the hardware.
    Thanks,
    Steven T.

  • Bytes missing in serial communication UART - NI Visa READ

    hello everyone,
                         I am using NI Visa read to transfer data from microcontroller to laptop using write-to-binary-file.vi... I have observed a very weird phenomenon, in the fact that some bytes appear to be missing from the data-file. this however, does not occur for all laptops... In some laptops, i have never observed a single byte being missed from the data file...
    the OS running on laptop with byte missing is win 7, whereas the laptop running perfectly fine has win xp.
    has anyone ever experienced such issue before? i am using Silicon Labs CP2102 as UART-USB converter over a baudrate of 921600 bps... the data size is normally in GB's... and the no. of bytes missing is purely random and varies from 2bytes to 32 bytes,... the way i determine if a byte is missing or not is by right clicking the file, check properties and compare size on disk and size of file ... they shud be same to ensure no data loss...
    Now on LabVIEW 10.0 on Win7

    Oh.. Created by mistake ,.. How to delete this post ???
    Now on LabVIEW 10.0 on Win7

  • The vi is identifyng the number of bytes to be read but the VISA Read vi is not able to read the data from the port.

    We are trying to communicate with the AT106 balance of Mettler Toledo.The VI is attached.
    We are sending in "SI" which is a standard command that is recoginsed by the balance. The balance reads it.The indicator after the property node indicates that there are 8 bytes available on the serial port. However, the VISA read VI fails to read the bytes at the serial port and gives the following error:
    Error -1073807253 occurred at VISA Read in visa test.vi
    Possible reason(s):
    VISA: (Hex 0xBFFF006B) A framing error occurred during transfer.
    The Vi is atttached.
    Thanks
    Vivek
    Attachments:
    visa_test.vi ‏50 KB

    Hello,
    You should also definitely check the baud rates specified; a framing error often occurs when different baud rates are specified, as the UARTs will be attempting to transmit and receive at different rates, causing the receiving end to either miss bits in a given frame, or sample bits more than once (depending on whether the receiving rate is lower or higher respectively). You should be able to check the baud rate used by your balance in the user manual, and match it in your VI with the baud rate parameter of the VISA Configure Serial Port VI.
    Best Regards,
    JLS
    Best,
    JLS
    Sixclear

  • I am facing problem while reading values from properties file ...i am getting null pointer exception earlier i was using jdeveloper10g now i am using 11g

    i am facing problem while reading values from properties file ...i am getting null pointer exception earlier i was using jdeveloper10g now i am using 11g

    hi TimoHahn,
    i am getting following exception in JDeveloper(11g release 2) Studio Edition Version 11.1.2.4.0 but it works perfectly fine in JDeveloper 10.1.2.1.0
    Root cause of ServletException.
    java.lang.NullPointerException
    at java.util.PropertyResourceBundle.handleGetObject(PropertyResourceBundle.java:136)
    at java.util.ResourceBundle.getObject(ResourceBundle.java:368)
    at java.util.ResourceBundle.getString(ResourceBundle.java:334)
    at org.rbi.cefa.master.actionclass.UserAction.execute(UserAction.java:163)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)

  • How do I stop Serial "VISA Read" from giving me packets instead of available bytes.

    Dear Labvillians,
    Highlight:
    How do I stop serial "VISA read" from giving me packets instead of bytes?
    Background:
    I have a system that serially publishes 14 byte packets on a semi-regular interval.
    At busy times, the producer of these these packets queues the data, effectively producing super-packets in multiples of 14 bytes sometimes as large as 8 packets (112 bytes).
    My protocol handler has been designed to processes bytes, packets or super-packets.
    My application now has multiple devices and the order of message processing is critical to correct functionality.
    My observation is that the VISA read waits until the end of a packet/ super-packet before passing the data to the application code. (See Plot Below)
    My expectation is that VISA read should give me available bytes, and not get too smart for itself and wait for a packet.
    I have observed this on PXI, Embedded PC, cFP and most recently, cRIO
    I have experimented with the cRIO's Scan interface rate, which helps with reducing the packet backlog but doesn't resolve to sub-packet byte read.
    I understand that one solution is to Write FPGA code to handle it and pass the bytes through R/T-FIFO, and there are some great examples on this site.
    Unfortunately this doesn't help with non FPGA devices.
    I have also dabbled in event based serial reads but it is diabolical on vxWorks devices.
    Any Help is appreciated
    iTm - Senior Systems Engineer
    uses: LABVIEW 2012 SP1 x86 on Windows 7 x64. cFP, cRIO, PXI-RT
    Solved!
    Go to Solution.

    Sometimes Talking to yourself is helpful.
    I hope this is a useful Nugget for someone in the future
    iTm - Senior Systems Engineer
    uses: LABVIEW 2012 SP1 x86 on Windows 7 x64. cFP, cRIO, PXI-RT

Maybe you are looking for

  • I am trying to watch a movie on my ipod touch 4th generation but everytime i click it it says "operation could not be completed"

    I am trying to watch the movie Taken but everytime i try and watch it a message pops up that says "the operation could not be completed"

  • Restrict rows

    Hi, this query is working fine when it has one loan, when i enter multiple loans then it shows me in two lines, how will i stop this. can anyone guide me. select emp_number, emp_name, car_loan, medical_loan, personal_loan, family_visa_bal, personal_t

  • Free collection of all SAP material link

    Hi all, I notice that so many people are getting difficulty in finding SAP materials. That is why I would like to share you these 2 links. I found that the owners of the sites are very kind and generous. Please respect their wishes by using the free

  • Sending data to excel

    What is the best way to send Time vs Temp data from a thermocouple measurement to excel?  I have included my set-up if that will help.  Thanks in advance for your help and advice. Kenny Attachments: Final-Thermocouple2.vi ‏87 KB

  • Check Infocube Basic or Transactional

    Hi all, I want to check if an Infocube is basic or transactional with Function Module; I've tested the return of FM RSD_CUBE_GET_ONLY_DB but in the field l_s_cube-cubetype always "B".... I've analyzed the FM: RSAPO_CLOSE_TRANS_REQUEST; RSAPO_SWITCH_T