At this time we have to learn how to use the Modbus protocol with the Arduino/Genuino UNO as a slave (server). The device will be connected using the virtual serial port under the USB connection and the PC will act as the client asking to the Arduino device slave to populate information about the digital and analog pins.
The first step is to upload a basic sketch that uses the official Arduino Modbus library. This sketch just maps the digital and analog inputs into Modbus address to be populated using the standar inputs and discrete inputs commands.
This project is part of a utility for Visual IoT Studio but you can use it stand alone from the demo repository here: https://github.com/ildemartinez/Visual-IoT-Studio-demo-projects/blob/master/ArduinoUNOModbusRTUServer/ArduinoUNOModbusRTUServer.ino
Just donwload and upload the ArduinoUNOModbusRTUServer.ino sketch in your device. In that moment your Arduino has become a Modbus slave and can be polled by any Modbus client.
You can test it using the modpool utility from https://www.modbusdriver.com/modpoll.html
With the previous command you can read the digital inputs from Arduino using Modbus discrete input read command connected to the COM3 serial port.
With the previous command you can read the analog inputs from Arduino using Modbus input registers read command connected to the COM3 serial port. Please, note that the default first address in Modbus is the 0x01 but modpull allows you to use the 0x00 as first address using the -0 command line argument (stay alert if you use other Modbus software client).
Take a look to the used sketch to learn how to communicate your Arduino UNO device using Modbus RTU and the Arduino Modbus library.