User Tools

Site Tools

한국어

cfnet:cfheader:csharp:index

This is an old revision of the document!


CFHEADER .NET (C#, VB.NET) API

After setting up a development environment, simply connect the CFHEADER module to the development machine, and then use Visual Studio, and any .NET language (e.g. C# or VB.NET), to automate the IO modules using the ComfileTech.Cfnet.Cfheader API.

Simple Digital Output Example

var cfheader0 = Cfheader.Instances[0];
var digitalOutputModule0 = cfheader0.DigitalOutputModules[0];
 
cfheader0.Open();
 
while (true)
{
    // Blink each output in increasing order
    foreach (var channel in digitalOutputModule0.Channels)
    {
        channel.State = true;
        channel.Module.Header.Sync();
        Thread.Sleep(50);
 
        channel.State = false;
        channel.Module.Header.Sync();
        Thread.Sleep(50);
    }
 
    // Blink each output in decreasing order
    foreach (var channel in digitalOutputModule0.Channels.Reverse())
    {
        channel.State = true;
        channel.Module.Header.Sync();
        Thread.Sleep(50);
 
        channel.State = false;
        channel.Module.Header.Sync();
        Thread.Sleep(50);
    }
}

Debug the entire solution on the Windows development machine before deploying to an ARM Linux or other target device. Since the development machine is usually much more powerful than the target device, local edit-run-debug iterations are far more productive.

Contents

cfnet/cfheader/csharp/index.1780034174.txt.gz · Last modified: by mfranklin