how to programm AnalogtoDigitalConverter
Use the statement
variableName = analogRead(0) ; // will read the analogue input pin zero
and to get a digital signal on output?
the to output the logic level in a variable called fred to the digital pin 5 use:-
digitalWrite(5, fred) ;
There are also I2C devices, connect them to A4 & A5 in place of RB7 and RB6.
However, I suspect your main problem is that you don't understand what the PIC is doing either.