Thread: RELAY!!
View Single Post
  #14   Spotlight this post!  
Unread 05-11-2010, 12:44
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: RELAY!!

Quote:
Originally Posted by Dave Scheck View Post
Specifically, it's these two lines
Code:
ArmRelease = new Relay(1);
Zone1 = new DigitalInput(1);
These both allocate Resources using the default slot with channel 1.
That's not correct Dave. The digital modules have 4 distinct resource types... PWM channels, Relay Channels, an I2C bus, and Digital I/O channels. Because they are separate resources, you will not get conflicts from using the same channel "number" in a different set of channels. This is best illustrated by looking at the digital sidecar itself and witnessing different pins for each of those channel types.

Quote:
Originally Posted by Dave Scheck View Post
To fix this, you need to use the other constructor for these objects and specifically call out the slot number. I forget what the slot numbers are, but I found this in our 2009 code.

Code:
ap_rlyElevatorR  = new Relay(1);
ap_elevatorLimitRightTop = new DigitalInput(4, 1);
This has no effect. The default digital module is 4, so explicitly specifying 4 is not any different than not specifying it. In either case, you are allocating the same channel. The reason this works is because the relay channels are separate from the digital I/O channels.
Reply With Quote