How Can We Help?

Print

Sending ASCII characters via the HMI serial port for a device calibration

 

The data

In this example, the data are as follows:

We have a laser and we need to calibrate it via the HMI serial port in RS232/485.

  • Baudrate = 115200; data bit = 8; stop bit = 1; parity = none

  • Each command starts with a hashtag followed by a command. If a module is addressed, the number of the port is transmitted separated by a space and, for some commands, an additional value. The command is concluded with a carriage return and line feed:
    • #<CMD> (<PORT>) (<VALUE>)\r\n

  • Example of commands

Command Port Value Info Response
#cal_0 1…4 Calibration zero point
#cal_g 1…4 0…65535 Calibration point with gas

Resetting laser modules, e.g. for the laser 1 (Characters and ASCII codes):

  • #cal_0 1\r\n
  • 35 99 97 108 95 48 32 49 13 10

Module calibration, e.g. for the laser 2 (Characters and ASCII codes):

  • #cal_g 2 3000\r\n
  • 35 99 97 108 95 103 32 50 32 51 48 48 48 13 10

The HMI project

You can download here the HMI project

Devices 1 to 4 are the buttons that send the reset command to the laser modules.

  • LB100 is not used, but is required to use the “Bit button”
  • In “Advanced” tab, you can see that we set a value in LW100. It is the the device number (49=1, 50=2,…)
  • These buttons call a script

The “Numerical inputs” are for enter a value for the module calibration

  • LW101…104 are the value to be send for the calibration
  • In “Advanced” tab, you can see that we set a value in LW100. It is the the device number (49=1, 50=2,…)
  • These buttons call a script

See here for the 2 scripts

Example of data received by the device for this command #cal_g 1 12345