|
Re: Problems reading io pins as a group
Quote:
|
Originally Posted by deltacoder1020
worse case scenario, you could always just do this:
Code:
portAvalue = (rc_dig_in01 << 3) & (rc_dig_in02 << 2) & (rc_dig_in03 << 1) & rc_dig_in04;
|
Shouldn't it be
Code:
portAvalue = (rc_dig_in01 << 3) + (rc_dig_in02 << 2) + (rc_dig_in03 << 1) + rc_dig_in04;
[EDIT]
actually it should be
Code:
portAvalue = (rc_dig_in04 << 3) + (rc_dig_in03 << 2) + (rc_dig_in02 << 1) + rc_dig_in01;
since rc_dig_in01 is in bit0 (least significant) of PORTA
[/EDIT]
__________________
Electrical & Programming Mentor ---Team #365 "The Miracle Workerz"
Programming Mentor ---Team #4342 "Demon Robotics"
Founding Mentor --- Team #1495 Avon Grove High School
2007 CMP Chairman's Award - Thanks to all MOE members (and others) past and present who made it a reality.
 Robot Inspector
"I don't think I'm ever more ''aware'' than I am right after I burn my thumb with a soldering iron"
Last edited by The Lucas : 11-02-2004 at 14:50.
|