I love a good mystery!
Posting your code really helped. I believe your problem is with your initial conditions. On the 9004 code, all the default values are set to 0. These values do not have time to be updated before they are read for the first time. If you look at the way Ttilt(Ticks) is calculated on the first run of the loop, I think the problem reveals itself. On the initial run, tiltInputLatched is 0. Follow the math, and by the time you get to the portion circled in red below, you get 24064. Subtracting this from 16384 and multiplying by 1800 gives -13824000. Since this is less than 20000000, it is passed to the FPGA. The FPGA is looking for a U32 rather than an I32, so the value is coerced to the correct representation. In this case, -13824000 becomes 4281143296 (the sign bit is included in the resulting U32). On the FPGA, this number is not equal to 20000000, so it is fed to the wait function. On a 40MHz clock, this is 107 seconds or 1min 47sec.
To fix the problem, you should either make sure your default values are set to something reasonable, or make sure the value is not read before a reasonable value is written to it.
Hope this helps!!
Message Edited by Dustin W on 03-05-2007 08:41 AM