Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Modbus RTU
Message
 
À
24/06/2016 22:50:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8.1
Network:
SAMBA Server
Database:
MySQL
Application:
Desktop
Divers
Thread ID:
01637665
Message ID:
01637705
Vues:
252
J'aime (1)
>Dear James,
>
>Thanks for the reply.
>
>
>My computer using RS485(UBS convertor) to connect the CT6S-1P2T (Autonics Counter). The CT6S-1P2T connect to encoders.
>
>I want to send a query to request data from CT6S and then collect the data from the CT6S.
>
>Could you kindly show me an example on how to do this?
>
>
>
>Thanks in advances.

I am not sure where to start, I will assume you have never worked with Modbus.

First, we need to know exactly where we stand with the counter. Is the RS-485 connector in use now in a functioning system? If the RS-485 connector is wired, this would indicate a controller is probably already present. I am not familiar with the counter, but at first glance it appears to be a Modbus slave device, but it has enough built-in intelligence to be a standalone controller.

If the RS-485 connector is wired, we will need a bit more information and a somewhat different plan before proceeding with the below tasks.

If the RS-485 connector is NOT currently wired, this will be much simpler as your PC can act as the Master and query the counter. In this case, proceed as follows:

Connect your usb/RS-485 converter to the counter, cat-5 is fine. Should be 2-wire, 4 is rarely used, and insure you use a single twisted pair and take note that transmit wires to receive and receive wires to transmit. If the connection distance is short you shouldn't need termination resistors. Most converters have link indicator lights.

The next step is important to insure your PC can connect to the counter and communicate with the counter. Start at 9600, some devices can't operate much above that and refer to the manual on whether it is 81N. Be careful with the usb/RS-485 converter, some require software installation prior to first connection to the PC. Failure to do this will result in Windows misidentifying the converter and using the wrong driver. This mistake takes some time to fix, although we won't talk about how I know this ;)

There is a lot of Modbus testing software on the internet, but this is one of the good free ones: http://www.chipkin.com/products/software/modbus-software/. This software will insure you can communicate with the counter. Let me explain why this is a necessary step. Industrial controls, wonderful as they seem, are provided in a state that I like to refer to as "kit form". It is somewhat like building your own PC, not every component works as expected. They operate at very low-levels, we're talking transistors, bits, shift registers, and the like. This step is required because the Modbus standard is implemented in sometimes very unique ways, so you must test access prior to doing any programming.

You will need to dig into the manual for the Modbus addresses you require from the counter. The testing software can read and write to some or all memory locations. You are actually reading from memory locations in the counter. Reading from the Inputs (discrete bit, bool) will probably give you access to the encoder input stream, resets, and most keyboard inputs. Reading the Coils (outputs, also bool) will give you the state of the outputs if the timer is used to start/stop things. Reading the input register (bytes) may not be applicable to such a simple device. The Holding Registers are what you are probably most interested. They should contain the accumulated counts, set points, anything that is a number. Here is one of the important tests, the first Holding Register should be located at Modbus memory location 40001 and some manuals will express the locations properly. Note, however that 40001 is mapped to register location 0, so addressing is sort of plus 1. Oh, but no, I have encountered devices that use Modbus 40000 for register 0. This can have you reading the wrong register -- kit form. Put in a range of registers and the PC software will scan the Modbus device and show you updates to the counter registers.

Long winded I know, but it is difficult to simplify much more. If you have made it to this point you have accomplished the most difficult portion of the design. If not, let me know where you hit a snag.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform