As you can see below from the file delay.h "x must not exceed 255". Your parameter driveValue is an int. /* * Delay functions for HI-TECH C on the PIC * * Functions available: * DelayUs(x) Delay specified number of microseconds * DelayMs(x) Delay specified number of milliseconds * * Note that there are range limits: x must not exceed 255 - for xtal * frequencies > 12MHz the range for DelayUs is even smaller. * To use DelayUs it is only necessary to include this file; to use * DelayMs you must include delay.c in your project. * */ Could that be it ? Gaston James Fitzsimons wrote: > Hi all, > well, after my brief success with my timer I am kinda stuck again. I am > running the attached code through the MPLAB simulator, and it keeps > resetting half way through the DelayMs routine in servo.c. If I comment this > out it fails in the DelayUs routine immediately below it. I know these delay > routines are ok coz they work in different programs. > > Can anybody help me out with what might be causing this behavour? > > Thanks very much > regards > James Fitzsimons > > ------------------------------------------------------------------------ > Name: servo.c > servo.c Type: fichier C (application/x-unknown-content-type-C_auto_file) > Encoding: 7bit > > Name: delay.h > delay.h Type: fichier H (application/x-unknown-content-type-h_auto_file) > Encoding: quoted-printable > > Name: Delay.c > Delay.c Type: fichier C (application/x-unknown-content-type-C_auto_file) > Encoding: quoted-printable -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads