Hello Guest it is April 29, 2024, 10:23:31 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Alpaca

Pages: 1
1
PoKeys / Re: PoKeys56U Digital Output->Latency Too High! ANSWER
« on: March 30, 2013, 12:44:33 AM »
 8) ANSWER  8)

I have contacted PoLabs/PoScope and they told me the following information:

Quote
PoKeys56U uses standard HID interface and thus relies on system's drivers for communication. Due to USB specifications, communication is limited to approximately 4-5 ms per one data transfer.
...
In addition - you may have noticed that with the newer firmware updates, Windows asks for a driver for PoKeys - we are working on a faster communication interface that should be available in April. That will allow 1 ms command execution.

As I previously stated, I was able to input new commands for a single bit every 2 ms which is slightly better than what PoKeys told me to expect, which is good. Can't wait for the newer driver.

Thanks PoKeys for the quick and accurate response and the support! ;D

2
PoKeys / Re: PoKeys56U Digital Output->Latency Too High!
« on: March 27, 2013, 02:37:21 AM »
Note that this operator preforms even worse:

device.BlockSetOutput1

(not much worse, but still worse)

3
PoKeys / PoKeys56U Digital Output->Latency Too High!
« on: March 26, 2013, 03:16:10 AM »
 :)
I have been using PoKey's Visual C# example to manually control digital outputs.
The problem is that the latency is about 2ms per bit out!
Since I am controlling 2 stepper motors, I am using 8 digital outputs (each are 1 bit).
This means that sending each 8 bit output takes 16ms!
I need to be able to change all 8 bits in under 1ms if possible.
By latency I mean the time it takes to execute a "set output" command and then start the next command.

I am controlling each bit individually with the function PoKeysDevice_DLL.SetOutput(byte pinID, bool outputState);
Is there a faster function? What about a function that can set more than one pin at a time? ???



My entire C# solution is attached, ready to run in Visual C# if you want to help me out ;)

Here is the example file I based my code on:
http://www.poscope.com/uploads/files/PoKeysExamples.zip<C#/Example2_BasicPinFunctions>

Here is my main function&file used to measure latency: (note that it takes me 9 seconds to run the while loop 500 times)
Code: [Select]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;


namespace Example2_BasicPinFunctions
{
    class Program
    {

        public enum pinFunctionsEnum
        {
            pinFunctionInactive = 0,
            pinFunctionDigitalInput = 2,
            pinFunctionDigitalOutput = 4,
            pinFunctionAnalogInput = 8,
            pinFunctionAnalogOutput = 16,
            pinInvert = 128
        }

        static void Main(string[] args)
        {           
            // Create PoKeys55 device object
            PoKeysDevice_DLL.PoKeysDevice device = new PoKeysDevice_DLL.PoKeysDevice();
            // Enumerate devices (this step must never be ommited!)
            int iNumDevices = device.EnumerateDevices();
            if (iNumDevices == 0)
            {
                Console.WriteLine("No PoKeys55 devices found!");
                Console.WriteLine("\nPress any key to exit");
                Console.ReadKey();
                return;
            }
            // Connect to first PoKeys55 device
            device.ConnectToDevice(0);

            int i;
            // Set pins as digital output
            for (i = 2; i <= 9; i++)
            {
                device.SetPinData((byte)(i - 1), (byte)(pinFunctionsEnum.pinFunctionDigitalOutput));
            }
            Console.WriteLine("Pins 2-9 set as digital output");


            bool flop = false;
            int j = 0;






////////////////////////////////////////////////////////////////IMPORTANT PART OF THE CODE
            while (true)
            {
                for (i = 2; i <= 9; i++)
                {
                    device.SetOutput((byte)(i - 1), flop); //is there a faster function that this one?
                }
                flop = !flop; //flop alternates true, false, true, false,...
                j++;
                if (j%500==0) {
                    Console.WriteLine("500 more done"); //prints every time the output changes 500 times (9 seconds)
                }
            }
////////////////////////////////////////////////////////////////END IMPORTANT PART OF THE CODE





            // Disconnect from device
            device.DisconnectDevice();


            Console.WriteLine("\nEnd.\nPress any key to exit");
            Console.ReadKey();

        }
    }
}

Pages: 1