Android Question ModBus TCP

How can i communicate by Modbus TCP with my Plc on Android device?

I already make a programm with Visual Basic 6 that communicate (read and write) with my Plc by Modbus TCP protocol.

But now i want upgrade and using Android device (smartphone or tablet)
 

KMatle

Expert
Licensed User
Modbus TCP
Did you install that protocoll on you windows machine (Network) as an extra protocoll? Otherwise it's just a TCP/IP socket connection. It's more about the data you send. But you should know that as you have a working VB program.
 
Did you install that protocoll on you windows machine (Network) as an extra protocoll? Otherwise it's just a TCP/IP socket connection. It's more about the data you send. But you should know that as you have a working VB program.
I am not an expert in network communication.
you say that i must create a simple TCP/IP socket connection on B4A?

If yes....can you send me some example? thanks
 

KMatle

Expert
Licensed User
Follow Erel's example (see his post). The modbus device is listenling via TCP/IP to a special port. So try to connect to this port with the example code and send some data.
 
Follow Erel's example (see his post). The modbus device is listenling via TCP/IP to a special port. So try to connect to this port with the example code and send some data.
The Plc respond only with correct format of data send by TCP/IP Modbus send from PC (example read command)
 

Erel

Administrator
Staff member
Licensed User
You will need to implement the protocol yourself. I'm not familiar with Modbus so I cannot say whether it will be simple or not.

ByteConverter and RandomAccessFile are two useful objects for such tasks.
 

KMatle

Expert
Licensed User
I already make a programm with Visual Basic 6 that communicate (read and write) with my Plc by Modbus TCP protocol.
You already did a working program. So what did you do exactly? Which commands are you sending? B4x is similar.
 

Didier9

Active Member
Licensed User
How can i communicate by Modbus TCP with my Plc on Android device?

I already make a program with Visual Basic 6 that communicate (read and write) with my Plc by Modbus TCP protocol.

But now i want upgrade and using Android device (smartphone or tablet)
A few years ago, I implemented the ModBus protocol on PC under VB 6.0 and in C on an ARM microcontroller. From what I remember, you could reuse a lot of your VB6.0 code to make a B4A implementation using the AsyncStreams library. The most painstaking part is parsing and creating the messages, and that code will be largely the same.
 
Top