View Single Post
  #6   Spotlight this post!  
Unread 04-03-2011, 08:49
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,101
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Individual Control of Each Spike output ?

Quote:
Originally Posted by de_ View Post
Here's an example of what we want to do with one spike.

On one line have an (12v) Red LED connected and be able to turn it on and off without effecting the state of what is on the other line of the spike. On the other line, we want to have a white 12v led that we flash in software, again, not effecting the Red LED.

I guess I really should have posted this in programming.
The two processes will have to cooperate to achieve what you want.

Let the 4 possible states of the Spike be:

1) both LEDs OFF
2) White LED OFF, Red LED ON
3) White LED ON, Red LED OFF
4) both LEDs ON

Then, to flash the Red LED on/off while the White one is OFF, you would alternate between states 1 & 2.

But to flash the Red LED on/off while the White one is ON, you would alternate between states 3 & 4.

So the process which flashes the Red LED cannot act independently from the process which flashes the White LED, and vice-versa. The processes must share information.

One way to do this would be to have each process just set a boolean flag to indicate whether its LED should be ON or OFF, and let a third process set the proper state of the Spike each time either of these booleans changes. Rather than having the third process chew up resources polling, you could use some sort of messaging supporting by the vxworks OS.