> -----Original Message----- > From: Graham North [SMTP:graham.north@CIRRUSRESEARCH.CO.UK] > Sent: Thursday, February 06, 2003 9:36 AM > To: PICLIST@MITVMA.MIT.EDU > Subject: [PIC]: Using Timer 2 as clock for SPI? > > Hi everyone, > > How exactly do I use Timer 2 as the clock source for SPI? I am using a > 17C756A, but guess it will be similar on other micros. Does the clock > toggle > every time the timer 'ticks', or only when the timer rolls over and > generates an interupt? The data book does not describe it well. > > I am trying to get an ~2.5MHz clock speed for my SPI link with a 20MHz > xtal, > can it be done? > I'm not fammiliar with the 17C series, but in the 16x the SPI clock can be derived from Fosc/4, Fosc/16, Fosc/64 or Timer 2 output/2. The timer outputs a clock when TMR2 matches the value in PR2, when the TMR2 register is reset. Thus a lower value in PR2 will give a faster clock rate. The datasheet should give full details on the operation of the Timer2. Regards Mike -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads