Hi ,
I need to wait PTD4 to high ,and then use timer to do something .
follows is my code :
TestIO_00; // Set Test IO low
//other codes
while((GPIOD_PDIR&0x00000010)==0){}; //wait the PTD4 to High , this code will take different //time, and this is my question
TestIO_11; // Set Test IO High
//other codes
I found that when the PTD4 turn to high , the MKL16 take different time to check . Now the CoreClock is 2MHz , BusClock is 1MHz .
folows are my two records ,and you can find that the time of check PTD4 high is not same . So, how to make the check time same ?
Solved! Go to Solution.
Hi jiannianli,
You can use the FGPIO to control the GPIO output and the read the input, or use the interrupt to read the PTD4 input, it will be more quick than your polling mode.
In fact, even you just toggle the GPIO output, it will also need the times, FGPIO toggle frequency can reach to the core clock /2.
Your test result time in fact include two part, detect the PTD4 time, and the GPIO output time. Obout the test IO output time, you can toggle it directly in the code and test it, then use your orginal test time minus the GPIO output time, it is your PTD4 detect time.
Wish it helps you!
If you still have questions about it, please kindly let me know!
Best Regards,
Kerry
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-----------------------------------------------------------------------------
the record picture are:
Hi Kalaimani ,
thanks for you reply.
the two picture show that Bx-Ax=9.6 us . I had make a new test pitcure ( put the two test into one picture ) . you can find that the different time is 1.88us ,and is too large for our project now.
Hi jiannianli,
You can use the FGPIO to control the GPIO output and the read the input, or use the interrupt to read the PTD4 input, it will be more quick than your polling mode.
In fact, even you just toggle the GPIO output, it will also need the times, FGPIO toggle frequency can reach to the core clock /2.
Your test result time in fact include two part, detect the PTD4 time, and the GPIO output time. Obout the test IO output time, you can toggle it directly in the code and test it, then use your orginal test time minus the GPIO output time, it is your PTD4 detect time.
Wish it helps you!
If you still have questions about it, please kindly let me know!
Best Regards,
Kerry
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-----------------------------------------------------------------------------
Hi Kerry,
thanks for your reply ,and maybe I know how to do . than you.
Hi jiannianli,
You are welcome!
If you have any new questions in the future, welcome to create the new question post. \
Best Regards,
Kerry