回复帖子:(qzl)9280 板子的GPIO管脚控制LED,翻转,运行...

用户名:   *您没有注册?
密码:   *忘记论坛密码?    标题采用“回复:XXX....”
验证码 点击获取验证码
主题标题:  *不得超过 200 个汉字
当前心情
上一页 发帖表情 下一页
内容
  

主题最新回顾(发布时间:2014-8-19 16:58:00)
--  作者:x10(118.112.*.*)
--  
谢谢分享你的调试过程。

主题最新回顾(发布时间:2014-8-19 15:05:00)
--  作者:qzl
--  
句柄提前释放了

主题最新回顾(发布时间:2014-8-19 15:05:00)
--  作者:qzl
--  
找到原因了

主题最新回顾(发布时间:2014-8-19 12:38:00)
--  作者:qzl
--  9280 板子的GPIO管脚控制LED,翻转,运行一段时间后就不能正常控制了。
9280 板子的GPIO管脚控制LED,翻转,开始10来秒正常控制翻转,闪烁。
运行一段时间后就不能正常控制了,函数调用返回值为FALSE。下面2个函数都是一样的返回false.

public static bool GPIO_OutSet(int hISA_DIO, uint dwSetBits)
        {
            byte[] lpInBuf = BitConverter.GetBytes(dwSetBits);
            uint lpBytesReturned = 0;
            if (!DeviceIoControl(hISA_DIO,            // file handle to the driver
                    GPIO_IOCTL_OUT_SET,                // I/O control code
                    lpInBuf,    // in buffer
                    sizeof(uint),              // in buffer size
                    null,        // out buffer
                    0, // out buffer size
                    ref lpBytesReturned, // pointer to number of bytes returned
                    IntPtr.Zero))        // ignored (=NULL)
                {
                return false;
                } 
            return true;
        }

        public static bool GPIO_OutClear(int hISA_DIO, uint dwClearBits)
        {
            byte[] lpInBuf = BitConverter.GetBytes(dwClearBits);
            uint lpBytesReturned = 0;
            if (!DeviceIoControl(hISA_DIO,            // file handle to the driver
                    GPIO_IOCTL_OUT_CLEAR,            // I/O control code
                    lpInBuf,        // in buffer
                    sizeof(uint),              // in buffer size
                    null,        // out buffer
                    0, // out buffer size
                    ref lpBytesReturned, // pointer to number of bytes returned
                    IntPtr.Zero))        // ignored (=NULL)
            {
                return false;
            }
            return true;
        }