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 support@ccsinfo.com

questions about pic16f1933 and 4X PLL

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



Joined: 15 May 2010
Posts: 10

View user's profile Send private message

questions about pic16f1933 and 4X PLL
PostPosted: Sat May 15, 2010 5:29 pm     Reply with quote

The following gets a compile error on PCM (linux version):
Code:

#include <16F1933.h>
#use delay(crystal=4.9152Mhz, clock=19.6608Mhz)

main()
{
  for(;;){
  }
}

Output:
Code:

CCS PCM C Compiler

.
.
.
Compiling:  test.c
1 Errors,  0 Warnings,  Time: 1 Seconds
Error[99]   test.c 2 : Option invalid   No PLL
      1 Errors,  0 Warnings.

Compiler version: PCM compiler version 4.105;2/26/2010

The pic 16F1933 part has a selectable 4X PLL!

Also when I modify test.c as follows
Code:

#include <16F1933.h>
#use delay(crystal=4.9152Mhz)

main()
{
  for(;;){
  }
}

It compiles just fine, however, looking at the list file, the PLL bit in the second config word is being turned on!:
Code:

Configuration Fuses:
Word  1: 3FC2   HS NOWDT PUT NOPROTECT MCLR NOCPD BROWNOUT IESO FCMEN NOCLKOUT
Word  2: 1733   NOWRT NOVCAP PLL STVREN BORV19 NOLVP NODEBUG

Questions:

1. Why does the compiler think that the 16F1933 part doesn't have a PLL?

2. Why is the PLL bit being turned on by the compiler?


Steve
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat May 15, 2010 10:07 pm     Reply with quote

I don't have the Linux version so I can't test it explicitly. Try telling the
compiler what to do, in the most simple, direct terms. Give it the HS fuse
to run the 4.9152 MHz crystal. Then enable the PLL circuit with the PLL
fuse. Then tell it what the final oscillator frequency will be, in the #use
delay() statement. See if this works:
Code:

#include <16F1933.H>
#fuses HS, PLL, NOWDT, PUT, NOLVP
#use delay(clock=19660800)

//=================================
void main()
{

while(1);
}
hwstar



Joined: 15 May 2010
Posts: 10

View user's profile Send private message

16F1933 and 4x PLL
PostPosted: Sun May 16, 2010 11:37 am     Reply with quote

After making a small change to the suggested test program, it appears to be setting the fuses correctly. The linux version is case sensitive on file names and needs a lower case h for the header files.:

Code:


#include <16F1933.h>
#fuses HS, PLL, NOWDT, PUT, NOLVP
#use delay(clock=19660800)

//=================================
void main()
{

while(1);
}

Fuse list from test.lst file:




Code:

Configuration Fuses:
   Word  1: 3FC2   HS NOWDT PUT NOPROTECT MCLR NOCPD BROWNOUT IESO FCMEN NOCLKOUT
   Word  2: 1733   NOWRT NOVCAP PLL STVREN BORV19 NOLVP NODEBUG
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