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

Need help getting CLKOUT to work

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



Joined: 09 Jun 2004
Posts: 52

View user's profile Send private message

Need help getting CLKOUT to work
PostPosted: Wed Jun 09, 2004 9:34 pm     Reply with quote

I'm using an 'F877 and would like to get the xtal clock freq (19.2MHZ) /4 from the CLKOUT (pin 14) to use in the circuit. I have used a logic probe to look for any output from the pin, and cannot see anything, nor will it drive the desired circuit.

I have used the below program just to verify that the PIC is actually running, and it is.

Can anyone point out what I'm doing wrong? Thanks

Steve


// ns_tst.c

////////////////////////////////////////////////////////////////////////

#include <16F877.H>
#FUSES RC,NOPROTECT,NOWDT,NOPUT,NOBROWNOUT,NOLVP,NOCPD,NOWRT
#use delay(clock=10000000)

#include "nep_hdr\nep_lcd.h"

//////////////////////////////////////////////////////////////////////////


main()
{
lcd_init();
lcd_putc("Hello, World!");
delay_ms(1000);
lcd_gotoxy(3,3);
lcd_putc("Goodby, World!");

}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jun 09, 2004 10:13 pm     Reply with quote

Quote:
I have used a logic probe to look for any output from the pin,
and cannot see anything, nor will it drive the desired circuit.


The CCS compiler puts a hidden SLEEP instruction at the end of main().
Your program is executing this instruction, which causes the oscillator
to stop running. The solution is to put a constant loop at the end of
main(). See the example below:

main()
{
lcd_init();
lcd_putc("Hello, World!");
delay_ms(1000);
lcd_gotoxy(3,3);
lcd_putc("Goodby, World!");

while(1); // Add this line
}
eyewonder300



Joined: 09 Jun 2004
Posts: 52

View user's profile Send private message

PostPosted: Wed Jun 09, 2004 10:36 pm     Reply with quote

Thanks, PCM. That simple change made it work.

Steve
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