PIC18F4550 problem, Please help!!!!

Discussion about projects that used PIC Microcontroller, Hardware Interface, Programming Algorithm and etc......

PIC18F4550 problem, Please help!!!!

Postby soongkhim » Sat Dec 31, 2011 5:26 pm

HI everyone,
My sample code as follow:
TRISA=0x00;
TRISB=0x00;
TRISC=0x00;
TRISD=0x00;

PORTA=0xFF;
PORTB=0xFF;
PORTC=0xFF;
PORTD=0xFF;

I want to ask why when i measure the voltage at pin RC4, RC5 and RB5 are logic '0' ?
what is the problem?
what should i do to overcome this problem?
PLEASE HELP!!!
THANK YOU.
soongkhim
Newbie
 
Posts: 12
Joined: Tue Dec 27, 2011 9:59 pm

Re: PIC18F4550 problem, Please help!!!!

Postby ABSF » Sat Dec 31, 2011 6:17 pm

Try "LATC=0xff;" instead of "PORTC=0xff;"

Allen
The next war will determine NOT who is right BUT what is left.
User avatar
ABSF
Professional
 
Posts: 810
Joined: Wed Nov 10, 2010 9:32 am
Location: E Malaysia

Re: PIC18F4550 problem, Please help!!!!

Postby soongkhim » Sat Dec 31, 2011 6:36 pm

how bout RB5?
soongkhim
Newbie
 
Posts: 12
Joined: Tue Dec 27, 2011 9:59 pm

Re: PIC18F4550 problem, Please help!!!!

Postby ABSF » Sat Dec 31, 2011 6:46 pm

soongkhim WROTE:how bout RB5?

ditto
The next war will determine NOT who is right BUT what is left.
User avatar
ABSF
Professional
 
Posts: 810
Joined: Wed Nov 10, 2010 9:32 am
Location: E Malaysia

Re: PIC18F4550 problem, Please help!!!!

Postby soongkhim » Sat Dec 31, 2011 9:14 pm

HI,
using LATC and LATB still do not solve my problems.
what can i do futher?
soongkhim
Newbie
 
Posts: 12
Joined: Tue Dec 27, 2011 9:59 pm

Re: PIC18F4550 problem, Please help!!!!

Postby soongkhim » Sat Dec 31, 2011 10:07 pm

I just noticed that port c bit 4 and 5 cannot be implemented as normal i/o. but y port b bit 5 cannot cannot be set?
soongkhim
Newbie
 
Posts: 12
Joined: Tue Dec 27, 2011 9:59 pm

Re: PIC18F4550 problem, Please help!!!!

Postby ABSF » Sun Jan 01, 2012 12:01 am

soongkhim WROTE:I just noticed that port c bit 4 and 5 cannot be implemented as normal i/o. but y port b bit 5 cannot cannot be set?


correct, RC4 & RC5 cannot be used as digital output.
Unlike other PORTC pins, RC4 and RC5 do not have
TRISC bits associated with them. As digital ports, they
can only function as digital inputs. When configured for
USB operation, the data direction is determined by the
configuration and status of the USB module at a given
time. If an external transceiver is used, RC4 and RC5
always function as inputs from the transceiver. If the
on-chip transceiver is used, the data direction is
determined by the operation being performed by the
module at that time


RB5 should be able to use as digital output unless that port pin is either open-drain or faulty. Try to connect a 10K resistor to pull it high and see if it work.

Allen
The next war will determine NOT who is right BUT what is left.
User avatar
ABSF
Professional
 
Posts: 810
Joined: Wed Nov 10, 2010 9:32 am
Location: E Malaysia

Re: PIC18F4550 problem, Please help!!!!

Postby robosang » Tue Jan 03, 2012 7:38 am

learn something new today, thanks :mrgreen:

So RC4 and RC5 is actually the D+ and D- right? Yup, checked datasheet, is for USB communication :)
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: PIC18F4550 problem, Please help!!!!

Postby ABSF » Wed Jan 04, 2012 11:18 am

robosang WROTE:learn something new today, thanks :mrgreen:

So RC4 and RC5 is actually the D+ and D- right? Yup, checked datasheet, is for USB communication :)


It was new to me too until I read the datasheet. There's new things to learn everyday! :lol:

Allen
The next war will determine NOT who is right BUT what is left.
User avatar
ABSF
Professional
 
Posts: 810
Joined: Wed Nov 10, 2010 9:32 am
Location: E Malaysia

Re: PIC18F4550 problem, Please help!!!!

Postby soongkhim » Sat Jan 07, 2012 3:32 am

Hi,
I want to ask, why when i wan to inputting to the p18f4550, it does not work.
what should i do?
Please advice.
Thanks.

CODE: SELECT_ALL_CODE
TRISA=0x0FF;
TRISB=0x0FF;
TRISC=0x00;
TRISD=0x00;
PORTC=0x00;
PORTD=0x00;
for(;;)
{
if(PORTBbits.RB0==1)
{
PORTC++;
}
else if (PORTA!=0x00)
{
PORTD++;
}
}

when i press the button connecting between rb0 and vdd, it does not work, same as to port a.
why was it?
soongkhim
Newbie
 
Posts: 12
Joined: Tue Dec 27, 2011 9:59 pm

Next

Return to PIC Microcontroller

Who is online

Users browsing this forum: No registered users and 1 guest

cron