For some reason the EDU controller is interpretting signals on the first and second digital inputs as 0 and no signal as 1. Am I missing something or is this not correct? I use PrintByte() to print the value of each and the beacons/sensors are functioning perfectly. What could be causing this?
Well the IR sensor (Spec Sheet), will output a logic high (+5v) when it does not see a signal, and a logic low (0v) when it does see a signal. This appears to be what you are seeing.
Thanks, so it would seem that they were working after all.
Those are the best kinds of problems.
This illustration shows what the sensor output should look like.
-Kevin
Actually I don’t think it has anything to do with the sensor output. When I manually connect the pins it reads as 0 and when they are not connected it reads as 0.
is it possible you redefined the port in your code somewhere to make the pin an output instead of an input?
is it possible you connected something to the pin that you shouldnt have, like 12V, and blew out the input circuit for that pin?
I would look up how to connect a simple switch to the port (in the RC reference manual) and try reading the port that way - you cant get any simpler than a switch - if the pin is blown out, and you dont need to use all your input pins, then use another one.
Anything is possible, but not likely. I’ve triple checked the code to make sure they are inputs. What I said is true for EVERY pin on the EDU controller. I tried the switch method with the same result.
Any ideas? Am I missing something?
Yep, you should get 1 when the signal pin is disconnected and 0 when a switch connects it to ground.
How are you displaying the value? Are you typecasting (int) the char value?
e.g.,
printf("rc_dig_in1 = %d
", **(int) ** rc_dig_in1);
Just to verify your User_Initialization() should have:
IO1 = IO2 = INPUT;
.
.
.
/* SECOND: Configure the number of analog channels. */
Set_Number_of_Analog_Channels(**NO_ANALOG**); /* See ifi_aliases.h */
Ok, that is what we are getting. 1 when disconnected and 0 when connected.