Example of use
This section presents some examples showing how to control the Asycube through Modbus TCP in production mode. Use Asycube Studio interface to configure the vibrations parameters.
Set up the Modbus master (e.g. PLC)
Configure the Modbus master (=client) to communicate with the Asycube based on the Asycube communication parameters (See Configuration). Don’t forget to change your master network settings (IP address, …).
Define a memory map of 16bits registers for data to be written in the Asycube. We recommend creating as many registers as contained in the Control Holding Registers.
Define a memory map of 16bits registers for data to be read from the Asycube. We recommend creating as many registers as contained in the Status Holding Registers.
Configure the Modbus master to alternatively write the Control Holding Registers and read the Status Holding Registers, with a cycle time of 10 ms.
Handle the Status and Control Holding Registers
Program your Modbus master to monitor the Asycube errors state by reading the HR_MODBUS_STATUS register. Analyze the HR_MODBUS_ERROR_CODE, HR_WARNINGS and HR_ALARMS registers if needed.
Program your Modbus master to be able to clear the errors by writing the HR_MODBUS_CONTROL register.
Vibration, sequence, backlight, read/write parameter
Start a platform vibration
Set the vibration identifier in HR_PLATFORM_VIBRATION_ID, for example 3 for
D
, which corresponds to a Left direction (according to the convention presented in Types of vibration).Set the vibration duration in HR_PLATFORM_VIBRATION_DURATION, for example 1500 to prepare a vibration of 1.5 s.
Start the vibration by changing the value of the trigger HR_PLATFORM_VIBRATION_TRIG from 0 to 1.
Monitor a platform vibration
Read the HR_MODBUS_PLATFORM_STATUS. If the value is
ERROR
, refer to the HR_MODBUS_STATUS for more information. ABUSY
value means that the command has been understood and that the vibration has started.Monitor the HR_MODBUS_PLATFORM_STATUS and wait for its value to get back to
DONE
, which means that the vibration is completed.Or monitor the HR_PLATFORM_REMAINING_TIME to see the remaining vibration time. The value decreases to 0 when the vibration is completed.
Start and monitor a sequence
Prepare the vibration parameters in HR_SEQUENCE_EXECUTION_NBPARTS, HR_SEQUENCE_EXECUTION_NBMAX, HR_SEQUENCE_EXECUTION_X, HR_SEQUENCE_EXECUTION_Y and HR_SEQUENCE_EXECUTION_SEQUENCEID.
Start the sequence by changing the value of the trigger HR_SEQUENCE_EXECUTION_TRIG from 0 to 1.
Monitor HR_MODBUS_SEQUENCE_STATUS and HR_SEQUENCE_REMAINING_TIME and act accordingly.
Stop a sequence currently running
Stop the sequence by changing the value of the trigger HR_SEQUENCE_HALT from 0 to 1.
Switch the backlight ON
Change the value of HR_BACKLIGHT_STATE_CONTROL from 0 to 1.