Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PORTA of 16F877

Status
Not open for further replies.

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!.
 
Status
Not open for further replies.

Latest threads

Back
Top