Friday, 12 September 2014

Arduino / Processing versus .NET Micro Framework? Best language? Best hardware?


I've been messing around with Arduino for a while now, and I'm in the process of moving from beginner to intermediate. I'd like some opinions on the .NET Micro Framework, in terms of performance and hardware availability.


I'm a .NET programmer, but I've found Processing for Arduino to be pretty much zero friction... It's so close to C# that anything I want to do doesn't even require a trip to the documentation.


Anyhow, which is better?



Answer



If you want to move from beginner to intermediate, the language you need to learn is C. Even if you put the whole Windows lock-in debate aside, you need to be very good at programming in C before you can do quality work on a microcontroller in a higher level language like .NET Micro or C++.


Embedded systems are composed of a pyramid of knowledge, and you really need to know at least some of each step to be a good designer:
^User code

^^Operating systems
^^^The C language
^^^^Assembly language
^^^^^Microcontroller architecture
^^^^^^Digital design
^^^^^^^Semiconductors
^^^^^^^^Basic electronics (Ohm's law)


The Arduino framework provides a convenient hook for hobbyists into the pyramid somewhere between the C language and an operating system.


Specific to your the .NET Micro Framework question, the About says:




The typical .NET Micro Framework device has a 32 bit processor with no external memory management unit (MMU) and could have as little as 64K of random-access memory (RAM).



Also, the brochure differentiates it from Windows Mobile, Windows Embedded, CE 6.0, and the .NET Compact Framework, and compares it to Linux, Real-Time, Java, and custom operating systems. This is a huge jump from the Arduino/Processing framework.


Your Arduino has an 8-bit processor with 1k of RAM. In addition to the 8-bit vs. 32-bit power loss, it also runs less than half as fast as most of the listed processors. While I wouldn't discourage you from moving to a 32-bit processor, I would recommend it as an intermediate-to-advanced move.


It's really easy to use up a lot of time and memory with a few lines in C# or C++, which are insignificant on a dual core processor running at a couple gigahertz with gigabytes of RAM, but which can make a huge difference on an embedded device. Until you are good in assembly language and/or C, or a guru in C# or C++, I wouldn't recommend using it for embedded programming.


So, I'd start with downloading WinAVR, and program a simple LED blink routine in C. If C is totally confusing to you, do a little bit of native code ("Hello World") on your PC, and then move to the microcontroller, but that shouldn't be necessary. Next, move up to communication over the UART, start using interrupts, and redo some of your Arduino projects in C. Then, find (or make!) a new development board with a different microcontroller, maybe a PIC or an ARM, and some goodies like an LCD screen, Ethernet, SD card, or whatever you want, and try to learn a new system. Once you get there, you'll know better where you want to go.


We'll be here to help you along the way!


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...