hhhsssmmm
Member level 1
#pragma config osc
Hello
Im trying to get the internal OSC to work @ 8MHz on PIC18F1220. Im using C18 compiler. Below is my program and it uses the internal OSC. The program simply latchs HIGH and LOW 8 LEDs that are all connected to PORTB. Sadly this NEVER happens. Upon power up nothing seems to work and my LEDs do not flash. I have tested my PIC board and MCLR pin is pulled HIGH and VDD and VSS are correctly provided a clean and stable 7805 +5V / 0V supply. I have also tried changing the PIC to another 18F1220 but no luck there either.
Please can someone take a look at my below program and kindly suggest why my PIC does not do what the program below tells it to do.
Thank you
Haseeb
Added after 2 hours 8 minutes:
Hey thanks....
problem is now solved!!
it was the bloody programmer....i then later used MP3 programmer from microchip...and PRESTO
it works now beatifully...
so a lesson for all......plz use a good programer such as the MP3 from microchip when using the Internal OSC.
Haseeb
Hello
Im trying to get the internal OSC to work @ 8MHz on PIC18F1220. Im using C18 compiler. Below is my program and it uses the internal OSC. The program simply latchs HIGH and LOW 8 LEDs that are all connected to PORTB. Sadly this NEVER happens. Upon power up nothing seems to work and my LEDs do not flash. I have tested my PIC board and MCLR pin is pulled HIGH and VDD and VSS are correctly provided a clean and stable 7805 +5V / 0V supply. I have also tried changing the PIC to another 18F1220 but no luck there either.
Please can someone take a look at my below program and kindly suggest why my PIC does not do what the program below tells it to do.
Thank you
Haseeb
Code:
#include <p18f1220.h>
#include <delays.h>
#pragma config OSC = INTIO1 //using Internal OSC
#pragma config WDT = OFF
#pragma config LVP = OFF
//defining below the LED outputs
#define LED1 LATBbits.LATB0
#define LED2 LATBbits.LATB1
#define LED3 LATBbits.LATB2
#define LED4 LATBbits.LATB3
#define LED5 LATBbits.LATB4
#define LED6 LATBbits.LATB5
#define LED7 LATBbits.LATB6
#define LED8 LATBbits.LATB7
void main(void)
{
//Internal Oscillator Frequency @ 8MHz
OSCCONbits.IRCF2 = 1;
OSCCONbits.IRCF1 = 1;
OSCCONbits.IRCF0 = 1;
ADCON1 = 0b11111111; //All channels Digital
PORTA = 0; //intialize PORTA
PORTB = 0; //intialize PORTB
TRISB = 0x00; //PORTB as all OUTPUT
INTCON = 0; //Disable all interrupts
while(1) //loop forever
{
//MAKE all LEDs turn on
LED1 = 1;
LED2 = 1;
LED3 = 1;
LED4 = 1;
LED5 = 1;
LED6 = 1;
LED7 = 1;
LED8 = 1;
Delay10KTCYx(100); //500ms delay @ 8MHz
//MAKE all LEDs turn off
LED1 = 0;
LED2 = 0;
LED3 = 0;
LED4 = 0;
LED5 = 0;
LED6 = 0;
LED7 = 0;
LED8 = 0;
Delay10KTCYx(100); //500ms delay @ 8MHz
}
} //end of main()
Added after 2 hours 8 minutes:
Hey thanks....
problem is now solved!!
it was the bloody programmer....i then later used MP3 programmer from microchip...and PRESTO
it works now beatifully...
so a lesson for all......plz use a good programer such as the MP3 from microchip when using the Internal OSC.
Haseeb