Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 28th April 2008, 10:56 AM   (permalink)
Post there is aproblem

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

Last edited by MedoLee; 28th April 2008 at 11:11 AM.
MedoLee is offline   Reply With Quote
Old 28th April 2008, 10:58 AM   (permalink)
Default

Did you downloaded the data sheet?It has all the stuff regarding to that micro controller.
Attached Images
File Type: gif PIC16F877A.gif (6.1 KB, 10 views)
__________________
Gayan

My Website
http://gsmicro.blogspot.com/

Last edited by Gayan Soyza; 28th April 2008 at 11:01 AM.
Gayan Soyza is offline   Reply With Quote
Old 28th April 2008, 11:09 AM   (permalink)
Default

[quote=MedoLee]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
MedoLee is offline   Reply With Quote
Old 28th April 2008, 11:09 AM   (permalink)
Default

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 by MrNobody; 28th April 2008 at 11:13 AM.
MrNobody is offline   Reply With Quote
Old 28th April 2008, 11:21 AM   (permalink)
Default

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 is offline   Reply With Quote
Old 28th April 2008, 11:24 AM   (permalink)
Default

Quote:
Originally Posted by MedoLee
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.?
__________________
Eric
"Good enough is Perfect"

PIC tutorials:
Gramo's: www.digital-diy.net/
Bill's: www.blueroomelectronics.com/
ericgibbs is online now   Reply With Quote
Old 28th April 2008, 11:37 AM   (permalink)
Default

the problem is how can i dieal with this input port and assign the value of input port
MedoLee is offline   Reply With Quote
Old 28th April 2008, 11:45 AM   (permalink)
Default

Quote:
Originally Posted by MedoLee
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:
http://www.winpicprog.co.uk/
__________________
Eric
"Good enough is Perfect"

PIC tutorials:
Gramo's: www.digital-diy.net/
Bill's: www.blueroomelectronics.com/
ericgibbs is online now   Reply With Quote
Old 29th April 2008, 06:00 AM   (permalink)
Default

Pulling my hair out in chunks!!
donniedj is offline   Reply With Quote
Old 29th April 2008, 08:48 AM   (permalink)
Default

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..
MrNobody is offline   Reply With Quote
Old 29th April 2008, 09:13 AM   (permalink)
Default

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.
__________________
Eric
"Good enough is Perfect"

PIC tutorials:
Gramo's: www.digital-diy.net/
Bill's: www.blueroomelectronics.com/
ericgibbs is online now   Reply With Quote
Old 29th April 2008, 09:20 AM   (permalink)
Default

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 is offline   Reply With Quote
Old 29th April 2008, 11:24 AM   (permalink)
Default

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 Nigel's Tutorials if you want to know more about it.
MrNobody is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes




All times are GMT. The time now is 07:04 PM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.