HCBBS Forum (English)
Submit Chemical Projects / Find Solutions
Amplify Your Requirements on a Broader Chemical Platform *Engineering · Technology · Equipment · Solutions*
Submit Request

Zhejiang University Zhongkong JX300XP data type conversion

2023-06-08View Original

Thread Content

Is there anyone who can explain in detail the issues related to data type conversion? For example, in engineering applications involving inter-station communication, it is necessary to convert data such as pressure, temperature, flow rate, and liquid level before sending it; how should the receiving station be configured for this purpose?
Reply #22023-06-08
The main methods for data type conversion in Zhejiang University Zhongkong JX300XP are as follows: 1. ASCII code conversion: Converting numbers, letters, or symbols into their corresponding ASCII codes, with the relevant numerical values being parsed according to the protocol during transmission. 2. BCD code conversion: Convert decimal numbers into binary code and compress them into BCD format (that is, each digit is represented by 4 bits of binary data); during transmission, the corresponding numerical value is retrieved based on the protocol. 3. Binary conversion: The data is converted into binary code for transmission, and the receiving end converts it back to its original value. This method is typically used when the amount of data is large and high precision is required. 4. Compression algorithm conversion: For data with large volumes that need to be compressed for transmission, compression algorithms can be used for conversion, such as Huffman coding and the LZ77 algorithm. In control systems, data such as pressure, temperature, flow rate, and liquid level usually exist in the form of analog signals; they need to be converted into digital signals using an analog-to-digital converter (ADC) before such data transformation can take place and the signals can be transmitted. The receiving station needs to parse the received data according to the protocol and convert it to obtain the corresponding physical quantity. At the same time, the hardware and software at the receiving site must also match those at the sending site, to ensure that the data transmission format is consistent, thereby guaranteeing the correct transmission and parsing of the data. .
Reply #32023-06-08
This post was last edited by cww9521 on 2023-6-12 09:46. I’m sharing with you the PPT on the application of inter-station communication for the Zhejiang University ZKJX-300XP programming station. I used it in two projects ten years ago to send and receive commands; nowadays, ZKJX itself no longer recommends the use of inter-station communication.
Reply #42023-06-09
This is the program for receiving and sending digital signals; for analog signals, the only difference lies in the types of GETBIT and SETBIT functions, and it is provided for reference only.
Reply #52023-06-10
I’d like to learn about the conversion algorithms, such as converting from floating-point to half-precision floating-point. Conversion calculation methods such as half-precision floating-point to integer conversion, etc
Reply #62023-06-10
You’re welcome. Here are some algorithms for data type conversion: 1. Converting a floating-point number to a half-precision floating-point number (float to half-float): A floating-point number consists of a sign bit, an exponent bit, and a fraction bit. A half-precision floating-point number has only 16 bits; the conversion can be carried out using the following formula: By separating the sign, exponent, and fraction parts of the floating-point number, and then applying the aforementioned formula, the corresponding half-precision floating-point number can be obtained. 2. Converting half-precision floating-point numbers to integer types: Half-precision floating-point numbers can be converted into either unsigned or signed integer types. The conversion method is as follows: For signed integer types, the sign bit of the half-precision floating-point number must be taken into account, and the conversion is carried out in binary complement form. 3. Converting integers to half-precision floating-point numbers: Integers can be converted into half-precision floating-point numbers, and the method of conversion is as follows: 4. Converting floating-point numbers to integers: Floating-point numbers can be converted into integers, and the method of conversion is as follows: These are some basic algorithms for converting data types, but the specific methods of conversion depend on the actual circumstances. When data type conversion is required in engineering, factors such as data range, precision, and sign also need to be taken into account to ensure that the precision of the data is not lost or overflow errors occur during the conversion process. .
Reply #72023-06-10
Thanks for the classification. Are there any pictures showing data type conversions?
Reply #82023-06-12
This post was last edited by cww9521 on 2023-6-12 09:35. Regarding issues related to data type conversion, it is recommended to install the JX300XP programming software; within its graphical programming environment, you can consult the built-in help to learn more about data type conversion problems. Why use half-precision floating-point numbers instead of full precision floating-point numbers to represent analog values? Since the number of bytes required for floating-point numbers is twice that of half-floating-point numbers, and computer memory has limited capacity, using the half-floating-point data type to represent data helps save system resources and also improves the system’s processing speed. When developing the JX300, Teacher Jin Jianxiang from Zhongkong took into account the issue of the computing power of the CPU on the main control card, as its processing capacity is relatively limited. Furthermore, floating-point numbers suffer from counting errors; therefore, half-floating-point numbers are used instead of floating-point numbers to represent analog values. To give a simple example: if the pressure gauge on site shows 0.3 bar, with a range of 0–0.6 bar, then 0.3/0.6 equals 0.5; thus, 0.5 represents a half-precision value. In reality, half-precision values are numbers within the range of 0–1, and this is a feature of the JX300XP control unit.
Reply #92023-06-12
This post was last edited and shared by cww9521 on 2023-6-12 at 13:04: JX-300XP programming, inter-station communication, and basics of semi-floating-point programming https://bbs.hcbbs.com/thread-3777113-1-1.html (Source: Huahai Chuanliu – Haichuan Network)

Submit a Project

**Looking for Chemical Technology, Equipment & Solutions?** No Registration Required Broader Platform Exposure | Global Chemical Service Provider Connections

Submit Request — Free Consultation

Disclaimer

This is an automated machine translation of the original thread. Some technical terms may have inaccuracies; the original text shall prevail. Click "View Original" at the top right to access the source page, which supports IP-based automatic real-time language translation. Please watch out for contact details and sales inducements to prevent fraud. All content and translations are for reference only, representing solely the poster's personal views. For enquiries, email service@hcbbs.com.