Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 5 months ago.
Is the wait time in KL25z limited to 2us by default?
Hi,
I am trying to generate a 50% duty cycle clock having 1 MHz frequency using FRDM-KL25z. So I just wrote the following code in mbed online compiler. The wait time I specified is = 0.0000005 sec (or, 0.5 usec). However, when I observe the clock in the scope, it is showing a 125 KHz clock corresponding to wait time = 2 us.
#include "mbed.h"
DigitalOut CLK(PTE1);
int main()
{
CLK = 0;
while(1)
{
CLK = 1;
wait(0.0000005);
CLK = 0;
wait(0.0000005);
}
}
But, when I set the wait time to 100 us (5 KHz freq), it is coming correctly.
I am a new user of FRDM-KL25z. So, please help me in this.
- Thanks Samiran