#include <p18f2550.h>
#pragma config FOSC = INTOSC_XT
#pragma config WDT = OFF
void main()
{
int delay;
TRISC = 0x00;
while (1)
{
PORTC = 0xff;
for (delay = 0; delay < 32000; delay++);
PORTC = 0x00;
for (delay = 0; delay < 32000; delay++);
}
}
Programming Target...
...Validating configuration fields
...Erasing Part
...Programming Program Memory (0x0 - 0x17F)
Verifying...
...Program Memory
...Verify Succeeded
Programming Configuration Bits
.. Config Memory
Verifying configuration memory...
...Verify Succeeded
...Programming succeeded
05-Jan-2012, 22:30:21
MPLAB ICD 2 ready for next operation
Resetting Target
MPLAB ICD 2 ready for next operation
Programming Target...
...Validating configuration fields
...Erasing Part
...Programming Program Memory (0x0 - 0x17F)
...Loading DebugExecutive
...Programming DebugExecutive
...Programming Debug Vector
...Programming RSBUG
Verifying...
...Program Memory
...Debug Executive
...Debug Vector
...Verify Succeeded
Programming Configuration Bits
.. Config Memory
Verifying configuration memory...
...Verify Succeeded
Connecting to debug executive
ICD0083: Debug: Unable to enter debug mode. Please double click this message for more information.
MPLAB ICD 2 ready for next operation
You need to disable LVP.
Try adding this extra config line:
Code:#pragma config LVP = OFF // disable Low Voltage Programming
You will need to move your LED to a non-USB pin.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.
#pragma config PBADEN = OFF // disable PORTB a/d converter
// simple LED flashing exercise
#include <p18f2550.h>
#pragma config FOSC = INTOSC_XT // internal oscillator for CPU
#pragma config WDT = OFF // disable watchdog timer
#pragma config LVP = OFF // LVP MUST be off
#pragma config BOR = OFF // no brown out reset
#pragma config MCLRE = ON // MCLR in use (so 10k to +5v essential)
#pragma config PWRT = ON // power up timer on
#pragma config PBADEN = OFF // disable PORTB a/d converter
void main()
{
int delay;
TRISB = 0x00; // all output
TRISC = 0x00; // 0,1,2,6,7 output (RC3, 4, 5 used by USB)
while (1)
{
LATB = 0xff; // LEDs on
LATC = 0xff; // LEDs 0,1,2,6,7 on
for (delay = 0; delay < 32000; delay++); // delay about 2 seconds to allow user to see LED lit
LATB = 0x00; // LEDs off
LATC = 0x00; // LEDs off
for (delay = 0; delay < 32000; delay++); // delay about 2 seconds to allow user to see LED off
}
}
ICDWarn0020: Invalid target device id (expected=0x92, read=0x0)
ICDWarn0052: MPLAB ICD 2 cannot validate a target device. Please make sure that the target device is connected and properly powered. Select "OK" to continue, or "CANCEL" to abort the operation
Vusb should have a 0.47uF ceramic capacitor connected, with the other side of the capacitor going to Vss. I seem to remember that the capacitor needs to be there even if you are not using USB.
I wasn't notated.. the led is blinking but very weak even if I drop half value of resistor, maybe when him is turned on somehow the mcu reset, don't know why
I put the capacitor and still the same and the debug still doesn't working.
When I set in MPLAB Programmer>Program everything seems good:
And then I press "Release from Reset" and nothing happens. :sad:
If I try to Program in Debug mode the response is even worst.
I believe your problem maybe your Fosc, the PLL maybe enable by default, which means your are running the device at a much faster Fosc than you intend.
The weak glowing LED is sometimes an indication of a very fast blinking LED.
You maybe running a Fosc of 48MHz instead of 4MHz.
I recommend setting all the configuration bits related to the oscillator, disabling the PLL.
When you switch from programmer to debugger mode, did you ensure the correct build configuration was selected.
Project -> Build Configuration -> Release (For Programmer Mode)
Project -> Build Configuration -> Debug (For Debugger Mode)
Without the debugger code, the ICD2 with issue an error like, "ICD0083: Debug: Unable to enter debug mode. Please double click this message for more information"
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?