I am trying to create a variable clock pulse out of an IO on a port for an L297 stepper driver. I use an ADC to measure the input voltage between 1 and 5 VDC. That value is converted to a time value between 1 and 100 ms which is placed in the delay_ms() function. I noticed howver that the actual delay is much longer than it should be . Does the delay_ms function have anything to do with the oscillator frequency?
I am using a PIC 16F877A with a 4 MHz crystal. I'm simulating all of this using Proteus to do some initial development.
Ttelmah Guest
Posted: Mon Sep 28, 2009 9:03 am
Of course it is dependant on clock frequency. The 'clock', is the only time 'source' in the chip...
To get 'correct' delays, two things have to apply:
1) The timing set in the 'clock' statement, must match the actual oscillator you are using.
2) If using a simulator, the timings set in this, must also match the oscillator.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum