Jump to content

*Uncertified*

Post code here that is not ready for certification. Once it is ready for certification please notify the moderators. It will then be moved to the proper category.

78 files

  1. Bluetooth Connect and Event Monitoring

    This VI can Discover, Pair, or Remove Bluetooth Device.  Can Connect or Disconnect (no data socket enabled yet),  Can establish a Comm Port, Open the Comm Port, Close A Comm port.
     
     
    Has the machinery but needs debugging for the Windows bluetooth Event Monitoring.  Any help would be VERY VERY WELCOME.
    I'm uploading this because I really wish somebody else had uploaded the necessary code for bluetooth pairing, but at the moment wish somebody else had uploaded code for monitoring bluetooth events (connect or disconnect events)

    389 downloads

    Submitted

  2. ShapeLib

    This is a package containing LabVIEW bindings to the library ShapeLib for working with shapefiles.

    The DLL as of version 1.3.0 is included in the package. This DLL is compiled with Microsoft Visual Studio 2010 Express, so you need the corresponding runtime. But chances are you already have it because other programs on your computer need it, too. So just give it a try.
     
    The library is thread safe, but the objects are not. E.g. you can open two different files in different threads, but you can not operate on the same file from two different threads at the same time.
     
    As of the moment the DLL is 32bit only.

    204 downloads

    Submitted

  3. Triple buffer

    (initial discussion, with other implementations here)
     
    In the need for displaying large images at a high performance, I wanted to use triple buffering in my program. This type of acquisition allows to acquire large data in buffers, and have it used without copying images back and forth between producer and consumer.
     
    This way consumer thread doesn't wait if a buffer is ready, and producer works at max speed because it never waits or copy any data.
    If the consumer makes the request when a buffer is ready, it is atomically turned into a "lock" state. If a buffer isn't ready, it waits for it, atomically lock it when it is ready.
     
    This class allows to have a producer loop running at its own rate, independently from the consumer. It is useful in the case of a fast producer faster than the consumer, where the consumer doesn't need to process all the data (like a display).
     
    How to use

    Buffers are provided at initialization, through refnums. They can be DVRs, or IMAQ refnums, or any pointer to some memory area.
    Once initialized, consumer gets the refnums with "get latest or wait". The refnum given is locked and guaranteed to stay uncorrupted from the producer loop. If new data has been produced between two consumer calls, the call doesn't wait for new data, and returns the latest one. If not, it waits for the next data.
    At each producer iteration, producer starts with a "reserve data", which returns the refnum in which to fill. Once data is ready, it calls "reserved data is ready". These two calls never wait, so producer is always running at a fastest pace.

    Implementation details

    A condition variable is shared between producer and consumer. This variable is a cluster holding indexes "locked", "grabbing", and "ready". The condition variable has a mechanism that allows to acquire mutex access to the cluster, and atomically release it and wait. When the variable is signaled by the producer, the mutex is re-acquired by the consumer. This guarantees that the consumer that the variable isn't accessed by producer between end of consumer wait and lock by consumer.

    Reference for CV implementation: "Implementing Condition Variables with Semaphores ", Andrew D. Birrell, Microsoft Research

    216 downloads

    Updated


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.