James, I think you have a problem with the values you are using with the delay function: nCycles = nMilliseconds * CYCLES_PER_MS In your example nCycles = 500 * 500 = 250000 cycles. This is too big for an int, and will cause an arithmetic overflow. Probably the code is running but the delay is so short you can't see it! Brent Brown Electronic Design Solutions 16 English Street Hamilton, New Zealand Ph/fax: +64 7 849 0069 Mobile/text: 025 334 069 eMail: brent.brown@clear.net.nz -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics