Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

many Interrupt unexplained problem!


  • Please log in to reply
No replies to this topic

#1 Alex3com

Alex3com

    New Member

  • Members
  • Pip
  • 7 posts

Posted 20 October 2014 - 09:43 AM

Can anyone explain me why I get 'System.ArgumentException' in Microsoft.SPOT.Hardware.dll???

 

I get the exception in:

sel_4.OnInterrupt += new NativeEventHandler(sel_4_OnInterrupt);

 

I use the 4.3 framework on netduino 2 plus.

 

If i try to delete the line...I'll get the exception on the next  :wacko: !

 

How many interupt can manage the netduino??

 

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

namespace Saldatrice
{
    public class Program
    {
        const int max_frequency = 1000;

        private static OutputPort Pin_motore    = new OutputPort(Pins.GPIO_PIN_D6, false);
        private static OutputPort Pin_enable    = new OutputPort(Pins.GPIO_PIN_D5, false);
        private static OutputPort Pin_direzione = new OutputPort(Pins.GPIO_PIN_D7, false);
        private static OutputPort Pin_rele      = new OutputPort(Pins.GPIO_PIN_D4, false);

        private static InputPort Pin_man_dx = new InputPort(Pins.GPIO_PIN_D11, false, Port.ResistorMode.PullDown);
        private static InputPort Pin_man_sx = new InputPort(Pins.GPIO_PIN_D10, false, Port.ResistorMode.PullDown);

        private static int selettore = 0;
        private static int[] Array_velocita = new int[10];

        private static AnalogInput Pin_vel = new AnalogInput(Cpu.AnalogChannel.ANALOG_0);

        public static int total_passi = 0;
        public static int passi_inizio = 0;
        public static int passi_fine = 0;
        //true devo memorizzare inizio
        //false devo memorizzare fine
        public static bool mem_inizio = true;

       
        public static void Main()
        {
            InterruptPort Pin_avvio_prog = new InterruptPort(Pins.GPIO_PIN_D13, false, Port.ResistorMode.PullDown, Port.InterruptMode.InterruptEdgeHigh);
            Pin_avvio_prog.OnInterrupt += new NativeEventHandler(Pin_avvio_prog_OnInterrupt);
            
            InterruptPort Pin_mem_pos = new InterruptPort(Pins.GPIO_PIN_D12, false, Port.ResistorMode.PullDown, Port.InterruptMode.InterruptEdgeHigh);
            Pin_mem_pos.OnInterrupt += new NativeEventHandler(Pin_mem_pos_OnInterrupt);
            
            InterruptPort Pin_mem_vel = new InterruptPort(Pins.GPIO_PIN_D9, false, Port.ResistorMode.PullDown, Port.InterruptMode.InterruptEdgeHigh);
            Pin_mem_vel.OnInterrupt += new NativeEventHandler(Pin_mem_vel_OnInterrupt);
            
            InterruptPort sel_1 = new InterruptPort(Pins.GPIO_PIN_D8, false, Port.ResistorMode.PullDown, Port.InterruptMode.InterruptEdgeHigh);
            sel_1.OnInterrupt += new NativeEventHandler(sel_1_OnInterrupt);
            
            InterruptPort sel_2 = new InterruptPort(Pins.GPIO_PIN_D3, false, Port.ResistorMode.PullDown, Port.InterruptMode.InterruptEdgeHigh);
            sel_2.OnInterrupt += new NativeEventHandler(sel_2_OnInterrupt);
            
            InterruptPort sel_3 = new InterruptPort(Pins.GPIO_PIN_D2, false, Port.ResistorMode.PullDown, Port.InterruptMode.InterruptEdgeHigh);
            sel_3.OnInterrupt += new NativeEventHandler(sel_3_OnInterrupt);
            
            InterruptPort sel_4 = new InterruptPort(Pins.GPIO_PIN_D1, false, Port.ResistorMode.PullDown, Port.InterruptMode.InterruptEdgeHigh);
            sel_4.OnInterrupt += new NativeEventHandler(sel_4_OnInterrupt);
            
            InterruptPort sel_5 = new InterruptPort(Pins.GPIO_PIN_D0, false, Port.ResistorMode.PullDown, Port.InterruptMode.InterruptEdgeHigh);
            sel_5.OnInterrupt += new NativeEventHandler(sel_5_OnInterrupt);
            
            InterruptPort sel_6 = new InterruptPort(Pins.GPIO_PIN_A1, false, Port.ResistorMode.PullDown, Port.InterruptMode.InterruptEdgeHigh);
            sel_6.OnInterrupt += new NativeEventHandler(sel_6_OnInterrupt);
            
            InterruptPort sel_7 = new InterruptPort(Pins.GPIO_PIN_A2, false, Port.ResistorMode.PullDown, Port.InterruptMode.InterruptEdgeHigh);
            sel_7.OnInterrupt += new NativeEventHandler(sel_7_OnInterrupt);
            
            InterruptPort sel_8 = new InterruptPort(Pins.GPIO_PIN_A3, false, Port.ResistorMode.PullDown, Port.InterruptMode.InterruptEdgeHigh);
            sel_8.OnInterrupt += new NativeEventHandler(sel_8_OnInterrupt);
            
            InterruptPort sel_9 = new InterruptPort(Pins.GPIO_PIN_A4, false, Port.ResistorMode.PullDown, Port.InterruptMode.InterruptEdgeHigh);
            sel_9.OnInterrupt += new NativeEventHandler(sel_9_OnInterrupt);
            
            InterruptPort sel_10 = new InterruptPort(Pins.GPIO_PIN_A5, false, Port.ResistorMode.PullDown, Port.InterruptMode.InterruptEdgeHigh);
            sel_10.OnInterrupt += new NativeEventHandler(sel_10_OnInterrupt);
            
            int i=0;
            while (true)
            {
                Debug.Print(i.ToString());
                i++;
                if (i > 100)
                { i = 0; }
                System.Threading.Thread.Sleep(2000);
            }
        }

 






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.