Base conversion (conversion between decimal and hexadecimal)

A previous company basically developed based on microcontrollers, and generally communicated with the host computer in accordance with a custom protocol. During testing, the protocol was often modified and involved conversion between hexadecimal systems, such as To obtain version information that is in hexadecimal, it needs to be converted into decimal. For example, to modify the time, you need to first convert the time year, month, day, hour, minute, and second into hexadecimal and then fill it in the protocol.

There are a lot of information about base conversion on the Internet, but they are basically single-character conversions. For example, inputting A can be converted into decimal 10, but in actual applications, what needs to be converted may be two characters AC or more, and converting one by one is too much. slow.

In order to improve efficiency, based on the actual hex conversion, try to use python+qt to develop a customized hex conversion tool as shown below.

This tool can convert decimal and hexadecimal to and from each other. Just use spaces to separate the parts that need to be converted.

For example, hexadecimal to decimal. 

For example, convert decimal to hexadecimal:

 

Multiple hexes that need to be converted can be separated by spaces. If necessary, you can use this link to download:

https://download.csdn.net/download/qq_19294353/87975789

If you need to modify the source code, you can send me a private message.

Guess you like

Origin blog.csdn.net/qq_19294353/article/details/131500404