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

PCD: #use delay()

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



Joined: 05 Oct 2009
Posts: 6

View user's profile Send private message

PCD: #use delay()
PostPosted: Mon Oct 05, 2009 8:24 am     Reply with quote

On all of the usb to serial examples, when you use the 24FJ256GB110 an error arises from trying to use the #use rs232 without having done a #use delay. What is the delay for this chip?
_________________
KDONEY
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Mon Oct 05, 2009 8:45 am     Reply with quote

In USB operation, it's usually a fraction of the PLL VCO frequency of 96 MHz, selectable are 32, 16, 8 or 4 MHz.
kdoney34711



Joined: 05 Oct 2009
Posts: 6

View user's profile Send private message

PostPosted: Mon Oct 05, 2009 8:51 am     Reply with quote

On all of the other chips they are using the pll speed. For instance, on the pic explorer 16 they use
Code:
#use delay(clock=32M)  //8MHz clock is 4x because of PLL

and the others are the same. If the pll for the 24F is 96 MHz shouldn't I use 96M?

The whole section is
Code:

   #if __USB_PIC_EXPLORER16__
    #use delay(clock=32M)  //8MHz clock is 4x because of PLL
    #fuses PLL2   //Divide 8MHz by 2 to get the 4MHz required for USB

if this helps answer the question. They change a fuse after setting delay.
_________________
KDONEY
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Mon Oct 05, 2009 1:20 pm     Reply with quote

Quote:
For instance, on the pic explorer 16 they use

The question, what you use respectively intend to use. I can't know.

With PIC24FJxxGB, the VCO must run at 96 MHz (if used at all), the PLL fuses have to be set to achieve this frequency with the respective crystal. Then, with PR_PLL in effect, the default cpu clock is 32 MHz. It can be divided down by setting CPDIV1:CPDIV0 bits in CLKDIV register. But I guess, you're satisfied with default 32 MHz.
Guest








PostPosted: Tue Oct 06, 2009 1:50 pm     Reply with quote

I usually verify by scoping a pin and put
Code:

while (1)
{
output_high(pin_a0);
delay ms(1);
output_low(pin_a0);
delay ms(1);
}

This proves you have the right settings.
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Tue Oct 06, 2009 8:27 pm     Reply with quote

Look VERY carefully at page pdf page 118 (or 116 of the datasheet).

It shows very clearly how the PLL branches with a MAX output frequency of 32MHz for the CPU core.

So #USE DELAY (clock=32M) is what you want for max speed.. (less if you use the CPDIV bits to divide down)



-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
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