Sep 11, 2012 #1 J 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......
i am working with PIC18f4550 and using MPLAB C18. I am facing problem in making PORTD as I/O port. plz guide me. THANKS......
Sep 11, 2012 #2 M madhusuthanan Full Member level 3 Joined Jan 3, 2012 Messages 188 Helped 8 Reputation 16 Reaction score 8 Trophy points 1,298 Location madurai Activity points 1,963 you going to use port d as i/p or o/p.
Sep 11, 2012 #3 I internetuser2k12 Banned Joined Jul 25, 2012 Messages 1,192 Helped 171 Reputation 342 Reaction score 162 Trophy points 1,343 Activity points 0 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;
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;
Sep 12, 2012 #4 J 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 want to initialize some pins of portD as input as some as output .
Sep 12, 2012 #5 I internetuser2k12 Banned Joined Jul 25, 2012 Messages 1,192 Helped 171 Reputation 342 Reaction score 162 Trophy points 1,343 Activity points 0 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.
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.
Sep 12, 2012 #6 M madhusuthanan Full Member level 3 Joined Jan 3, 2012 Messages 188 Helped 8 Reputation 16 Reaction score 8 Trophy points 1,298 Location madurai Activity points 1,963 hi jhon caty, if you use pin as i/p place as '1' , its o/p its place as '0'.