차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판이전 판 | |||
| fieldio:cfnet:cfnet_cfheader:index [2026/06/13 13:49] – [각 부의 설명] admin | fieldio:cfnet:cfnet_cfheader:index [2026/06/13 13:52] (현재) – admin | ||
|---|---|---|---|
| 줄 20: | 줄 20: | ||
| {{ : | {{ : | ||
| + | |||
| ====어드레스 설정 ===== | ====어드레스 설정 ===== | ||
| 줄 30: | 줄 31: | ||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | ===== CFHEADER API ===== | ||
| - | |||
| - | * [[https:// | ||
| - | |||
| - | =====예제 프로그램===== | ||
| - | |||
| - | * 여러 개의 CFHEADER모듈 사용 프로그램입니다. **[ CFHEADER[0, 1, 2] x CFDO[0, 0, 0] ]** | ||
| - | |||
| - | ++++[소스 보기]| | ||
| - | <code csharp> | ||
| - | using ComfileTech.Cfnet.Cfheader; | ||
| - | |||
| - | // Get the CFHEADER instances | ||
| - | var cfheader0 = Cfheader.Instances[0]; | ||
| - | var cfheader1 = Cfheader.Instances[1]; | ||
| - | var cfheader2 = Cfheader.Instances[2]; | ||
| - | |||
| - | // Open USB communication for each CFHEADER instance | ||
| - | cfheader0.Open(); | ||
| - | cfheader1.Open(); | ||
| - | cfheader2.Open(); | ||
| - | |||
| - | // Create a thread for each CFHEADER instance | ||
| - | var thread0 = new Thread(() => Demo(cfheader0)); | ||
| - | var thread1 = new Thread(() => Demo(cfheader1)); | ||
| - | var thread2 = new Thread(() => Demo(cfheader2)); | ||
| - | |||
| - | // Start each thread | ||
| - | thread0.Start(); | ||
| - | thread1.Start(); | ||
| - | thread2.Start(); | ||
| - | |||
| - | // Wait for each thread to finish | ||
| - | thread0.Join(); | ||
| - | thread1.Join(); | ||
| - | thread2.Join(); | ||
| - | |||
| - | void Demo(Cfheader cfheader) | ||
| - | { | ||
| - | // Get the digital output module | ||
| - | var cfdo_16n0 = cfheader.DigitalOutputModules[0]; | ||
| - | |||
| - | // Initialize all channels to 0 | ||
| - | cfdo_16n0.State = 0x00; | ||
| - | |||
| - | while (true) | ||
| - | { | ||
| - | foreach (var channel in cfdo_16n0.Channels) | ||
| - | { | ||
| - | // Toggle the channel on | ||
| - | channel.State = !channel.State; | ||
| - | channel.Module.Header.Sync(); | ||
| - | |||
| - | // Delay for 50ms | ||
| - | Thread.Sleep(50); | ||
| - | |||
| - | // Toggle the channel off | ||
| - | channel.State = !channel.State; | ||
| - | channel.Module.Header.Sync(); | ||
| - | } | ||
| - | } | ||
| - | } | ||
| - | </ | ||
| - | ++++ | ||
| {{ : | {{ : | ||
