How we work with C#

Our second "How we work with" contribution this time is on C#. C what? Yes, for laymen the modern, object-oriented and type-safe programming language sounds a bit spartan. But for our development team it is not without its problems, because especially in the IoT environment C# has become very popular in the last years. Meanwhile, there are numerous, often open source software packages for the preparation of data as well as communication stacks to connect edge controllers to higher-level cloud systems.

 

The first version was released in the early 2000s. Its roots are in C and C++, but it also contains many elements of Java. The most important design goal of the C# language was and is its platform independence. Historically close to the .NET framework, C# is therefore the most widely used language on Windows platforms. Projects such as Mono or Microsoft's .NET Core enable cross-development, so that applications written in C# can now be executed equally well on other operating systems such as Linux.

 

C# in practice

Our development team has integrated the Mono-Runtime into the Linux BSP of our Edge Controller sysWORXX CTR-700. This allows programs written in C# to be executed directly on the CTR-700. The class library "Ctr700Drv" implemented by SYS TEC also allows direct addressing of the device's inputs and outputs from C#. Polling queries are supported as well as the triggering of events when an input value is changed. Together with the very extensive .NET class library, a very powerful framework for the cross-development of embedded applications is available.

As development environment for C# programming we rely on Visual Studio. This comfortable and powerful IDE is available free of charge in the form of the Community Edition for educational, evaluation and other non-commercial purposes. With the help of the "VSMonoDebugger" plug-in, the translated programs can be deployed and executed directly from Visual Studio on the CTR-700. For troubleshooting we provide the usual debugging functionalities such as breakpoints, single step as well as the inspection of variables and data objects.

With the duo of Visual Studio and C#, cross-development for embedded systems like our sysWORXX CTR-700 is just as convenient and easy as writing desktop and server applications. The comprehensive and powerful framework reduces development time and error rate equally.

Curious how our sysWORXX CTR-700 is programmed in C#? Here you can find the programming example.