C# (C Sharp):

Programming is a fascinating activity.
It encourages our logical and creative thinking.
It's fun and produces a sense of achievement.
Doing it as a profession you can also earn money. But in any case, being creative gives you satisfaction.
Yes you certainly can program/develop software only for fun, as a hobby, to train your brain, or because you are curious or enthusiastic.
And, last but not least, software written by yourself often does what you want. That's very rare in life.
A programming language must be accurate, complete, and unambiguous.
With such a defined language you can create an algorithm.
An algorithm is a series of operations which manipulates data.
A program is a concrete representation of an algorithm.
The realization of an algorithm in a programming language is called implementation.
Programming is the creation of an algorithm for a specific task.
The year is 2011. Programming in high level languages (HLLs) is state of the art.
In contrast to Assembly/Assembler languages HLLs are easier to read, to maintain, and to reuse.
Arguments for and against the use of Assembly languages versus HLLs were a tedious issue over the last 20 years.
Fortunately it isn't an issue anymore - even in areas like Microcontrollers, and Embedded Systems.
Looking at the transition from “old” programming languages like C [1973] and C++ (C plus plus) [1983] to “new” managed (managed code, Garbage Collector, and unsafe: Pointer) programming languages like Java [1995] and C# (C Sharp) [2000] we have to acknowledge, that for someone who starts programming, everything is considerably easier and the resulting programs are more error-free and therefore are more secure.
(Evolution of Computer Languages.)

By the way, you do not learn to program by reading, rather by programming, programming, and again programming.
Therefore, I created a few programming examples:


**************************************
STRG + K + C -> Kommentar
STRG + K + U -> Kein Kommentar
STRG + K + D -> Dokument neu formatieren
STRG + SPACE -> Vervollständigen
**************************************

Source: ; Executable: ; // Sending Emails
Source: ; Executable: ; // Sending Emails Periodically
Source:
; Executable: ; // One-armed Bandit
Sources: v1: v2: v3: ; Executables: v1: v2: v3:; // Painting Pictures
Source: ; Executables: ; // Painting Pictures + boarder/frame for every figure painted
Sources: v1: v2:
; Executables: v1: v2: ; // Lists all Files and File Directories
Sources: v1: v2:
; Executables: v1: v2: ; // Lists all Files and File Directories + more statistics - using a Dictionary: Dictionary<TKey, TValue>
Sources: v1:
; Executables: v1: ; // Lists all Files and File Directories + more statistics - using a List in a Dictionary: Dictionary<string, List<FileInfo>>
....................................................................// Lists all Files and File Directories + more statistics - using LINQ (Language-Integrated Query) + ToList

Source: ;
Executable: ; // Fractal
Source: ;
Executable: ; // Fractal
Source: ; Executable: ; // also in der 4. Klasse Hauptschule habe ich einen ganzen Samstag Nachmittag/Abend an so einem Bild gezeichnet...
Source: ; Executable: ; // Wilhelm's erstes Zeichenprogramm [  mit C# ;-)  ]

***** tick-tock tick-tock tick-tock tick-tock tick-tock tick-tock tick-tock tick-tock tick-tock tick-tock *****
Source: ; Executable: ; // Wilhelm's erste Analoguhr (on the verge of a nervous breakdown):
2012-01-20: Die prozedurale Implementierung (entstanden Freitag, 20. Jänner 2012 bis Samstag, 21. Jänner 2012) meiner ersten Version einer Analoguhr könnte als abschreckendes Beispiel dazu dienen, wie man heutzutage nicht programmieren soll.
Betrachten wir diesen Prototypen als Kampf mit Windows Forms und der Trigonometrie im rechtwinkeligen Dreieck.

Die nächste Version ist natürlich objektorientiert:
Source: ; Executable: ; // Wilhelm's Analoguhr:
2012-02-03:  Fortunately, one of the basic rules of the universe is that nothing's perfect ;-).
***** tick-tock tick-tock tick-tock tick-tock tick-tock tick-tock tick-tock tick-tock tick-tock tick-tock *****


Source:
; Executable: ; // Funktionsplotter_01
Source: ; Executable: ; // Kreis_01 (circle: dyed of one color; up to seven colors)
Source: ; Executable: ; // Kreis_01_AA (circle: dyed of one color; up to seven colors; + AntiAliasing (glatte Krümmung; glatte Kurve))
Source: ; Executable: ; // Kreis_02 (circle: dyed of one color; up to 16 million colors, and text)
Source: ; Executable: ; // Kreis_02_AA (circle: dyed of one color; up to 16 million colors, and text; + AntiAliasing (glatte Krümmung; glatte Kurve))
Source: ; Executable: ; // Kreis_03 (circle: multicolored; up to 16 million colors, and text)
Source: ; Executable: ; // Kreis_03_AA (circle: multicolored; up to 16 million colors, and text; + AntiAliasing (glatte Krümmung; glatte Kurve))
Source: ; Executable: ; // Kreis_04 (circle: red and shaded, and text)
Source: ; Executable: ; // Kreis_05 (circle: green and shaded, and text)
Source: ; Executable: ; // Kreis_06 (circle: blue and shaded, and text)
Source: ; Executable: ; // Kreis_07 (circle: like 4,5, and 6 - but multicolored, and text)
Source: ; Executable: ; // Kreis_07_AA (circle: like 4,5, and 6 - but multicolored, and text; + AntiAliasing (glatte Krümmung; glatte Kurve))
Source: ; Executable: ; // Kreis_10 (circle: like 7 - but without user input; -> warning: use <CTRL> <ALT> <DEL> to end program)
Source: ; Executable: ; // Rechteck_01 (rectangle: dyed of one color; up to seven colors)
Source: ; Executable: ; // Rechteck_02 (rectangle: dyed of one color; up to 16 million colors)
Source: ; Executable: ; // Rechteck_03 (rectangle: multicolored; up to 16 million colors)
Source: ; Executable: ; // Rechteck_04 (rectangle: red and shaded)
Source: ; Executable: ; // Rechteck_05 (rectangle: green and shaded)
Source: ; Executable: ; // Rechteck_06 (rectangle: blue and shaded)
Source: ; Executable: ; // Rechteck_07 (rectangle: like 4,5, and 6 - but multicolored)
Source: ; Executable: ; // Rechteck_10 (rectangle: like 7 - but without user input; -> warning: use <CTRL> <ALT> <DEL> to end program)
Source: ; Executable: ; // Ameisen_10
Source: ; Executable: ; // Maus_01 (Maus-Koordinaten-Ausgabe)



<<< More C_Sharp >>> !!!!!!!!!!!!!!!!!!!!!!!!!!!


Microcontroller Tools:

RS232_Terminal from Albin Steininger (Visual Studio 2012 project; zip-password: wilhelm):  RS232_terminal.zip
Source:
; Executable: ; // Wilhelm's Terminalprogramm (RS232; 9600bps) + Fenstergrößen verstellbar!
Source: ; Executable: ; // Wilhelm's Zeitmessung
Source: ; Executable: ; // Wilhelm's Datenbetrachter/data viever: up to 8 channels,
10 bit positive values
Source: ; Executable: ;  : Short Guide/User's Manual  // Wilhelm's Datenbetrachter/data viever: up to 8 channels,
12 bit positive values

Note:
I like colorful pictures and always wanted to create my own Microsoft Windows-based oscilloscope (Data Viewer).  
Now that it has reached the state of being kind of useful, I’d like to share it with you. Hopefully you’ll like it too!
Wilhelm’s Data Viewer supports up to 8 channels.
At the start of your microcontroller application, you can send the names of the channels (
A0, A1, A2, A3, A4, A5, A6, and A7) to the Data Viewer using the following syntax:

Syntax general (Creating a Data Viewer’s channel and naming it):
*A0!Your_Channel_Name!
*A1!Your_Channel_Name!
*A2!Your_Channel_Name!
*A3!Your_Channel_Name!
*A4!Your_Channel_Name!
*A5!Your_Channel_Name!
*A6!Your_Channel_Name!
*A7!Your_Channel_Name!

Syntax used in a real project:
strcpy(cBuf1,"
*A0!Poti!");
USBVC001_SendString(cBuf1);
strcpy(cBuf1,"
*A1!DAC0!");
USBVC001_SendString(cBuf1);
strcpy(cBuf1,"
*A2!DAC1!");
USBVC001_SendString(cBuf1);

Afterwards, your application can send data to the Data Viewer using the following syntax:
Syntax general (Sending data to the Data Viewer for an existing/registered channel):
*A0*YOUR_DATA*!
*A1*YOUR_DATA*!
*A2*YOUR_DATA*!
*A3*YOUR_DATA*!
*A4*YOUR_DATA*!
*A5*YOUR_DATA*!
*A6*YOUR_DATA*!
*A7*YOUR_DATA*!

Syntax used in our DAvE’s project:
// send data via USB:
// Result_Poti:
strcpy(cBuf1,"
*A0*");
sprintf(cBuf2,"%d\n",Result_Potentiometer);
strcat(cBuf1,cBuf2);
strcat(cBuf1,"
*!");
USBVC001_SendString(cBuf1);
USB_USBTask();
// Result_DAC0:
strcpy(cBuf1,"
*A1*");
sprintf(cBuf2,"%d\n",Result_DAConverter0);
strcat(cBuf1,cBuf2);
strcat(cBuf1,"
*!");
USBVC001_SendString(cBuf1);
USB_USBTask();
// Result_DAC1:
strcpy(cBuf1,"
*A2*");
sprintf(cBuf2,"%d\n",Result_DAConverter1);
strcat(cBuf1,cBuf2);
strcat(cBuf1,"
*!");
USBVC001_SendString(cBuf1);
USB_USBTask();

Note:
Wilhelm’s Data Viewer was written/created in 2 days.
Therefore, please do not expect too much from this tool (for the time being)!
It is not real-time capable if there is too much data sent to it :-(.
After a certain time, the USB buffer is full and the program crashes :-(.
Occasionally, some characters are lost and the program crashes, too :-(.

The interesting thing is that the “Data Viewer” is configured by the microcontroller application itself.
You only have to start the Data Viewer and select the COM line – everything else can/must be done within the application with very easy-to-use syntax :-)!

Wilhelm’s Data Viewer could also be used in a Hands-On Training –> benefit: you do not have to buy and carry oscilloscopes :-)!













Useful links:

Visual C# Developer Center: http://csharp.net; http://msdn.microsoft.com/en-us/vcsharp

Threading mit C#: http://www.devtrain.de/news.aspx?artnr=790

Thread + volatile: http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=DE-DE&k=k(VOLATILE_CSHARPKEYWORD);k(TargetFrameworkMoniker-%22.NETFRAMEWORK%2cVERSION%3dV4.0%22);k(DevLang-CSHARP)&rd=true

Console Class: http://msdn.microsoft.com/de-de/library/43zwz7ys.aspx
Align String with Spaces: http://www.csharp-examples.net/align-string-with-spaces/

Maximizing the Console Window:
http://bytes.com/topic/c-sharp/answers/236351-how-do-i-minimize-my-currently-executing-console-application
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/0b374f73-5604-48ee-a720-53bb5b19467b/


Serial Port:
http://www.c-sharpcorner.com/uploadfile/eclipsed4utoo/communicating-with-serial-port-in-C-Sharp/
http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.aspx
http://social.msdn.microsoft.com/forums/en-us/csharpgeneral/thread/67E3CAEF-6C47-4ECC-B441-254C07C40088
http://msdn.microsoft.com/de-de/library/system.io.ports.serialport.baudrate.aspx
http://dev.emcelettronica.com/serial-port-communication-c
http://www.mikrocontroller.net/topic/154304

Keys:
http://msdn.microsoft.com/de-de/library/system.windows.forms.keys.aspx

Readline() in a textbox:
http://social.msdn.microsoft.com/forums/en-US/Vsexpressvcs/thread/71dd9bd4-318b-4931-a0ba-819d9cef0f15
http://www.vbforums.com/showthread.php?t=622303
http://www.daniweb.com/software-development/csharp/threads/326485

The Future of C#: http://channel9.msdn.com/blogs/pdc2008/tl16



Masterminds Of The 21 Century:

Dennis MacAlistair Ritchie (He created the C programming language):




Bjarne Stroustrup  (He designed and implemented the C++ programming language):



Anders Hejlsberg (Author of Turbo Pascal, chief architect of Delphi, and Microsoft's lead architect of C#):






















:-)