CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Pic24: Problem with oscillator output

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
nicotec



Joined: 07 Nov 2008
Posts: 60

View user's profile Send private message

Pic24: Problem with oscillator output
PostPosted: Sat Jan 16, 2010 4:45 pm     Reply with quote

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
nicotec



Joined: 07 Nov 2008
Posts: 60

View user's profile Send private message

Help!
PostPosted: Sun Jan 17, 2010 2:46 am     Reply with quote

Please can anyone help me?
Thanks
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Sun Jan 17, 2010 3:37 am     Reply with quote

OSCIOFCN is a #fuses bit. See PCD valid fuses overview.
nicotec



Joined: 07 Nov 2008
Posts: 60

View user's profile Send private message

not fuse
PostPosted: Sun Jan 17, 2010 5:34 am     Reply with quote

Thanks but it doesn't appear in the list of valid fuses; any suggestion?
Thanks
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Sun Jan 17, 2010 7:31 am     Reply with quote

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!
nicotec



Joined: 07 Nov 2008
Posts: 60

View user's profile Send private message

Not so clear
PostPosted: Sun Jan 17, 2010 4:01 pm     Reply with quote

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
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Mon Jan 18, 2010 12:46 am     Reply with quote

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.
1980best



Joined: 25 May 2007
Posts: 26

View user's profile Send private message

PostPosted: Sat Aug 27, 2011 3:22 am     Reply with quote

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 .....
Ttelmah



Joined: 11 Mar 2010
Posts: 19518

View user's profile Send private message

PostPosted: Sat Aug 27, 2011 4:03 am     Reply with quote

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
1980best



Joined: 25 May 2007
Posts: 26

View user's profile Send private message

PostPosted: Mon Sep 05, 2011 6:04 am     Reply with quote

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 ///////////////
razor1983m



Joined: 09 Jun 2011
Posts: 2

View user's profile Send private message

PostPosted: Tue Sep 06, 2011 4:39 am     Reply with quote


#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 Laughing
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group