Author Topic: Custom Driver: Example as C#-Solution  (Read 250 times)

mueller_t

  • Newbie
  • *
  • Posts: 3
Custom Driver: Example as C#-Solution
« on: April 29, 2020, 09:19:34 AM »
Can share somebody a C#-Solution for a custom driver. I have implemented my own driver according the description from the SDK, but my driver is not listed in easyplc, if i want add new hardware. I'm using a licensed version of easyplc.

Thanks a lot
Thorsten

EasyPLC_Master

  • Developer
  • Administrator
  • *****
  • Posts: 848
  • Nirtec
    • The EasyPLC Project
Re: Custom Driver: Example as C#-Solution
« Reply #1 on: April 29, 2020, 06:13:35 PM »
Hello!

In order the driver will be recognized for EasyPLC, the Assembly name must match with the driver file name, please see the Screen.gif attached example.

Please confirm if this solve your problem.


mueller_t

  • Newbie
  • *
  • Posts: 3
Re: Custom Driver: Example as C#-Solution
« Reply #2 on: April 29, 2020, 06:28:56 PM »
Hi,

yes, this is matching, see my Screenshot. I have attached my simple solution. So maybe it's possible, that you can take a look , where is the mistake in my solution. The dll is compiled as x86 / Release.

EasyPLC_Master

  • Developer
  • Administrator
  • *****
  • Posts: 848
  • Nirtec
    • The EasyPLC Project
Re: Custom Driver: Example as C#-Solution
« Reply #3 on: April 29, 2020, 08:06:30 PM »
Hello after review your code, two comments:

1. The driver can not have an abstract or static class -> public static class FMU_Model.
This causes your driver can't be loded

2. The class that implements the IExternalDriver interface must to be named same as the Assembly name and file name, see the example attached (see screen1.gif)

Please, update your progress work.
Thanks!

EasyPLC_Master

  • Developer
  • Administrator
  • *****
  • Posts: 848
  • Nirtec
    • The EasyPLC Project
Re: Custom Driver: Example as C#-Solution
« Reply #4 on: April 29, 2020, 09:20:14 PM »
Also as example, here is attached the source code of the Simulated I/O driver to manage the digital/analog I/O manually from a windows form.

mueller_t

  • Newbie
  • *
  • Posts: 3
Re: Custom Driver: Example as C#-Solution
« Reply #5 on: April 30, 2020, 02:38:58 PM »
Thanks for your support. I will update my driver and it should work. Best regards Thorsten