View previous topic :: View next topic |
Author |
Message |
HTAluvBeBeo
Joined: 23 Feb 2008 Posts: 35
|
Plz help me with INTERNAL OSC |
Posted: Tue Aug 26, 2008 11:05 am |
|
|
Plz Help me to config 18f2525 to use Internal oscillator at 8MHz and 32MHz.
Here is my test code.
I tested with Proteus to simulate my program.
Code: | #include <18F2525.h>
#fuses NOWDT, HS, NOPUT, NOPROTECT, NODEBUG, NOBROWNOUT, NOLVP
#use delay(clock=8000000)
void main()
{ setup_oscillator(OSC_8MHZ|OSC_INTRC|OSC_PLL_OFF);
set_tris_a(0x00);
output_A(0x00);
while(1)
{
output_high(PIN_A6);
output_low(PIN_A7);
delay_ms(500);
output_high(PIN_A7);
output_low(PIN_A6);
delay_ms(500);
}
} |
|
|
![](templates/subSilver/images/spacer.gif) |
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Tue Aug 26, 2008 12:17 pm |
|
|
Try changing your HS fuse to INTIO2. That will enable the internal oscillator with regular I/O on pins RA6 & RA7.
Also, setting the TRIS does nothing unless you also specify FAST_IO.
Ronald |
|
![](templates/subSilver/images/spacer.gif) |
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Wed Aug 27, 2008 8:06 am |
|
|
rnielsen wrote: |
Also, setting the TRIS does nothing unless you also specify FAST_IO.
|
I would note that few programmers need either TRIS or FAST_IO. Just let the compiler take care of things with the default STANDARD_IO unless you see a need to change it. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
![](templates/subSilver/images/spacer.gif) |
HTAluvBeBeo
Joined: 23 Feb 2008 Posts: 35
|
|
Posted: Wed Aug 27, 2008 10:55 am |
|
|
INTIO2 is an invalid fuse with 18F2525
My complier version is 4.020
I found the answer:D
the correct fuse probably is INTRC_IO
Is it right?:D |
|
![](templates/subSilver/images/spacer.gif) |
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Tue Sep 02, 2008 8:34 am |
|
|
Sorry, I simply looked at the spec sheet and it stated INTIO2 as the fuse. After looking at the .h file it states to use INTRC_IO so you're correct. I guess the two don't always use the same wording.
Ronald |
|
![](templates/subSilver/images/spacer.gif) |
|