View previous topic :: View next topic |
Author |
Message |
nicotec
Joined: 07 Nov 2008 Posts: 60
|
Pic24: Problem with oscillator output |
Posted: Sat Jan 16, 2010 4:45 pm |
|
|
Hi, on my pic24fj16ga002 I need to disable oscillator output on pin 10 (RA3) to be used as input.
I'm using pic with internal fast oscillator and ccs compiler 4.093:
Code: |
#BYTE CW2=0x002BFC
#BIT OSCIOFCN = CW2.5
OSCIOFCN=0;
|
The above code doesn't work, can anyone help me?
Thanks and regards |
|
![](templates/subSilver/images/spacer.gif) |
nicotec
Joined: 07 Nov 2008 Posts: 60
|
Help! |
Posted: Sun Jan 17, 2010 2:46 am |
|
|
Please can anyone help me?
Thanks |
|
![](templates/subSilver/images/spacer.gif) |
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sun Jan 17, 2010 3:37 am |
|
|
OSCIOFCN is a #fuses bit. See PCD valid fuses overview. |
|
![](templates/subSilver/images/spacer.gif) |
nicotec
Joined: 07 Nov 2008 Posts: 60
|
not fuse |
Posted: Sun Jan 17, 2010 5:34 am |
|
|
Thanks but it doesn't appear in the list of valid fuses; any suggestion?
Thanks |
|
![](templates/subSilver/images/spacer.gif) |
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sun Jan 17, 2010 7:31 am |
|
|
From V4.093 24FJ16GA002.h header file:
Code: | //////// Fuses: SOSC,LPRC,FRC_PS,CKSFSM,NOCKSFSM,OSCIO,NOOSCIO,NOPR,HS,XT,EC |
Can you guess the fuse name? The valid fuses list has also an explicite explanation for each fuse! |
|
![](templates/subSilver/images/spacer.gif) |
nicotec
Joined: 07 Nov 2008 Posts: 60
|
Not so clear |
Posted: Sun Jan 17, 2010 4:01 pm |
|
|
I checked the fuses, but there are no clear reference to the byte/bit needed to put zero to use port A3 as input/output, I have also checked with oscilloscope and clock is still present; if you have suggestion on which fuse needed to try because is not so clear in description and may be that it is not available.
Thanks |
|
![](templates/subSilver/images/spacer.gif) |
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Mon Jan 18, 2010 12:46 am |
|
|
Generally, if the CCS C documentation appears unclear to you, refer to the Microchip datasheet. If the the
latter is insufficient, complain at Microchip!
In this case, the "Fuse Review" (Valid fuses menu) contains this info:
Quote: | 3.05 NOOSCIO OSC2 is clock output
3.05 OSCIO OSC2 is general purpose output |
Isn't it fully self-explanatory?
If the respective #fuses entry don't work as expected, check the actual generated config word against
the Microchip datasheet. I didn't check it, because I don't use this setting. |
|
![](templates/subSilver/images/spacer.gif) |
1980best
Joined: 25 May 2007 Posts: 26
|
|
Posted: Sat Aug 27, 2011 3:22 am |
|
|
bit 5 OSCIOFCN: OSCO Pin Configuration bit
If POSCMD1:POSCMD0 = 11 or 00:
1 = OSCO/CLKO/RA3 functions as CLKO (FOSC/2)
0 = OSCO/CLKO/RA3 functions as port I/O (RA3)
If POSCMD1:POSCMD0 = 10 or 01:
OSCIOFCN has no effect on OSCO/CLKO/RA3.
the problem continues.
help help help ..... |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19359
|
|
Posted: Sat Aug 27, 2011 4:03 am |
|
|
You do understand that the fuse is called OSCIO (For I/O on the oscillator pins), as FvM, has already pointed out. Haven't got 4.093, but on 4.099, setting this, happily allows I/O on the pin..
If your compiler predates this fuse being implemented, you have three choices:
1) Update the compiler.
2) Add a #ROM statement with the bit pattern needed for the fuses.
3) Change the fuse in your programmer, before writing the chip.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
1980best
Joined: 25 May 2007 Posts: 26
|
|
Posted: Mon Sep 05, 2011 6:04 am |
|
|
Code: |
#include <24FJ16GA004.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES NOJTAG //JTAG disabled
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
#FUSES ICS3 //ICD communication channel 3
#FUSES NOIOL1WAY //Allows multiple reconfigurations of peripheral pins
#FUSES NOWINDIS //Watch Dog Timer in Window mode
#FUSES WPRES128 //Watch Dog Timer PreScalar 1:128
#FUSES WPOSTS1 //Watch Dog Timer PostScalar 1:1
#FUSES NOIESO //Internal External Switch Over mode disabled
#FUSES FRC //Internal Fast RC Oscillator
#FUSES NOSKSFSM //Clock Switching Mode is disabled
#FUSES OSCIO //OSC2 is general purpose output
#FUSES NOPR //Pimary oscillaotr disabled
#FUSES I2C1SELD
#use delay(clock=8000000)
void main()
{
setup_oscillator(OSC_INTERNAL);
output_low(PIN_A2);
output_low(PIN_A3);
output_low(PIN_C3);
output_low(PIN_C9);
while(true)
{
output_toggle(PIN_A2);
DELAY_mS(1);
output_toggle(PIN_A3);
DELAY_mS(1);
output_toggle(PIN_C3);
DELAY_mS(1);
output_toggle(PIN_C9);
DELAY_mS(1);
}
} |
///////////////// This problem is solved /////////////// |
|
![](templates/subSilver/images/spacer.gif) |
razor1983m
Joined: 09 Jun 2011 Posts: 2
|
|
Posted: Tue Sep 06, 2011 4:39 am |
|
|
#include <24FJ16GA004.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES NOJTAG //JTAG disabled
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
#FUSES ICS3 //ICD communication channel 3
#FUSES NOIOL1WAY //Allows multiple reconfigurations of peripheral pins
#FUSES NOWINDIS //Watch Dog Timer in Window mode
#FUSES WPRES128 //Watch Dog Timer PreScalar 1:128
#FUSES WPOSTS1 //Watch Dog Timer PostScalar 1:1
#FUSES NOIESO //Internal External Switch Over mode disabled
#FUSES FRC_PLL //Internal Fast RC Oscillator
#FUSES NOSKSFSM //Clock Switching Mode is disabled
#FUSES OSCIO //OSC2 is general purpose output
#FUSES NOPR //Pimary oscillaotr disabled
#FUSES I2C1SELD
#use delay(clock=8000000)
void main()
{
setup_oscillator(OSC_INTERNAL);
output_low(PIN_A2);
output_low(PIN_A3);
output_low(PIN_C3);
output_low(PIN_C9);
while(true)
{
output_toggle(PIN_A2);
DELAY_mS(1);
output_toggle(PIN_A3);
DELAY_mS(1);
output_toggle(PIN_C3);
DELAY_mS(1);
output_toggle(PIN_C9);
DELAY_mS(1);
}
}
This ok working.... ![Laughing](images/smiles/icon_lol.gif) |
|
![](templates/subSilver/images/spacer.gif) |
|