项目作者: chipkin

项目描述 :
A basic Modbus RTU Slave example written in CSharp using the CAS Modbus Stack
高级语言: C#
项目地址: git://github.com/chipkin/ModbusRTUSlaveExampleCSharp.git
创建时间: 2019-07-16T23:37:57Z
项目社区:https://github.com/chipkin/ModbusRTUSlaveExampleCSharp

开源协议:

下载


Modbus RTU Slave Example CSharp

A basic Modbus RTU Slave example written in CSharp using the CAS Modbus Stack

User input

  • Q - Quit
  • UP Arror - Increase 40,001 by 1
  • Down Arror - Decrease 40,001 by 1

Example Ouput

  1. Starting Modbus RTU Slave Example version 0.0.1.0
  2. https://github.com/chipkin/ModbusTCPMasterExampleCSharp
  3. FYI: CAS Modbus Stack version: 2.3.11.0
  4. FYI: CAS Modbus Stack Setup, successfuly
  5. Available Ports:
  6. COM1
  7. COM4
  8. COM5
  9. Enter COM port value (Default: COM1): com4
  10. Baud Rate(default:9600):
  11. Available Parity options:
  12. None
  13. Odd
  14. Even
  15. Mark
  16. Space
  17. Enter Parity value (Default: None):
  18. Enter DataBits value (Default: 8):
  19. Available StopBits options:
  20. None
  21. One
  22. Two
  23. OnePointFive
  24. Enter StopBits value (None is not supported and
  25. raises an ArgumentOutOfRangeException.
  26. (Default: One):
  27. Available Handshake options:
  28. None
  29. XOnXOff
  30. RequestToSend
  31. RequestToSendXOnXOff
  32. Enter Handshake value (Default: None):
  33. FYI: Key Enter pressed.
  34. FYI: Modbus Stack version: 2.3.11.0
  35. Help:
  36. Q - Quit
  37. UP Arror - Increase 40,001 by 1
  38. Down Arror - Decrease 40,001 by 1
  39. FYI: Recived 1 bytes
  40. 01
  41. FYI: Recived 7 bytes
  42. 03 00 00 00 0A C5 CD
  43. FYI: GetModbusValue slaveAddress=[1], function=[3], startingAddress=[0], length=[10]
  44. FYI: Sending 25 bytes
  45. 01 03 14 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 A3 67
  46. FYI: Key UpArrow pressed.
  47. FYI: Increase 40001 by 1. Before=0, After=1
  48. FYI: Key UpArrow pressed.
  49. FYI: Increase 40001 by 1. Before=1, After=2
  50. FYI: Key UpArrow pressed.
  51. FYI: Increase 40001 by 1. Before=2, After=3
  52. FYI: Key UpArrow pressed.
  53. FYI: Increase 40001 by 1. Before=3, After=4
  54. FYI: Key UpArrow pressed.
  55. FYI: Increase 40001 by 1. Before=4, After=5
  56. FYI: Key UpArrow pressed.
  57. FYI: Increase 40001 by 1. Before=5, After=6
  58. FYI: Key UpArrow pressed.
  59. FYI: Increase 40001 by 1. Before=6, After=7
  60. FYI: Recived 1 bytes
  61. 01
  62. FYI: Recived 7 bytes
  63. 03 00 00 00 0A C5 CD
  64. FYI: GetModbusValue slaveAddress=[1], function=[3], startingAddress=[0], length=[10]
  65. FYI: Sending 25 bytes
  66. 01 03 14 00 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16 13
  67. FYI: Recived 1 bytes
  68. 01
  69. FYI: Recived 4 bytes
  70. 06 00 00 00
  71. FYI: Recived 1 bytes
  72. 63
  73. FYI: Recived 2 bytes
  74. C9 E3
  75. FYI: SetModbusValue slaveAddress=[1], function=[6], startingAddress=[0], length=[1], dataSize=[2]
  76. FYI: Sending 8 bytes
  77. 01 06 00 00 00 63 C9 E3
  78. FYI: Recived 8 bytes
  79. 01 03 00 00 00 0A C5 CD
  80. FYI: GetModbusValue slaveAddress=[1], function=[3], startingAddress=[0], length=[10]
  81. FYI: Sending 25 bytes
  82. 01 03 14 00 63 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 79 2B
  83. FYI: Key Q pressed.
  84. FYI: Quit

Building

  1. Copy CASModbusStack_Win32_Debug.dll, CASModbusStack_Win32_Release.dll, CASModbusStack_x64_Debug.dll, and CASModbusStack_x64_Release.dll from the CAS Modbus Stack project into the /bin/ folder.
  2. Use Visual Studios 2019 to build the project. The solution can be found in the /ModbusRTUSlaveExampleCSharp/ folder.

Note: The project is automaticly build on every checkin using GitlabCI.