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.

there is aproblem

Status
Not open for further replies.

MedoLee

New Member
hi every one , i have problem with 16f877a microcontroller , the problem is how to deteminig the input and output ports


i need some helps please :eek:
 
Last edited:
Did you downloaded the data sheet?It has all the stuff regarding to that micro controller.
 

Attachments

  • PIC16F877A.gif
    PIC16F877A.gif
    6.1 KB · Views: 183
Last edited:
MedoLee said:
hi every one , i have problem with 16f877a microcontroller , the problem is how to deteminig the input and output ports


thak you very much Gayan Soyza but my problem is how can dieal with these input and out out ports

MedoLee
 
Inputs and outputs port are those that begins with RA, RB, RC, RD and RE which is 33 pins all together.

You set the port input or output by setting the respective TRIS register, eg, TRISA, TRISB, TRISC, TRISD and TRISE. 1 for input and 0 for output..

Download the datasheet if u want to know more..
 
Last edited:
thanx alot
MrNobody but my problem is :
if you choose Port d as input in my programm is definded as
(PORTD.??) dot what
and thax alot again
 
MedoLee said:
thanx alot
MrNobody but my problem is :
if you choose Port d as input in my programm is definded as
(PORTD.??) dot what
and thax alot again

hi,
If I understand you correctly, are you asking HOW to configure the PIC ports as either INPUTS or OUTPUTS, when writing the program.?
 
MedoLee said:
the problem is how can i dieal with this input port and assign the value of input port

Hi,
Look at Nigels tutorials, they will explain.

This link:
 
Hey, why don't you tell us what you are trying to do..? I mean, what you are trying to achieve as in, the end result.. Are you trying to use a switch or something.. Tell us clearly and also include information like which pin you are using, and which pin is connected to what etc, coz we are struggling to understand what u mean..
 
hi Mr N,
I think the problem is, that English is not his first language.
It must be difficult asking technical questions in a 'foreign' language.

Reading between the lines, I think he is asking how to configure the Port pins as I/O.
Nigels tutorials give examples on how to do just that.:)
 
hi my friend my code is to recieve asignal from PORTD pin 1 (as input)and blinking a led in PORTB pin1 as output

for example



void main()
{
PORTB=0;
TRISB=0;//as output
TRISD=1;//as input
while(1)
{
if (PORTD.f1=1)
PORTB.f7=1 ;
else
PORTB.f7=0;



}
}
 
MedoLee:
Refer here, I have already answered ur question there.
Anyway, you wanted to use RD1 as input but you are setting RD0 as input instead.

You wrote:
TRISD = 1 --> TRISD = 0b00000001 --> Port D pin 0 as input but the rest as output

Instead, you should use
TRISD = 2 --> TRISD = 0b00000010 --> Port D pin 1 as input but the rest is output

As what Eric has said, go to if you want to know more about it.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top