CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

I need help on pic18f2550

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
shs
Guest







I need help on pic18f2550
PostPosted: Wed Jul 18, 2007 8:30 am     Reply with quote

hello everyone,i am new here,thank you for you help.
i am using 18f2550 as a usb instrument,because the usb voltage is not stable,so i use a 5v as the vref+,but when i connect the an3 to 5v,the pc can not recgnize the instrument,if i remove the 5v from an3,the instument work well,i use the code below to initlize the adc,is there anyone who can help me,thank you.


SETUP_ADC_PORTS(AN0_TO_AN3 | VSS_VREF);
Sad
SET



Joined: 15 Nov 2005
Posts: 161
Location: Glasgow, UK

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Wed Jul 18, 2007 11:32 am     Reply with quote

Can you post a circuit?
Sounds like the USB device detection mechanism (pull up resistors on D+/D-) is getting clobbered by your 5v connection?
cnshs



Joined: 18 Jul 2007
Posts: 3

View user's profile Send private message

PostPosted: Wed Jul 18, 2007 9:21 pm     Reply with quote

i use the circuit below:except connect a 5v to an3
cnshs



Joined: 18 Jul 2007
Posts: 3

View user's profile Send private message

part of source code
PostPosted: Wed Jul 18, 2007 9:31 pm     Reply with quote

SETUP_ADC_PORTS(AN0_TO_AN3 | VSS_VREF);
SETUP_ADC(ADC_CLOCK_DIV_64);
SETUP_TIMER_0(RTCC_INTERNAL|RTCC_DIV_1);
SETUP_TIMER_1(T1_DISABLED);
SETUP_TIMER_2(T2_DISABLED, 127, 1);
SETUP_TIMER_3(T3_INTERNAL | T3_DIV_BY_8);
SETUP_CCP1(CCP_OFF);
SETUP_CCP2(CCP_OFF);
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);
tempADC = READ_ADC();
cnshs



Joined: 18 Jul 2007
Posts: 3

View user's profile Send private message

i hnow part of the reason
PostPosted: Thu Jul 19, 2007 7:13 am     Reply with quote

i have know some of the reason:the vref+ is high the vdd,and there is a diode in the pin that pass the current from vref+ to vdd.
thank you for you read my question.
Bill Boucher



Joined: 04 Feb 2005
Posts: 34
Location: Chatham,ON,CA

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Thu Jul 19, 2007 8:39 am     Reply with quote

Your PIC is at the end of a USB cable so you need to add decoupling caps such as 100nF to 1uF across the PIC power supply pins. Also, it might help to install 20 ohm resistors in the D+ line and the D- line. Also, try connecting your analog signal at AN3 through a 1k to 10k resistor.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group