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.

aballung

Member Since 15 May 2013
Offline Last Active May 22 2013 02:29 AM
-----

Posts I've Made

In Topic: maximize ADC sampling rate

20 May 2013 - 05:55 AM

I tried following these steps on this website:

http://adeneo-embedd...-framework.html

 

But I get this error:

An unhandled exception of type 'System.NotSupportedException' occurred in LEDInterop.dll

 

I'm not sure if I'm doing this right.  Do you have any advice on this?  Would this strategy increase the speed of the program?

 

 

Or if its easy enough, if somebody could translate this to native code for me :)

I see walkthroughs online, but can't seem to get them to work and none post the files to see how they actually did it.

Any help is appreciated.  I need this done for my thesis due in a couple weeks!

 

 

 

using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;
using System.IO;


namespace Thesis
{
  class FlashUtility
  {

  public class Program
  {

  public static void Main()
  {
  // write your code here


  using (var filestream = new FileStream(@"SDdata.txt", FileMode.Create))
  {
  const double maxVoltage = 3.3f;
  const double maxAdcValue = 4095;
  StreamWriter streamWriter = new StreamWriter(filestream);

  var voltagePort = new AnalogInput(Cpu.AnalogChannel.ANALOG_1);
  var lowPort = new OutputPort(Pins.GPIO_PIN_A0, false);
  var highPort = new OutputPort(Pins.GPIO_PIN_A2, true);
  var num = 0;

  while (true)
  {
  double rawValue = voltagePort.ReadRaw();
  if (rawValue > 500)
  {
  while (num < 30)
  {

  rawValue = voltagePort.ReadRaw();
  double value = (rawValue * maxVoltage) / maxAdcValue;
  Debug.Print(rawValue.ToString("f"));
  Thread.Sleep(1000); // 1 seconds
  num = num + 1;

  streamWriter.WriteLine(value.ToString("f"));

  }
  streamWriter.Close();
  break;
  }
  else
  {
  }
  }
  }

  }

  }
  }
}


In Topic: maximize ADC sampling rate

17 May 2013 - 07:59 PM

Thank you for your response. How do you go about writing and implementing native code?  I just need the N2+ to sample at about 2MSPS and store it into memory.  Do you have any suggestions?

 

Angelo


In Topic: ADC

17 May 2013 - 07:15 PM

Where do you find the built-in ADC native source code to edit? I need the ADC to sample at >2MSPS.

 

Angelo


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.