Simultaneous setting of multiple outputs

Supporting Visual Studio on Windows
wjousts

Simultaneous setting of multiple outputs

Postby wjousts » Fri Jan 21, 2011 3:31 pm

I have an 8/8/8 board where I am using the 8 digital outputs to connect to another device that will interpret the pattern on the 8 lines as a binary number. From looking at the API, it looks like it is only possible to set each of the 8 channels one by one. My concern here is that depending on the exact speed, setting a binary value of, say 255, which will require turning on all 8 lines, will give be spurious readings on my other device because I have to turn on line 1, then line 2, then line 3, etc. potentially leading to spurious values of 1,3,7,15, etc.
Is there a way to set all 8 channels in a single command?

Cerwell
Phidgeteer!
Posts: 58
Joined: Wed Nov 26, 2008 3:52 pm
Location: Norway (East)

Re: Simultaneous setting of multiple outputs

Postby Cerwell » Sat Feb 12, 2011 3:31 pm

Out of curiosity:
Have you worked any more on your subject? Any transfers?
Tried measuring timespan between output activations?

Guessing:
As far as I know there is no way of actually setting multiple outputstates simultaneously.

Thinking:
If it was such a command, it would say all(8) on, witch would force the cpu (or whoever does the job) to walk trough each output and setting its state.
Much like it does if you run it trough normal code.

User avatar
Patrick
Lead Developer
Posts: 3158
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Simultaneous setting of multiple outputs

Postby Patrick » Mon Feb 14, 2011 9:48 am

The 8/8/8 sets all outputs simultaneously - however, when you send an output command, this gets sent to the board right away, so changing multiple outputs simultaneously is tricky - you need to set a single output, and then immediately set the output you want to set - these will be queued up and sent in a single packet once the first set has finished.

-Patrick

wjousts

Re: Simultaneous setting of multiple outputs

Postby wjousts » Tue Feb 22, 2011 9:21 am

Thanks Patrick. Not sure I quite follow what you are suggesting. I think you're saying that in the time it takes the board to respond to setting one output, I could set a bunch of other outputs and they will queue up and all be sent at once when the first command has been set. Not sure if that's something that I'm comfortable with relying on. I'd need to be sure that I could set all my other outputs in the time it takes the first command to be processed. Also, if I'm using all eight digital outputs, setting one first will still cause the problem with spurious values. Unless setting an output to false, when it is already false, will cause a round trip to the board, but I assume the drivers are smart enough not to bother sending data to the board in that case (i.e. it won't send anything unless you are actually changing the state).
Ultimately, for my particular application, I'm using two 0/16/16 boards as well and I'm only using 15 (each) of the digital outputs from those boards. So I'm going to use one of the spare outputs as a master control switch, hooking up the common ground for the 8/8/8 board through it. That way I can set the outputs on the 8/8/8 board and nothing will get sent down the line until I set the one output on the 0/16/16 board. Works a treat, but only because I happen to have a couple of spare outputs to work with.

User avatar
Patrick
Lead Developer
Posts: 3158
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Simultaneous setting of multiple outputs

Postby Patrick » Tue Feb 22, 2011 11:04 am

It's true that this is not a very good solution. The problem it that the API was not designed for setting multiple outputs at once, and we can't change the API. We can, however, add to the API, and since we definitely have control over this sort of thing from the PC side, this may be something to look at.

-Patrick

kviper97

Re: Simultaneous setting of multiple outputs

Postby kviper97 » Mon Sep 19, 2011 10:40 am

I'd definitely be interested in setting simulataneous outputs. I use a 0/16/16 for controlling Christmas lights. I was using the parallel port, but switched to a phidget 2 years ago. I've been fighting a strange issue where my latch IC's would be inconsistent. Being able to assign all the outputs from a single call would be excellent.

I was just looking at possibly creating an output collection, setting those, and then setting the IFKit outputs to the created collection hoping it would basically assign them all at the same time. I haven't had much time working on it since I just started, but I haven't been successful on it yet.


Return to “C#.NET”

Who is online

Users browsing this forum: No registered users and 1 guest