Using I/0'S
TCAV
Posts: 4
Hello,
Having problems using I/O's on a Netlinx Controller. What I want to accomplish is sense a logic low or high (doesn't matter) and then turn on a relay on the controller. I've tried to figure this out on my own... but so far no luck! If this has been discussed previously I apologize but when I searched I couldn't find what I was looking for. Any help would be greatly appreciated. Thanks in advance for your replies.
Having problems using I/O's on a Netlinx Controller. What I want to accomplish is sense a logic low or high (doesn't matter) and then turn on a relay on the controller. I've tried to figure this out on my own... but so far no luck! If this has been discussed previously I apologize but when I searched I couldn't find what I was looking for. Any help would be greatly appreciated. Thanks in advance for your replies.
0
Comments
Listening for the IO to flick between its two states is done in a channel event. Assuming that you've defined your IO device as 'dvIO' you would listen for the first IO changing like so:
Now for setting the state of the relay this is done like so: or Again, assuming dvRelay has been previously defined.
Now combining the two you would get something like this:
Check out the NetLinx Keywords Help from within the help menu of NetLinx Studio for some more info.
I ended up getting it to work in a Button_Event...
i.e.
Button_Event[dvIO, ioInputs]
{
PUSH:
{
DebugMsg("'_Event[dvIO, ioInputs] PUSH: ', itoa(Button.Input.Channel)");
HandlePodiumIO(Button.Input.Channel, True);
TPWake(dvTPMenu);
TPGotoPage(dvTPMenu, SCR_MAIN);
TPPopupKillAll(dvTPMenu);
TPPopupShow(dvTPMenu, SCR_MENU_1);
}
RELEASE:
{
DebugMsg("'_Event[dvIO, ioInputs] RELEASE: ', itoa(Button.Input.Channel)");
HandlePodiumIO(Button.Input.Channel, False);
}
}
Thanks Phreak it worked great... I also got it to work using a button event. The reason I was having so much trouble getting it to work was because I mistakenly assigned I0 as 5001:1:9 on a NI-2000 Controller...Duh!
Thanks for your reply ericmedley, no it was purely a programming issue that I was having.
Thanks for the info and your reply... what is the advantage of using a channel event vs a button event in this situation?