|
|
View previous topic :: View next topic |
Author |
Message |
eyewonder300
Joined: 09 Jun 2004 Posts: 52
|
Need help getting CLKOUT to work |
Posted: Wed Jun 09, 2004 9:34 pm |
|
|
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
|
|
Posted: Wed Jun 09, 2004 10:13 pm |
|
|
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
|
|
Posted: Wed Jun 09, 2004 10:36 pm |
|
|
Thanks, PCM. That simple change made it work.
Steve |
|
|
|
|
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
|