[Gambas-user] Help for libmodbus TCP

vuott at tutanota.com vuott at tutanota.com
Fri Sep 23 08:58:59 CEST 2022


Hello spheris,
1) Modbus_t() is a Function not a data-type, so you cannot declare it via "Dim". In fact you have already declared it with "Extern".

2) (mb As Object) .... Clanguage doesn't know "Object" data-type !

regards 
vuott



23 set 2022, 08:16 da fabien.toniutti at free.fr:

> Hi everyone,
> I try to use libmodbus tcp ip in gambas but i have some questions.
> First, i see in libmodbus, source code external methods to extern in gambas.
> well i write this code :
>
> Extern modbus_t(mb As Object) In "libmodbus"
> Extern modbus_new_tcp(myaddress As String, myport As Integer) In "libmodbus"
> Extern modbus_connect(mb As Object) In "libmodbus"
> Extern modbus_read_registers(mb As Object, myaddress As Integer, myregister As Integer, tab_reg As Integer[]) In "libmodbus"
> Extern modbus_write_registers(mb As Object, myaddress As Integer, myregister As Integer, tab_reg As Integer[]) In "libmodbus"
> Extern modbus_close(mb As Object) In "libmodbus"
> Extern modbus_free(mb As Object) In "libmodbus"
>
> Public Sub Button1_Click()
> Dim mb As Modbus_t()  '<--------------------------------------------------- error here
>  mb = New Modbus_new_tcp("127.0.0.1", 1502)
> End
>
> but when i execute program, gambas says to me : unknown indetifier Modbus_t() (where is arrow above)
> Could you explain me how to solve this problem?
> is already someone used to program modbus tcpip in gambas on the net? i need example.
> Thanks a lot for  your answer.
> spheris
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220923/6baa7a4a/attachment.htm>


More information about the User mailing list