View previous topic :: View next topic |
Author |
Message |
Frumaster
Joined: 01 Nov 2008 Posts: 1
|
Problem with interrupts and USB communication - 18F4550 |
Posted: Sat Nov 01, 2008 5:46 pm |
|
|
I have 2 uses for the microcontroller. Analog-to-digital conversion and driving servomotors with PWM. For the PWM I am using a code with interrupts. However, with those interrupts enabled (RTCC or timer0), the PIC cannot communicate through USB. I get a "device not recognized" error every time. Without USB communication I can't see my ADC results. How do I get around this, or what am I doing wrong? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Nov 02, 2008 12:27 am |
|
|
Turn on the compiler warning messages (if they are turned off) and
re-compile. Are you getting any warnings ? |
|
|
Bcox
Joined: 09 Oct 2007 Posts: 17 Location: Windsor, CT
|
|
Posted: Mon Nov 03, 2008 9:18 am |
|
|
i am using an 18F4550 for several very similar applications. I ran into the same problem that you were having. Here was my problem and solution.
Problem: An external trigger (interrupt) would tell the pic to turn on or off the PWM of a solenoid. If this trigger was pulsing prior to me plugging in the USB, I would get the same "device not recognized" error. What was happening was that the external interrupt was not allowing the USB finish establishing a connection with the PC. In my case, I need the external interrupt to be the highest priority. The USB communication is not needed as the device will mostly be running not connected to a PC.
Solution: Make sure no interrupts occur while attempting to connect to the computer. In my case, connect the device to the PC before sending an external trigger.
Hope this helps! |
|
|
|