Timing issues using HitechC as a compiler
Posted: Wed Mar 17, 2010 1:02 am
Hi,
I have developed an application in Flowcode, set to the default compiler options, utilising a 16F876 and an external 20MHz oscillator. This application relies on reasonably accurate timing and it is working well. By reasonably accurate I mean that the delay icons have been sufficient.
I am now attempting to port it to a 16F1936 utilising the internal oscillator and HitechC as the compiler. The program compiled and programmed as expected but the application didn't work.
As a fault finding measure I programmed the device to output a square wave on the C port, high for 1 second then low for 1 second. The oscillator was set to INTOSC and the clock speed in project options was set to 20MHz. This resulted in the C port going high for around 5 seconds and then low for 5. I then found that be changing nothing but the clock speed (which I lowered) the output got closer to what I expected but still nothing like 1 second pulses . Using another chip and the default BoostC the delays times seem to be accurate irrespective of the clock speed.
Is there an issue with the delay function when using HitechC and if so can you reccomend a work around?
Thanks as always
MW
I have developed an application in Flowcode, set to the default compiler options, utilising a 16F876 and an external 20MHz oscillator. This application relies on reasonably accurate timing and it is working well. By reasonably accurate I mean that the delay icons have been sufficient.
I am now attempting to port it to a 16F1936 utilising the internal oscillator and HitechC as the compiler. The program compiled and programmed as expected but the application didn't work.
As a fault finding measure I programmed the device to output a square wave on the C port, high for 1 second then low for 1 second. The oscillator was set to INTOSC and the clock speed in project options was set to 20MHz. This resulted in the C port going high for around 5 seconds and then low for 5. I then found that be changing nothing but the clock speed (which I lowered) the output got closer to what I expected but still nothing like 1 second pulses . Using another chip and the default BoostC the delays times seem to be accurate irrespective of the clock speed.
Is there an issue with the delay function when using HitechC and if so can you reccomend a work around?
Thanks as always
MW