如何判断两个引脚第一个上升沿的时间差How to judge the time difference between the first rising edge of two pins

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

如何判断两个引脚第一个上升沿的时间差How to judge the time difference between the first rising edge of two pins

134 Views
smallyang
Contributor III

smallyang_0-1715152426541.png

smallyang_1-1715152660378.png

 

请问我需要判断GPIO126和GPIO127这两个引脚第一个上升沿的时间差(这个时间很短),一般可以用什么方法呢?

 

May I ask if I need to judge the time difference between  the first rising edge of the two pins GPIO126 and GPIO127 (this time is very short), what method can be used in general?

0 Kudos
Reply
1 Reply

101 Views
smallyang
Contributor III

这两个引脚在我们样机运行时​外部分别输入了两个高电平进来,因为这两个引脚不是同时变高的,我们想用软件判断两个引脚变成高电平的时间差,有什么简单的办法吗?我目前是用一个1us的中断计数累加,当采到一个引脚变高时清除计数,当另一个引脚也变高时,计数器的值乘1us就是时间差。但是这个办法会有大于2us的误差。

 

Hello, when our prototype is running, these two pins input two high levels respectively, because these two pins do not become high at the same time, we want to use the software to determine the time difference between the two pins to become high levels, is there any simple way? I am currently using a 1us interrupt count accumulation, clearing the count when one pin becomes higher, when the other pin also becomes higher, the counter value multiplied by 1us is the time difference. But this method has an error of more than 2us.

 

smallyang_0-1715328728725.pngsmallyang_1-1715328776458.png

 

0 Kudos
Reply