Realization of Serial Communication of Servo Drive Based on VB

The servo drive is the basic component of the servo system and is widely used in various electric drive automatic control systems, such as: CNC machine tools, flexible manufacturing systems, robot drives, artillery follow-up systems, radar control, ship propulsion, vehicle drive, printing. Equipment, textile equipment, sewing equipment, etc. In the process of applying the servo drive, real-time reading and modification of various control parameters to achieve real-time control is a basic requirement for the servo system.

This article is aimed at the Bosch Rexroth servo drive indradrive, using the flexible and easy-to-use VB6.0 programming language, through the rs232 serial communication interface of the indradrive itself, realizes the serial communication between the host PC and the servo drive, and completes the Real-time control of various control parameters inside the servo drive.

Indradrive's communication protocol indradrive uses the sis communication protocol, which is a binary communication protocol that contains the complete message format and return check format. For the various products of Bosch Rexroth (plc, servo drive, etc.), the communication format of the sis protocol is uniform.

The data format adopted by the sis protocol is: 1 start bit, 8 bits of data, 1 bit or 2 stop bits, no parity bit; the baud rate of communication transmission data is 115200 bps. The sis protocol uses hexadecimal data format. To represent various instruction codes and data, after the software communication instructions are optimized, there are only two, one is a read instruction and one is a write instruction. The two instructions make the upper computer software very convenient to write.

The format of the sis protocol packet is shown in the attached table.


Packet format of the attached sis protocol


The header consists of 8 bytes, and their meanings are as follows: the first byte stz: the start bit, the default is 0x02; the second byte cs: used to check the data, its value is in addition to this byte In addition, all the numbers are added after the lower 8-bit value XOR ff, plus 1 value; the third byte datl: the length of all data after the header is removed (the number of bytes); the fourth word Section datlw: repeats the contents of the third byte; the fifth byte cntrl: determines the error return type, the default is 0x00; the sixth byte service: service type (read parameter write 0x80, write parameter write 0x8f); Seven bytes of adrs: drive address; eighth byte of adre: drive address.

The user data header contains 5 bytes, the meaning is as follows: the first byte control byte: the operation parameter value, the default is 0x3c; the second byte device address (unit address): the drive address; the third byte parameter type : Parameter type, the value of the drive is 0x00; the fourth and fifth byte parameter number: parameter number, for the s parameter of the drive, directly write the hexadecimal value of the parameter number; for the p parameter, write "215 + parameter number The hexadecimal value.

The data length of the user data depends on the data type of the operation parameter. For example, the operation parameter is int type, write 2 bytes; for dword type, write 4 bytes. When writing, note that the low byte is first and the high byte is after.

VB realizes the serial communication between PC and indradrive. The communication between PC and indradrive often adopts the master-slave question and answer mode. The PC always has the initial transmission priority, and all communication is started by the PC. Each communication is initiated by the PC by sending a (read/write parameter) command. After receiving the command sent by the PC, indradrive first checks the start flag in the command, and then checks whether the drive address in the command is related to itself. The drive addresses match. If they are inconsistent, the computer is communicating with other drives, ignoring the command; if they are consistent, responding to the command and returning the execution result to the PC, the communication process ends.

In the VB control toolbox, a very convenient serial communication control mscomm is provided, which comprehensively provides all the rules for the development of the upper layer using serial communication. The serial communication can be implemented by using interrupt mode or query. the way. The mscomm control provides an oncomm event that implements the serial port interrupt function. This event is unique and can intercept any message on the serial port. When a serial port event or error occurs, the VB program will automatically transfer to the oncomm event handler. The commevent attribute stores the most recent event or error value of the serial port. The commevent attribute value can be read at any time in the program to understand the communication. The oncomm event is closely related to the commevent attribute and used together when any oncomm event or error occurs. Will cause the commevent attribute value to change. In the oncomm event processing process, you can determine the value of the commevent attribute and switch to different event processing for different attribute values.

According to the sis communication protocol, the VB program is mainly for the operation of the mscomm control, mainly the initialization of the mscomm control and the processing of the oncomm event.

The main initialization code of the mscomm control is as follows: mscomm_com1.commport = 1'Set the serial port mscomm_com1.setTIngs = "115200, n, 8, 1"

'Set the baud rate and check mode of the transmission mscomm_com1.portopen = true' Open the communication serial port mscomm_com1.rthreshold = 1' Set the input buffer character input threshold oncomm event handler main code is as follows: private sub mscomm_com1_oncomm()

EPON WIFI ONU

There are two types of EPON systems: one is a system that uses 2 wavelengths; the other is a system that uses 3 wavelengths.
For a two-wavelength system, its downlink wavelength is 1510 nm to transmit downlink voice, data and digital video services; the uplink wavelength is 1310nm to transmit uplink voice and video on-demand and download data request signals. The two-way transmission rate of this system is 1.25 Gb/s, even if the OBD split ratio is 32, it can transmit 20km.
For the three-wavelength system, in addition to the downlink wavelength of 1510 nm and the uplink wavelength of 1310 nm, a transmission window with a downlink wavelength of 1550 nm (1530 ~ 1565 nm) is added. The new window is used to transmit downlink CATV service or DWDM service. The CATV service can be either an analog video signal or an MPEG-2 digital video signal. When the splitting ratio of this system is 32, it can transmit 18 km.
EPON is located between the business network interface and the user network interface, connected to the business node through SNI, and connected to user equipment through UNI. EPON system is mainly composed of optical line terminal (OLT), optical distribution network (ODN) and optical network unit.
In the EPON system, the OLT is not only a switch or router, but also a multi-service providing platform, which provides optical fiber interfaces for passive optical fiber networks. According to the development trend of Ethernet to metropolitan area network and wide area network, OLT will provide 1 Gb/s and 10 Gb/s Ethernet interfaces. In addition to supporting traditional voice, ordinary telephone lines, and other types of T1/E1 interfaces, the OLT also supports SONET connections at ATM, FR, and OC3/12/48/192 rates. The OLT in the EPON can be configured with multiple optical line cards as required to connect with 16 to 64 ONUs. In EPON, the maximum distance from the OLT to the ONU can reach 20 km. If an optical fiber amplifier (active repeater) is used, the distance can be extended.

Epon Wifi Onu,Epon 1Ge Wifi Onu,Epon 4Ge Wifi Onu,Wifi Onu, FTTX solution, HGU ONU

Shenzhen GL-COM Technology CO.,LTD. , https://www.szglcom.com