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

PIC18F87J60 oscillator problem

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



Joined: 13 Jan 2009
Posts: 4

View user's profile Send private message

PIC18F87J60 oscillator problem
PostPosted: Tue Jan 13, 2009 9:34 am     Reply with quote

I'm trying to write a program for the PIC18F87J60 and I started with a simple LED flash, however when I run this on the chip the LED flashes with only a 5.28uS delay not 500ms. There's a 25MHz crystal attached.

Any ideas? I've tried manually setting the OSCTUNE register etc with no success.

Thanks
Edward
Code:
#include <18F87J60.h>
#device adc=8

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES WDT128                   //Watch Dog Timer uses 1:128 Postscale
#FUSES HS                       //High speed Osc
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES XINST                    //Extended set extension and Indexed Addressing mode enabled
#FUSES STVREN                   //Stack full/underflow will cause reset
#FUSES NOPROTECT                //Code not protected from reading
#FUSES FCMEN                    //Fail-safe clock monitor enabled
#FUSES IESO                     //Internal External Switch Over mode enabled
#FUSES PRIMARY                  //Primary clock is system clock when scs=00
#FUSES ECCPE                    //Enhanced CCP PWM outpts multiplexed with RE6 thorugh RE3
#FUSES ETHLED                   //Ethernet LED enabled
#FUSES RESERVED                 //Used to set the reserved FUSE bits

#use delay(clock=25MHZ, oscillator=25MHZ)

void main()
{

   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_OFF|ADC_TAD_MUL_0);
   setup_spi(SPI_SS_DISABLED);
   setup_wdt(WDT_OFF);
   setup_timer_0(RTCC_INTERNAL);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_timer_4(T4_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);   
   
   output_high(PIN_B3);
   
   while (1)
   {
      output_low(PIN_B2);
      delay_ms(500);
      output_high(PIN_B2);
      delay_ms(500);
   }
}
Ttelmah
Guest







PostPosted: Tue Jan 13, 2009 9:49 am     Reply with quote

The CCS compiler does not support XINST. May not be the problem, but code is unlikely to work right with this fuse set.

Best Wishes
EdwardH



Joined: 13 Jan 2009
Posts: 4

View user's profile Send private message

PostPosted: Tue Jan 13, 2009 9:55 am     Reply with quote

Thanks, that's what it was!
I just used the project wizard to start with and it added the fuse by default.
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