questions regarding crystal use

For C and ASSEMBLY users to post questions and code snippets for programming in C and ASSEMBLY. And for any other C or ASM course related questions.

Moderators: Benj, Mods

Post Reply
christian
Posts: 4
Joined: Thu Mar 08, 2007 3:47 pm
Contact:

questions regarding crystal use

Post by christian »

hi, i'm trying to run this program using Pic16F88. I'm using the 19Mhz crystal and when i download the programm on the pic it actually runs correctly but if i set the RC switch not the XTAL. actually i want to work with the 19Mhz crystal. any suggestions?

For timing i'm using the delay_s command, is this an accurate timing command? and secondly when using delay_ms, the program is not working well.

#include <system.h>

void main (void)
{
unsigned int i ;



set_tris_b (0x1e);
while (1) {

output_high_port_b (0);
delay_s(1);
output_low_port_b (0);
delay_s(1);

}
}

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Post by Benj »

Hello

You need to configure your program to XTAL mode before you program the PIC. This can be done in the compiler youu are using or it can be done in PPP. If the program you are using already has config data embedded into it then you can make PPP ignore this by selecting

Options -> Options -> Ignore Hex Fuse Data.

The delay_s(); and delay_ms(); routines are based on your clock speed so you also have to make sure that this is set correctly to get accurate timing.

Post Reply