Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- namespace ComConnector
- {
- public class Modul_I7044
- {
- private ComPort _comPort;
- public Modul_I7044(ComPort comPort)
- {
- _comPort = comPort;
- }
- public int GetCountPort(int numberPort)
- {
- Thread.Sleep(100);
- var result = _comPort.SendPort($"#0{numberPort.ToString()}0");
- Thread.Sleep(100);
- do
- {
- result = _comPort.Answer;
- } while (result == null);
- result = result.Substring(result.Length-3, 2);
- ClearCountPort(numberPort);
- return int.Parse(result);
- }
- public string ClearCountPort(int numberPort)
- {
- return _comPort.SendPort($"$0{numberPort}C0");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement