diogenes500
New Member
Hello,
I'm beginning to learn about microcontrollers and have run into a perplexing issue for which I can't find the answer to on any of the forums. Using the PIC18F4550, programming in c, with the standard MPLAB software and hardware (pickkit3), I can successfully compile, program, and run the code below (turn an led on/off) but there is a very long wait time between my command in software to run the program and it actually executing, around 50 seconds! Is this related to sleep mode, or turning off the watchdog? I turned the watchdog back on to no avail. I've programmed the same program in asm and have the same problem.
For completeness, here is the code.
------------------------------------
#include <p18f4550.h>
#include <delays.h>
#pragma config FOSC = INTOSCIO_EC //Internal oscillator
#pragma config WDT = OFF
#define LEDP LATDbits.LATD1
#define LEDT TRISDbits.TRISD1
void main()
{
LEDT = 0;
LEDP = 1;
while(1)
{
LEDP = ~LEDP;
Delay10KTCYx(10);
}
}
I'm beginning to learn about microcontrollers and have run into a perplexing issue for which I can't find the answer to on any of the forums. Using the PIC18F4550, programming in c, with the standard MPLAB software and hardware (pickkit3), I can successfully compile, program, and run the code below (turn an led on/off) but there is a very long wait time between my command in software to run the program and it actually executing, around 50 seconds! Is this related to sleep mode, or turning off the watchdog? I turned the watchdog back on to no avail. I've programmed the same program in asm and have the same problem.
For completeness, here is the code.
------------------------------------
#include <p18f4550.h>
#include <delays.h>
#pragma config FOSC = INTOSCIO_EC //Internal oscillator
#pragma config WDT = OFF
#define LEDP LATDbits.LATD1
#define LEDT TRISDbits.TRISD1
void main()
{
LEDT = 0;
LEDP = 1;
while(1)
{
LEDP = ~LEDP;
Delay10KTCYx(10);
}
}