Thread: PORTB Help
View Single Post
  #3   Spotlight this post!  
Unread 28-01-2008, 23:00
wt200999's Avatar
wt200999 wt200999 is offline
Texas Instruments
AKA: Will Toth
FRC #3005 (Robochargers)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2004
Location: Dallas, Texas
Posts: 323
wt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud of
Send a message via MSN to wt200999
Re: PORTB Help

PORTB is a register value for each of (1-7)? digital_io. It says what each bit is in the datasheet, I would suggest taking a look at that.

basically

Code:
Port_B_Delta = Port_B ^ Old_Port_B; // determine which bits have changed
that line uses the XOR to compare the new value to the old one. so if you have 10010101 as your old one and 10000101 as your new one the "Port_B_Delta" will be 00010000 which is also = 0x10 in hex and = 16 in our regular number system.

which is where this comes into play:
Code:
if(Port_B_Delta & 0x10) // did external interrupt 3 change state?
{
or something like that...
__________________
Programming in LabVIEW? Try VI Snippets!

FIRST LEGO League 2004 - 2005
FRC Team 870 Student 2006 - 2009
FRC Team 3005 Mentor 2013 -