mikroc 8.2 configuration bits

Thread Starter

gehan_s

Joined Sep 17, 2012
38
Please help me set the configuration bits for my pic18F2550 microcontroller. I am using mikroc v8.2 with an external quartz crystal. I tried the default settings with the following code and the timing was way off. BTW the circuit works even without the oscillator (I think this has to do with the default bit setting).

This is the code that I tried.

Thanks in advance !!!!!!!!!!!!!!!

Rich (BB code):
void main(){

TRISA=0;

while(1){

PORTA=1;
delay_ms(1000);
PORTA=0;
delay_ms(1000);
}

}
 
Last edited by a moderator:

thatoneguy

Joined Feb 19, 2009
6,359
In the project settings tab, do you have the correct PIC chosen, as well as oscillator ferquency (in Hz), internal or ext?

Check the help file for external crystal changes.
 

ErnieM

Joined Apr 24, 2011
8,377
Please help me set the configuration bits for my pic18F2550 microcontroller. I am using mikroc v8.2 with an external quartz crystal. I tried the default settings with the following code and the timing was way off. BTW the circuit works even without the oscillator (I think this has to do with the default bit setting).
If "the circuit works even without the oscillator" you have the config bits set wrong: you have the internal oscillator turned on. "HS" is probably the setting you need for this unspecfied crystal you are attempting to use to work.

As you have also not specified what frequency you want the PIC to run at we can't help you with other config or register settings you need. You figure these out using the Clock Diagram (Figure 2.1) of the spec sheet. "Where" the bits noted are places is always a pain to find, but the search feature in PDF's helps.

The compiler needs to know how fast the code is running so the delay_ms() function times correctly. This is set in the same "Edit Project" window as the config settings. "Oscillator Frequency" needs to be
 

takao21203

Joined Apr 28, 2012
3,702
4 MHz or NTSC colorburst: XT.
8 MHz or higher: HS.

6 MHz crystals are rarely used, I do not know XT or HS.

How does MicroC work? Having an IDE on it's own, or integrated into MPLABX?

For MPLABX, you can use: WINDOW::pIC MEMORY VIEWS::CONFIGURATION + copy the generated code into the configuration_bits.c file.

MicroC must have a similar facility.
 

Thread Starter

gehan_s

Joined Sep 17, 2012
38
Thank you all for your replies !!!!!

The crystal frequency is 4MHz. Sorry I did not know that it was important. I did it in V4.15 with some settings that I found in the net and it works fine. It’s just that in V8.2 the notations are hard to understand.

Regards
 
Top