Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

making PORTD as Input/Output PORT.....

Status
Not open for further replies.

jhon caty

Newbie level 3
Joined
May 14, 2012
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,304
i am working with PIC18f4550 and using MPLAB C18. I am facing problem in making PORTD as I/O port. plz guide me. THANKS......
 

If you want PORTD to be input port then the code is
Code:
 TRISD = 0xFF;
. If you want PORTD to be output port then the code is
Code:
 TRISD = 0x00;
 

i want to initialize some pins of portD as input as some as output .
 

If you want to intialize RD0, RD1, RD2, RD3 as input and RD4, RD5, RD6, RD7 as output then you do like this

Code:
 TRISD = 0b00001111;
0b tells we are using binary format. 0000 makes RD4-RD7 output. 1111 makes RD0-RD3 as input.

Whichever pin you want as output, you set it 0 and whichever pin you want as input you set it 1.
 
hi jhon caty,
if you use pin as i/p place as '1' , its o/p its place as '0'.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top