Odd Problem With Old EDU Bot

I’m having a really strange problem with the old EDU controller (I think two years ago – the first one to use a PIC processor and it needed an external RC controller). I’ve pulled it out to use on an un-related project, but the digital inputs don’t seem to be working.
I’ve initialized them properly:
IO1 = IO2 … IO8 = INPUT;
I’ve turned off analog:
I’ve set the rest of the pins to output:
IO9 = IO10 … IO16 = OUTPUT;
rc_dig_out09 … rc_dig_out16 = 0;

Then when I check the values of the pins:
printf("rc_dig_in01: %d … rc_dig_in08: %d
", rc_dig_in01 … rc_dig_in08);
I get:
257 257 257 257 0 0 0 0

Things get stranger. If I ground input 1, the output becomes:
1 257 257 257 0 0 0 0

And grounding other pins change random values (pin 4 changes value 2 from 257 to 256, etc).

I’ve figured out the pattern:
Grounding input 1 will cause the value of input 1 to be 1
Grounding input 2 will cause the value of input 1 to be 256
Grounding input 3 will cause the value of input 2 to be 1
Grounding input 4 will cause the value of input 2 to be 256
And so on…
If 16 is set as an input, it will cause the value of 8 to change from 1 to 0
Every input after 8 (9 and up) are 0 and I can’t get 'em to change.

It dosen’t seem to make any difference if I define none of the inputs as analog or all the inputs as analog (NO_ANALOG or EIGHT_ANALOG).

I’m using the default code from http://www.ifirobotics.com/edu-rc.shtml with the most recent firmware.

I have tried simple modifications to the default code (just printf("%d
",rc_dig_in06); (where in06 defaults to an input) and similarly strange results have occurred.

Any advice would be greatly appreciated!

The %d format specifier wants to see an integer. The rc_dig_in## values are being passed to printf as chars. What you’re seeing is the eight char values being printed as four int values.

To fix it, cast the switch values as ints.

rintf("rc_dig_in01: %d ... rc_dig_in08: %d
", (int)rc_dig_in01 ... (int)rc_dig_in08);

Ah, of course! How could I forget. Actually, I suppose I forgot because I haven’t programmed one of these things in years and my brain isn’t at it’s peak mental capacity at 1 am. Anyway, thanks for the help.