USB Project (15 th August) Ian Coulter
Last Week Needed to work error flags and error counting into labview. This seems to work successfully but doesn’t work for continuous DAQ mode as we still can’t stop it Created several different DLL projects as it was annoying having to change between the various different types
Problem The FIFO fills up quickly for anything faster than one channel averaging over two samples on continuous mode as it reads data out faster than we can read it When the FIFO is full, we lose large chunks of data
Problem This is due to the code –taking in all the data –manipulating the data to a readible form –writing it to file then looping round again The manipulation and writing to file takes a long time during which the FIFO overflows
Solution There are two possible ways to solve this: –Introduce multi-threading so the program reads the data from the USB at the same time as it writes it to file –Strip down the manipulation of the data before it is written to file
Multi-threading Split the code so it goes to two threads: –The sender thread takes in the data and sends it to a circular buffer –The receiver thread reads the data from this buffer and sends it to a file Can’t seem to find a way to do this without using the buffer which slows it down
Multi-Threading Even with the binary file writing this process is still slow due to the writing to a buffer necessary to transfer data between the threads The fastest I could get this to work was one channel averaging over four samples. This is half as good as before.
Binary Removed all data manipulation so that the data is written straight to file We can use another C code or Labview to read the raw data from this data file and combine the bytes to give out meaningful data into another text file
Binary This works really well! Can now read much much faster. Can read up to four channels at full speed without data loss or the FIFO filling up The maximum possible speed is seven channels at full speed so this is good!