usb project (15 th august) ian coulter. last week needed to work error flags and error counting into...

9
USB Project (15 th August) Ian Coulter

Upload: nora-goodwin

Post on 04-Jan-2016

213 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 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

USB Project (15th August)

Ian Coulter

Page 2: 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

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

Page 3: 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

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

Page 4: 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

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

Page 5: 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

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

Page 6: 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

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

Page 7: 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

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.

Page 8: 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

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

Page 9: 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

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!