The Altivar 18 made by Telemecanique /
Square D / Schneider is a variable speed controller for three-phase asynchronous
motors.
Information about this device can be found elswhere
.
The device can be controlled by analog inputs or by a serial connection, which would be extremely suitable with a connection with a PC. The producer provides a serial interface and a PC software (PCS) which can monitor and modify internal parameters and enables a simple control. This serial connection and the PCS, which cost almost the same price as the main unit are, however, meant for testing and commissioning purposes and not for a serious use. The use of the PCS is anyway problematic since it is the only program which can run (in the background) of a PC (even in NT). Moreover the manufacturer does not give (or sell) away the communication protocol!!!.
This is what he says:
The PC software for the ATV18 is intended for
commissioning of the drive. It is not intended nor was it designed to control
the drive ( i.e. give start, stop, forward, reverse or speed reference
commands). We do not support any control of the drive via the PC connection.
This drive is
intended to be controlled by the terminal strip
only. Any attempt to control the drive via the PC connection will void
the warranty.
It is clear that the producer doensn't find the serial connection sufficiently reliable and doesn't want to take the responsibility for damages which could be caused e.g. in industry. ATV controlled via a serial connection should be used in situations when great values are not at stake, like in our case for driving a scientific instrument. We have found serial connection quite reliable. But we recommend that the control software should be written by an experinced programer and a good safety measures ( end and emergency switches etc.) should be taken.
Intercepting the communication of the ATV18 and a PC, running the PCS, is by no means an easy task since every second several blocks of data are exchanged using apparently a fast transfer using the UART's FIFO. A big experience with 8 bit microcontrollers and PC's hardware and software is necessary.
We do not want to go into details of quite a long history of the communication intercepting in spite of the fact that it is interesting. In our case we needed just a simple control of the ATV18 which would enable us to start and stop the motor, change the speed and the direction of rotations but integrated in our software driving the rest of the instrument. All other subtle parameters can be changed manually or with the use of the PCS.
To control the ATV it was necessary to go trhough
three steps:
1) read data which are exchanged in PC
<-> PCS communication
2) understand what they mean
3) build our own controller
The main progress in the first task was enabled thanks to the program Portmon v2.01 and for the other two steps the program Look RS232 appeared to be extremely useful.
The communication parameters.
From intercepting it seems that the transfer
uses 9600Bd, 8 bits, 0 stop bits!, Even parity and blocks of up to 7 bytes
are sent. However ATV also understands commands sent byte by byte using
9600Bd, 8 bits, 1 stop bit, Even parity.
This is surely slower but it works as well.
The communication:
The communication is driven by the PC as a master
which sends commands to the ATV.
There are basically three types of commands:
ask for a parameter, send a parameter and perform some action. In the first
case the ATV repeats the command and returns the value, in the latter two
it echoes the command, if it was understood.
Normally, the PCS initializes a watch-dog inside
the ATV which takes a care that data are exchanged every 1 second. If this
is not the case the ATV stops and signals error. We do not know how to
initiate the watch-dog but it is not necessary to do so. The communication
can work in such a way that commands are sent only when it is necessary! To
be continued ...