Two things: First the delay routines call each other, so if you call delay1s, you have to save the stack for 5 routines (delay1s calls delay_10ms, and so on) so becareful with that because you could be running ouf of stack and your program doing some weird stuff. The other thing is about crystal. I used to use some crystal of 3.582056 Mhz, because it's divisible by 2 until you reach 1. I thinks that's better crystal for time applications than 4 Mhz. On Mon, Feb 22, 2010 at 7:58 AM, ivp wrote: >> The crystal he is using is probably cheaper than a 4MHz one because >> it is a TV colour burst frequency for US TV sets > > 3.579545 is surprisingly common on digital boards with counters like > the 4060, as well as DTMF ICs. Even on complex boards, stuffed full > of exotic chips, where you think no expense is spared, it's still way the > most common in the 4MHz-ish range. I've stripped dozens off a wide > variety of PCBs > > ----------- > > There are some 3.58MHz here with the MC145443 300-baud modem > IC (1995 vintage). I have a feeling these are used for some sort of inter- > board comms and would like to find a use for them in a PIC context, > but they must be a bit old hat now eh ? > > http://www.datasheetdir.com/MC145443+Interface > > ---------- > > wbr > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- Matias Vidoni eMail: matiasvidoni@mvcom.com.ar MSN Messenger: matiasvidoni@mvcom.com.ar Skype: matiasvidoni WWW: http://www.matiasvidoni.com.ar Google Talk: matiasvidoni@gmail.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist