如何使用中断通过硬件IO端口启用和检测中断 [英] How can I enable and detect interrupts with hardware IO ports using interrupts

查看:98
本文介绍了如何使用中断通过硬件IO端口启用和检测中断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨;
我的程序正在从硬件(通过串行端口)接收数据.我想逐字节获取它.
如何检测何时数据来自IO端口?我想使用硬件中断",但我做不到.

Hi;
My program is receiving data from hardware(By means of Serial Port).I wanna get it Byte by Byte.
How can I detect when datas come from IO ports? I wanted to use "Hardware Interrupts" but I couldnt do it. Would you please help me how to do it?

推荐答案

此处 a> [ ^ ].
The System.IO.Ports.SerialPort[^] class provides a DataReceived event. It fires when data is received, as the name implies.

Subscribing a method to this event, you can then process the data byte-by-byte.

For an article on using the SerialPort, start here[^].


对不起,我不明白你说的话.能否请您描述一下?
Sorry,I didnt understand what you said.Could you please describe more?


这篇关于如何使用中断通过硬件IO端口启用和检测中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆