Clock - Time to on and off an output pin
#1
Posted 30 September 2010 - 01:58 PM
#2
Posted 30 September 2010 - 02:24 PM
#3
Posted 30 September 2010 - 03:17 PM
Hi GB30,
Your C# code is running at the managed code layer, so it's being interpreted by the .NET runtime...there is a lot going on behind the scenes. If you'd like to take advantage of the raw speed of the microcontroller, you can write your time-sensitive code in C++ (with a C# wrapper class) and compile it into the Netduino firmware.
You can also erase the Netduino and use C/C++ and SAM-BA for a fast 100% native code solution--but that sort of defeats the purpose of having .NET on there. We put the erase pad on the board so that it's fully "hackable."
Chris
Thank you for the response. Obviously there is a lot going on behind the scenes.
Is there an example of C# wrapper class?
#4
Posted 30 September 2010 - 03:22 PM
Please have a look at sweetlilmre's generic BitBanger. What exactly do you want to do?Is there an example of C# wrapper class?
#5
Posted 04 August 2011 - 06:47 PM
Hi GB30,
Your C# code is running at the managed code layer, so it's being interpreted by the .NET runtime...there is a lot going on behind the scenes. If you'd like to take advantage of the raw speed of the microcontroller, you can write your time-sensitive code in C++ (with a C# wrapper class) and compile it into the Netduino firmware.
You can also erase the Netduino and use C/C++ and SAM-BA for a fast 100% native code solution--but that sort of defeats the purpose of having .NET on there. We put the erase pad on the board so that it's fully "hackable."
Chris
I am trying to write code for my own Software I2C library and need very exacting timing of roughly 30 microseconds. I did the same thing using an oscilloscope, and got about 60 to 70 microseconds. I was wondering if there was a way I could get information on how I could edit/add a library in the firmware to support this.
I opened the firmware, and had no idea where to even begin, any help on this will be greatly appreciated.
#6
Posted 15 November 2011 - 06:03 PM
Hi GB30,
Your C# code is running at the managed code layer, so it's being interpreted by the .NET runtime...there is a lot going on behind the scenes. If you'd like to take advantage of the raw speed of the microcontroller, you can write your time-sensitive code in C++ (with a C# wrapper class) and compile it into the Netduino firmware.
You can also erase the Netduino and use C/C++ and SAM-BA for a fast 100% native code solution--but that sort of defeats the purpose of having .NET on there. We put the erase pad on the board so that it's fully "hackable."
Chris
AHA! That would explain the crazy times that I've been seeing!
int a, b, c; b = 2; c = 1; b++; // 0 micro seconds (us) a = b - c; // 21.4 us !! long tick = DateTime.Now.Ticks; // 149.3 us TimeSpan time = Utility.GetMachineTime(); // 64 us. NOTE: this is a faster timestamp than getting straight ticks
Good to know that we should only expect 1/1,000th of the performance that the cpu has.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users