|
Problems reading io pins as a group
I'm trying to read a group of 4 io pins to get a numerical value as the status of an outboard device. I'm trying it out using the edubot controller so I'm looking at io pins 1-4 which translates to PortA bits 0-3. I was trying to do the following:
sensor_value = (PORTA & 0x0f);
iIt compiles ok, but the result is always 0. I double-checked that I have set the pins to INPUT, and have set the number of analog channels to NO_ANALOG. sensor_value is an unsigned char.
I also tried reading the pins individually as rc_dit_in01 through rc_dig_in04 and got the proper values, so I know the hardware is ok. Anyone know what gives here? Any help would be appreciated.
On another note, I often have problems getting the edubot to take to a program upload. Sometimes it takes 2 or 3 tries before it will run. And it won't hold through a power-down. Do I just have a bad machine? this is true for a fresh load of the Default Code as well as my own, and the same behavior with both versions of the IFI Loader.
|