View Single Post
  #5   Spotlight this post!  
Unread 27-02-2011, 23:50
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Custom data gathering class crashes user program

This looks awefully complex for getting the value of a few digital input bits. We have a BCD switch that is connected to the digital input channels 11, 12, 13 and 14. We have one statement to get all the digtal input bits and a macro to massage the bits to the right value.
Code:
#define BCDSwitchValue(x)       (((~(x)) >> 2) & 0x0f)
UINT32 startingPosition = BCDSwitchValue(m_digitalIn->GetDIO());
__________________
Reply With Quote