Differences
This shows you the differences between two versions of the page.
| fieldio:cfnet:cfheaderprogramming:code_1 [2026/02/20 15:34] – created - external edit 127.0.0.1 | fieldio:cfnet:cfheaderprogramming:code_1 [2026/02/26 04:54] (current) – admin | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| <code csharp> | <code csharp> | ||
| - | // Detect all connected | + | // Get the CFHEADER |
| - | foreach(var cfheader in Cfheader.Instances){ | + | var cfheader0 = Cfheader.Instances[0]; |
| - | | + | |
| - | | + | // Open USB communcation with the CFHEADER module |
| - | | + | cfheader0.Open(); |
| - | } | + | |
| - | | + | // Get all possible IO module instances |
| - | Console.WriteLine($" | + | var allIOModules = ((IEnumerable< |
| + | | ||
| + | .Concat(cfheader0.DigitalInputModules) | ||
| + | .Concat(cfheader0.DigitalOutputModules); | ||
| + | |||
| + | // Reset the IO module' | ||
| + | foreach(var ioModule in allIOModules) | ||
| + | { | ||
| + | ioModule.AcknowledgeI2cFailure(); | ||
| + | } | ||
| + | |||
| + | // Test i2c communication for each IO module | ||
| + | cfheader0.Sync(); | ||
| + | |||
| + | // Identify each IO module whose I²C communication succeeded. | ||
| + | foreach(var ioModule in allIOModules) | ||
| + | { | ||
| + | | ||
| + | { | ||
| + | Console.WriteLine($" | ||
| } | } | ||
| } | } | ||
| + | |||
| + | // Close USB communication with the CFHEADER module | ||
| + | cfheader0.Close(); | ||
| </ | </ | ||
| + | |||
