View Single Post
  #1   Spotlight this post!  
Unread 21-02-2014, 10:03
Tem1514 Mentor's Avatar
Tem1514 Mentor Tem1514 Mentor is offline
Registered User
FRC #1514
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2010
Location: Toronto
Posts: 238
Tem1514 Mentor is a splendid one to beholdTem1514 Mentor is a splendid one to beholdTem1514 Mentor is a splendid one to beholdTem1514 Mentor is a splendid one to beholdTem1514 Mentor is a splendid one to beholdTem1514 Mentor is a splendid one to beholdTem1514 Mentor is a splendid one to beholdTem1514 Mentor is a splendid one to behold
BCD switch programming

I am looking for a little insight on how to program a number of different autonomous functions by using a BCD (binary coded decimal) switch that will provide 0-9 out to the digital sidecar.

Let us assume that the BCD switch is wired to bits 5 thru 8 on the side car with bit 5 as LSB and 8 as MSB.

My question(s) are when using C++;
1) how do you mask out only the BCD to have a “more useful number”?
2) To select any one autonomous mode would you use ‘IF’s’ or ‘Case’ statements?

It would be real nice to see some sample code for this as I’m sure it go a long way for other teams as well.

Even better would be examples using C++, Java and Labview.

I sure hope that Alan will jump in on this one