처음에는 내가 필요로하는 인터럽트 주파수를 얻기 위해 번개 드라이버를 사용해야 할 것으로 생각됩니다. 표준받은 편지함 드라이버가 내가 필요한 것에 적합하다는 것이 밝혀졌습니다.
내가 10,000 Hz에서의 속도로 펄스를 보낼 것이다 간단한 아두 이노 스케치를 만든 : 여기
내 상황을 재현하는 단계입니다.
int dataPin = 12;
void setup() {
pinMode(dataPin, OUTPUT);
}
void loop() {
int count = 0;
while (count < 400)
{
//pulse
digitalWrite(dataPin, HIGH);
digitalWrite(dataPin, LOW);
//This delay presumably makes the pulse be 10000 Hz
delayMicroseconds(100);
count++;
}
delay(5000);
}
페이지 중앙에 TextBlock이있는 간단한 UI로 UWP 앱을 만들었습니다.
public sealed partial class MainPage : Page
{
private GpioController gpio;
private const int inputPinNumber = 17;
private GpioPin inputPin;
private int count;
private I2cController i2cController;
private SpiController spiController;
public MainPage()
{
this.InitializeComponent();
this.Setup();
}
private void Setup()
{
if (LightningProvider.IsLightningEnabled)
{
LowLevelDevicesController.DefaultProvider = LightningProvider.GetAggregateProvider();
}
this.gpio = GpioController.GetDefault();
this.inputPin = this.gpio.OpenPin(inputPinNumber);
if (this.inputPin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
{
this.inputPin.SetDriveMode(GpioPinDriveMode.InputPullUp);
}
else
{
this.inputPin.SetDriveMode(GpioPinDriveMode.Input);
}
this.inputPin.ValueChanged += InputPinOnValueChanged;
}
private void InputPinOnValueChanged(GpioPin sender, GpioPinValueChangedEventArgs args)
{
var task = Dispatcher.RunAsync(CoreDispatcherPriority.Normal,() => {
if (args.Edge == GpioPinEdge.FallingEdge)
{
this.count++;
this.CountBlock.Text = this.count.ToString();
}
else
{
}
});
}
}
}
직접 메모리 매핑 드라이버를 사용하도록 Windows IoT를 설정하십시오.
다음 단계는 Arduino의 핀을 트랜지스터를 통해 Pi의 핀과 연결하는 것입니다. 필자는 Pi의 GPIO 핀에 내장 된 Pull-Up 레지스터를 이용할 수 있도록이 작업을 수행했습니다.
동시에 두 응용 프로그램을 실행할 때마다 사이클 당 약 30 개의 펄스 만 수집했습니다.
Windows IoT 설정으로 돌아가서 드라이버를받은 편지함 드라이버로 다시 설정하고 두 응용 프로그램을 모두 다시 보내십시오. 이번에 나는 맥박을 놓치지 않았다.
결론적으로받은 편지함 드라이버는 문제없이 최대 10khz를 제공하기에 충분해야합니다.
나는 arduino가있는 테스트를 실행하여 Pi에서 펄스를 누르고 결과를 확인하려고합니다. 나는 그들을 한 번 공유 할 것이다. –