Cypress技术论坛
直播中

徐凤

8年用户 219经验值
私信 关注
[问答]

PIN检测只有在上升和下降之间的时间非常小才能够工作

大家好,
我有一个小问题,我用一个PIN来检测两个方面,比如在前面,我的变量取1,在前面,我的变量取0。
但只有在上升和下降之间的时间非常小,比如3 /4min,我才能够工作,但是我希望它能在1小时前和前的时间内工作。
以下是我的代码:
CysISR(SW2L处理程序)
{
如果(SW2a读())=0)
{
分支=1;
PixGrimyLo写(on);
}
否则,如果(SW2Bad Read()= 1)
{
分支=0;
循环=循环+ 1;
PixGrimIn写(OFF);
}
SW2~清除中断();
}
你能帮帮我吗?
谢谢

以上来自于百度翻译


     以下为原文
  Hi everyone,

I've got a little problem, i use one pin to detect two fronts, like that in a up front my variable take 1 , and on the down front my variable take 0.
But that only works when the time between up&down are very small like 3/4min but i want it to work with a time between up and front of 1 Hour.

Here is my code :

CY_ISR (SW2_Handler)
{
    if (SW2_Read()==0)
    {
        branchement=1;
        Pin_Green_Write(ON);
    }
    else if (SW2_Read()==1)
    {
        
        branchement=0;
        cycles=cycles+1;
        Pin_Green_Write(OFF);
      }
    SW2_ClearInterrupt();
}

Could you help me ?

thanks

回帖(5)

王琳

2018-12-12 14:36:08
您是否配置了PIN驱动模式作为开漏驱动高或低?否则,当您的开关是打开的,没有真正的信号上的引脚读取。
鲍勃

以上来自于百度翻译


     以下为原文
  Did you configure the pin drive mode as open drain driving high or low? Otherwise when your switch is open there is no real signal on the pin to read.
 
Bob
举报

徐凤

2018-12-12 14:52:24
引用: ncmza 发表于 2018-12-12 15:19
您是否配置了PIN驱动模式作为开漏驱动高或低?否则,当您的开关是打开的,没有真正的信号上的引脚读取。
鲍勃

它被配置在一个强大的驱动器上。
但我不知道这个问题是不是来自那个。我检测所有的上升和下降,但只有当一个上升时间和一个下降时间少于4分钟。

以上来自于百度翻译


     以下为原文
  It was configured on a Strong drive.
But i don't know if the problem come from that. I detect all the up&down front but only when the time between an Up and a Down are less than 4 minutes.
举报

王琳

2018-12-12 15:02:53
引用: jijjwkfs 发表于 2018-12-12 15:35
它被配置在一个强大的驱动器上。
但我不知道这个问题是不是来自那个。我检测所有的上升和下降,但只有当一个上升时间和一个下降时间少于4分钟。

能否请您发布您的完整项目,以便我们都可以看看您的所有设置。为此,使用
创建者-gt;文件& gt;创建工作区束(最小)
并附加生成的文件。外部连接的一些示意图将是有益的。
请用“正面”这个词来解释你的意思,我不知道这意味着什么。
鲍勃

以上来自于百度翻译


     以下为原文
  Can you please post your complete project so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file. Some schematic for the external connections would be helpful.
And please explain what you mean with the word "front", I don't know what it means in this context.
 
Bob
举报

徐凤

2018-12-12 15:12:35
引用: ncmza 发表于 2018-12-12 15:46
能否请您发布您的完整项目,以便我们都可以看看您的所有设置。为此,使用
创建者-gt;文件& gt;创建工作区束(最小)
并附加生成的文件。外部连接的一些示意图将是有益的。

嘿,
原谅我前面的语言,我指的是边、边和上升边(上下)。
CyWrk.CaseV01.Zip
1.2兆字节

以上来自于百度翻译


     以下为原文
  Hey,
 
Excuse me for my language by front i mean edge, falling and rising edge (up & down).


举报

更多回帖

发帖
×
20
完善资料,
赚取积分