I read the data sheet... but , to be sure : have you some sample to help in setting the register please ?
The datasheet says: The ANSEL (9Fh) and CMCON (19h) registers (9Fh) must be initialized to configure an analog channel as a digital input.
So lets start with ANSEL (page 44 in the datasheet)where the lower four bits determines if AN0-AN3 should be analog (which they are by default) or digital. These bits needs to zero for the pins to be digital and since you're not using the ADC the state of the other bits doesn't matter, therefor ANSEL = 0 will do just fine.
Next. CMCON, figure 6-2 (page 37) in the datasheet shows the various configurations, you don't want to use the comparator so it should be off, therefor CMCON = 7
Finally you say that you need three inputs and three outputs but not which pins should be what so I can't tell you more than that you need to set TRISIO up with a '1' for each input and a '0' for each output. Remember that the MCLR-pin (GP3) can not be configured as an output.
Code:
ANSEL = 0
CMCON = 7
TRISIO = %00111000 ' GP0-GP2 outputs, GP3-GP5 inputs.
/Henrik.
Bookmarks