These delays are frequently implemented as macros by compilers, and have=20 little or no bounds checking, so I would take a look at the nachine code=20 generated by the compiler, and make sure you're not getting some=20 overflow (casting too large a number into too small a register(set)). =20 I would expect that, if you had tried increasing the time by giving=20 Delay10TCYx a larger integer, but since you changed to Delay100TCYx with=20 a smaller value, it's not evident what it is. Joe W On 11/29/2013 10:59 AM, Neil wrote: > Bump. Hoping someone here can assist with this... > > > > Quoting Neil : > >> Also just tried this on another computer with MPLAB v8.76 and C18 >> v3.42. Same non-working behaviour. >> >> Cheers, >> -Neil. >> >> >> >> Quoting Neil : >> >>> Happy Thanksgiving US folks, >>> >>> Trying to figure out why code isn't working, I've whittled it down to >>> this oddity: >>> >>> This works, toggling LED's repeatedly as expected... >>> >>> while (1) >>> { >>> TRISC =3D 0b10101010; // '0's will turn LED's on. >>> for (x=3D0; x<200; x++) >>> { >>> Delay10TCYx(255); >>> res++; // Dummy task >>> } >>> TRISC =3D 0b01010101; // '0's will turn LED's on. >>> res++; // Dummy task >>> for (x=3D0; x<200; x++) >>> { >>> Delay10TCYx(255); >>> res++; // Dummy task >>> } >>> } >>> >>> >>> However, when I switch delay functions and adjust the time units >>> accordingly, the code stalls at the delay... >>> >>> while (1) >>> { >>> TRISC =3D 0b10101010; // '0's will turn LED's on. >>> for (x=3D0; x<200; x++) >>> { >>> Delay100TCYx(26); >>> res++; // Dummy task >>> } >>> TRISC =3D 0b01010101; // '0's will turn LED's on. >>> res++; // Dummy task >>> for (x=3D0; x<200; x++) >>> { >>> Delay100TCYx(25); >>> res++; // Dummy task >>> } >>> } >>> >>> >>> This is a fresh install of MPLAB 8.66 with C18 v3.46. I've disabled >>> all optimizations in the project's build options. What else should I >>> be checking, or is this a legitimate bug with the compiler/libraries? >>> FWIW, I also noticed that I could previously use "while (1)" for >>> infinite loops, but now the compiler hangs for several minutes, memory >>> usage climbs significantly, then just fails to compile. >>> >>> Cheers, >>> -Neil. >>> >>> >>> >>> -- >>> http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive >>> View/change your membership options at >>> http://mailman.mit.edu/mailman/listinfo/piclist >>> >> >> >> -- >> http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive >> View/change your membership options at >> http://mailman.mit.edu/mailman/listinfo/piclist >> > > --=20 Joe Wronski jwronski@stillwatereng.net www.stillwatereng.net --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .