Minor issue for EnableInterrupt() / uart question

Hi,

  1. this code silently crashes Panda II (SDK Version 1.0.14 ) but not the emulator:

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.FEZ;
namespace myprog
{
  public class Program
  {
    private static InterruptPort _Port;
    private static NativeEventHandler _Interrupt;
    public static void Main()
    {
      _Interrupt = new NativeEventHandler(InterruptHandler);
      _Port = new InterruptPort((Cpu.Pin)FEZ_Pin.Interrupt.Di43, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);
      //_Port.OnInterrupt += _Interrupt;
      _Port.EnableInterrupt();
      while (true)
      {
        Thread.Sleep(5000);
      }
    }
    private static void InterruptHandler(uint Port, uint State, DateTime time)
    {
    }
  }
}


the program simply exits after EnableInterrupt() .
i know thats a bad idea to enable interrupt without ISR, but i guess it should be possible to add/remove
delegates at all times.

  1. uart question

is it possible to use uarts as digital input samplers?
i mean to scan a bitstream by an uart “as is” at a specified baudrate (without taking start/stop/parity bits into account)
and to fetch received bytes.
it would be nice to reverse this operation.

thanks for help

please keep unrelated posts separate.

  1. we will look into it but this wrong anyway, enabling interrupt on a on-isr pin

  2. Why do you need this?! Why not use PinCapture?

thanks Gus , i’m sorry for mixing topics.

  1. You are right, the example is useless. however the program should continue to run or throw an exeption.
    thanks again for looking into it. lets close this topic and continue to:

  2. Because PinCapture blocks all managed threads.
    I would like to scan/send ir-codes by delegating all time-critical work to the uart.
    Standard 19200 baudrate (= 52 microseconds reslution) should be OK.

I still don’t understand the need but you can write an RLP driver that fires a kernel mode task 9600 times a second then sample a pin and fill an array. This will be like PinCapture but not blocking.

thanks, i will try RLP :slight_smile: