PORTA of 16F877

antoni1

New Member
hi
im using RA0,RA1 for bump detection, R2 for Infrared detect and RA3 & RA4 for sound detection. My inputs are all digital inputs i'm not using A/D.

I have set
OPTION_REG = 0xff;
ADCON1=0x06; //SET RA0,1,2,3,4,5 as digital inputs//
STATUS = 0x3f; // bank 1 //

TRISA = 0x07;
STATUS = 0x1f; // bank 0 //

and my robot responds to the inputs
but when i set TRISA=0x40; //111111 set RA0,1,2,3,4,5 as input//
my robot is not responding to the inputs!!!!!!!!!!!!!!
any ideas what's GOING ON WITH TRISA?
 
antoni1 said:
but when i set TRISA=0x40; //111111 set RA0,1,2,3,4,5 as input//
my robot is not responding to the inputs!!!!!!!!!!!!!!
any ideas what's GOING ON WITH TRISA?

That could be because you're not setting the pins as inputs?.

TRISA=0x40 is setting RA6 as an input, and the rest as outputs!.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…