Every time I try to upload the diagram, I get an error saying that "no file was selected for upload." Is this a common problem on the forums?
- Netduino Forums
- → WriterGuy's Content
WriterGuy's Content
There have been 10 items by WriterGuy (Search limited from 06-June 23)
#64638 Interrupt Port Ghosts
Posted by WriterGuy on 10 December 2015 - 07:01 PM in Netduino Plus 2 (and Netduino Plus 1)
#64650 Interrupt Port Ghosts
Posted by WriterGuy on 14 December 2015 - 07:17 PM in Netduino Plus 2 (and Netduino Plus 1)
KiwiDev,
Thanks for the reply. I actually just went the Thread.Sleep route because I wasn't having luck with the timers. Would setting up a timer for each of my 6 interrupts be relatively easy or would it be adding a lot of extra code?
#64654 Interrupt Port Ghosts
Posted by WriterGuy on 17 December 2015 - 04:36 PM in Netduino Plus 2 (and Netduino Plus 1)
I was able to fix the problem by adding .1uF capacitors between the interrupt port pins used and ground. This seemed to stabilize the circuit and there are no random flashing lights at all! Thanks to all that helped out!
#64655 Interrupt Port Ghosts
Posted by WriterGuy on 18 December 2015 - 03:39 PM in Netduino Plus 2 (and Netduino Plus 1)
Unfortunately, I had to unsolve my problem. Replacing all the components back into my case seems to have brought my phantom flashing LEDs back from the grave. The capacitors are in place and making good connection, its just something about having everything together inside the case is triggering the issue anyway.
#64635 Interrupt Port Ghosts
Posted by WriterGuy on 10 December 2015 - 03:59 PM in Netduino Plus 2 (and Netduino Plus 1)
I seem to be unable to upload any files. Any time I select my file to upload, it loads for a second and then says that "no file was selected for upload". Is this a common problem on the forum?
#64629 Interrupt Port Ghosts
Posted by WriterGuy on 09 December 2015 - 06:03 PM in Netduino Plus 2 (and Netduino Plus 1)
Hello all,
I am working on a project with my Netduino Plus 2. I am encountering a strange problem.
In a nutshell, the device I'm designing is running tests on a circuit board to check for functionality. I am using the Netduino to send signals to this board. I have 6 push-buttons that trigger interrupts which send certain signals to the board being tested. If the correct level is detected at this board's output pin, a corresponding LED is turned on. If an incorrect level is detected, the LED is flashed. The interrupt ports are interruptedgehigh with accompanying pull down resistors. The N+2 is being powered by 8 volts coming from a power supply circuit which itself is powered with your basic 120VAC.
The board I am testing requires 120VAC to be sent through 4 paths one at a time. This tests functionality of the components located on that particular path. So I have 4 line/neutral pairs sent to the board. But since the paths must be run one at a time, I have each line switched. This way, when I want to run the AC line tests, I flip line switch 1, press the test's push-button to trigger the interrupt which runs the test, and then check the test results via the LED.
using System; using System.Net; using System.Net.Sockets; using System.Diagnostics; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.Netduino; namespace TLS_350_Pump_Sense_Module_Test_Program { public class Program { private static InterruptPort LT1Switch = new InterruptPort(Pins.GPIO_PIN_D6, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeHigh); private static InterruptPort LT2Switch = new InterruptPort(Pins.GPIO_PIN_D7, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeHigh); private static InterruptPort LT3Switch = new InterruptPort(Pins.GPIO_PIN_D2, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeHigh); private static InterruptPort LT4Switch = new InterruptPort(Pins.GPIO_PIN_D3, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeHigh); private static InterruptPort TransTestSwitch = new InterruptPort(Pins.GPIO_PIN_D5, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeHigh); private static InterruptPort U1TestSwitch = new InterruptPort(Pins.GPIO_PIN_D4, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeHigh); private static OutputPort J1pin3 = new OutputPort(Pins.GPIO_PIN_D0, false); private static InputPort J1pin4 = new InputPort(Pins.GPIO_PIN_D13, true, Port.ResistorMode.Disabled); private static OutputPort J1pin5 = new OutputPort(Pins.GPIO_PIN_D9, false); private static OutputPort J1pin7 = new OutputPort(Pins.GPIO_PIN_D10, false); private static OutputPort J1pin9 = new OutputPort(Pins.GPIO_PIN_D11, false); private static OutputPort J1pin10 = new OutputPort(Pins.GPIO_PIN_D12, true); private static OutputPort LT1LED = new OutputPort(Pins.GPIO_PIN_D8, false); private static OutputPort LT2LED = new OutputPort(Pins.GPIO_PIN_A1, false); private static OutputPort LT3LED = new OutputPort(Pins.GPIO_PIN_A2, false); private static OutputPort LT4LED = new OutputPort(Pins.GPIO_PIN_A3, false); private static OutputPort TTLED = new OutputPort(Pins.GPIO_PIN_A4, false); private static OutputPort U1TLED = new OutputPort(Pins.GPIO_PIN_A5, false); private static DateTime lastEvent = DateTime.Now; public static double ReadRaw() { AnalogInput TransistorTest = new AnalogInput(AnalogChannels.ANALOG_PIN_A0); const double maxVoltage = 3.3; const int maxADCValue = 4095; double rawValue = TransistorTest.ReadRaw(); TransistorTest.Dispose(); double voltagevalue = (rawValue * maxVoltage) / maxADCValue; double realworldvalue=(((voltagevalue - 0.5) * 1000) / 10) - 4; return voltagevalue; } public static void Main() { TransTestSwitch.OnInterrupt += new NativeEventHandler(TransTestSwitch_OnInterrupt); LT1Switch.OnInterrupt += new NativeEventHandler(LT1Switch_OnInterrupt); LT2Switch.OnInterrupt += new NativeEventHandler(LT2Switch_OnInterrupt); LT3Switch.OnInterrupt += new NativeEventHandler(LT3Switch_OnInterrupt); LT4Switch.OnInterrupt += new NativeEventHandler(LT4Switch_OnInterrupt); U1TestSwitch.OnInterrupt += new NativeEventHandler(U1TestSwitch_OnInterrupt); Debug.Print(ReadRaw().ToString("f")); Thread.Sleep(300); Thread.Sleep(Timeout.Infinite); } static void U1TestSwitch_OnInterrupt(uint data1, uint data2, DateTime time) { J1pin3.Write(false); J1pin5.Write(true); J1pin7.Write(false); J1pin4.Read(); U1TestSwitch.ClearInterrupt(); if (time.AddMilliseconds(-500) > lastEvent) { lastEvent = time.AddMilliseconds(500); if (J1pin4.Read() == true) { U1TLED.Write(true); } else { int U1number = 7; for (int i = 0; i < U1number; i++) { U1TLED.Write(true); Thread.Sleep(200); U1TLED.Write(false); Thread.Sleep(200); } } } } static void TransTestSwitch_OnInterrupt(uint data1, uint data2, DateTime time) { J1pin3.Write(true); J1pin5.Write(true); J1pin7.Write(true); J1pin9.Write(true); ReadRaw(); TransTestSwitch.ClearInterrupt(); if (time.AddMilliseconds(-500) > lastEvent) { lastEvent = time.AddMilliseconds(500); if (ReadRaw() > 2.4 && ReadRaw() <= 2.7) { TTLED.Write(true); Debug.Print(ReadRaw().ToString("f")); Thread.Sleep(300); } else { int Tnumber = 7; for (int i = 0; i < Tnumber; i++) { TTLED.Write(true); Thread.Sleep(200); TTLED.Write(false); Thread.Sleep(200); } } } } static void LT1Switch_OnInterrupt(uint data1, uint data2, DateTime time) { J1pin3.Write(false); J1pin5.Write(false); J1pin7.Write(false); J1pin4.Read(); LT1Switch.ClearInterrupt(); if (time.AddMilliseconds(-500) > lastEvent) { lastEvent = time.AddMilliseconds(500); if (J1pin4.Read() == false) { LT1LED.Write(true); } else { int L1number = 7; for (int i = 0; i < L1number; i++) { LT1LED.Write(true); Thread.Sleep(200); LT1LED.Write(false); Thread.Sleep(200); } } } } static void LT2Switch_OnInterrupt(uint data1, uint data2, DateTime time) { J1pin3.Write(true); J1pin5.Write(false); J1pin7.Write(false); J1pin4.Read(); LT2Switch.ClearInterrupt(); if (time.AddMilliseconds(-500) > lastEvent) { lastEvent = time.AddMilliseconds(500); if (J1pin4.Read() == false) { LT2LED.Write(true); } else { int L2number = 7; for (int i = 0; i < L2number; i++) { LT2LED.Write(true); Thread.Sleep(200); LT2LED.Write(false); Thread.Sleep(200); } } } } static void LT3Switch_OnInterrupt(uint data1, uint data2, DateTime time) { J1pin3.Write(false); J1pin5.Write(true); J1pin7.Write(false); J1pin4.Read(); LT3Switch.ClearInterrupt(); if (time.AddMilliseconds(-500) > lastEvent) { lastEvent = time.AddMilliseconds(500); if (J1pin4.Read() == false) { LT3LED.Write(true); } else { int L3number = 7; for (int i = 0; i < L3number; i++) { LT3LED.Write(true); Thread.Sleep(200); LT3LED.Write(false); Thread.Sleep(200); } } } } static void LT4Switch_OnInterrupt(uint data1, uint data2, DateTime time) { J1pin3.Write(true); J1pin5.Write(true); J1pin7.Write(false); J1pin4.Read(); LT4Switch.ClearInterrupt(); if (time.AddMilliseconds(-500) > lastEvent) { lastEvent = time.AddMilliseconds(500); if (J1pin4.Read() == false) { LT4LED.Write(true); } else { int L4number = 7; for (int i = 0; i < L4number; i++) { LT4LED.Write(true); Thread.Sleep(200); LT4LED.Write(false); Thread.Sleep(200); } } } } } }
#64142 Interrupts
Posted by WriterGuy on 18 September 2015 - 11:32 AM in Netduino Plus 2 (and Netduino Plus 1)
Thanks for the reply Chris!
1. Indeed I am looking to check the interrupt state. I am wanting to have the interrupt end and return to main whenever the I turn the switch associated with that interrupt off. In my readings I haven't ever come across how to check the interrupt state.
2. The interrupts are designed to run the tests. They are simple "Are they working or are they not" type tests, so it should be as simple as flipping the switch, checking if the LED is lit or flashing, and then flipping the switch back off.
#64169 Interrupts
Posted by WriterGuy on 21 September 2015 - 03:54 PM in Netduino Plus 2 (and Netduino Plus 1)
Thanks for all the feedback guys! I'm starting to get on the right track.
I still have a question about my while loop though. Basically, in my interrupt, if J1pin4 reads true, U1TLED is set to true and the LED will light. However, I am looking to continuously blink the LED if false is read at J1pin4. I figured a while loop would be best to use for this, but I'm not sure if the way I have it set up is just going to put me in a continuous loop.
else if (J1pin4.Read() == false) { while (J1pin4.Read() == false) { U1TLED.Write(true); Thread.Sleep(100); U1TLED.Write(false); Thread.Sleep(100); if (U1TestSwitch.Interrupt == Port.InterruptMode.InterruptEdgeLow) { break; } } }
#64173 Interrupts
Posted by WriterGuy on 21 September 2015 - 07:04 PM in Netduino Plus 2 (and Netduino Plus 1)
Nevyn,
Thanks for the idea. I want to try this, but my program doesn't recognize Timers. Apparently, my VS2010 does not have system.dll referenced and I can't find the file to add it. Is there a way to perform the timer task without using the Timers namespace?
#64133 Interrupts
Posted by WriterGuy on 16 September 2015 - 07:17 PM in Netduino Plus 2 (and Netduino Plus 1)
Hello all,
I'm working on a project using the Netduino Plus 2. I am trying to run a series of tests on the components of a circuit board, and am looking to control each test using interrupts triggered by switches. In all, I have 6 tests (and subsequently 6 switches with 6 interrupts).
Here's where my current issue lies:
I am having the Netduino light LED's upon successful completion of each test. If the test is unsuccessful, I blink the LED. My program enters the interrupt when the switch is flipped and lights (or flashes) the LED, but when I flip the switch back off, the LED remains lit (or stays flashing). Essentially, the LED behavior continues even after I turn off the switch to the test.
A) I am wondering if I am not exiting the interrupt properly.
I am also wondering if my set up involving the blinking LED is the correct route to take, or if I have just simply set myself up for an endless loop.
The following is a sample of one of my interrupts. Any help would be much appreciated!
static void U1TestSwitch_OnInterrupt(uint data1, uint data2, DateTime time) { J1pin3.Write(false); J1pin5.Write(false); J1pin7.Write(false); J1pin4.Read(); if (J1pin4.Read() == true) { U1TLED.Write(true); } else if (J1pin4.Read() == false) { while (J1pin4.Read() == false) { U1TLED.Write(true); Thread.Sleep(100); U1TLED.Write(false); Thread.Sleep(100); if (U1TestSwitch.Interrupt == Port.InterruptMode.InterruptEdgeLow) { break; } } } if (U1TestSwitch.Interrupt == Port.InterruptMode.InterruptEdgeLow) { U1TLED.Write(false); U1TestSwitch.ClearInterrupt(); } }
- Netduino Forums
- → WriterGuy's Content
- Privacy Policy