How to convert ascii code
To decimal calculation.ASCII is the American Standard Code for Information Interchange is based on the Latin alphabet a set of computer coding system, mainly for the letters of the alphabet operation, ASCII conversion is to decimal calculation, for example: the ASCII code for C is 67, this 67 is to decimal calculation, the 67 decimal into binary after 67 is exactly 1000011. Exactly 1000011.
In the arrangement of the ASCII code table, the characters A to Z, lowercase a to z, and the numbers 0 to 9, are in order, so A is 65, then B is 66, C is 67, D is 68, and E is 69.
Using the lookup table method, convert the high four and low four BCD codes in 80H to ASCII codes and send the ASCII codes back to 80H and 81H.
The following will do:
MOVR0,#80H;should be indirectly addressed
MOV@R0,#28H;pre-store a number
DIVAB;Separate high and low four bits
MOVCA,@A+DPTR;Look up table
How to convert numbers to ASCII code, such as 46 how to change, into binary?
1, first enter the hexadecimal data or ASCII data, you can control the direction of data conversion through the button. The interface layout is shown in the figure.
2. “—->” means convert ASCII code to hexadecimal data. This button through the split will be agreed “” separated characters into string string, and then through the ToCharArray will be converted to a character array, and finally the character array will be converted to decimal, hexadecimal data can be displayed in turn.
3, “<—-” means that the decimal data will be converted to ASCII code. According to the agreement Split (”) split the characters, take out the decimal data, convert the decimal data to ASCII characters, and then the combination of display can be.
4, because the hexadecimal and decimal real-time update, easy to observe, so you need to trigger the TextChanged event.
5, the final display effect is shown in the figure, enter the hexadecimal/decimal data, click “<—-” can be converted to ASCII code, enter the ASCII code, click “—->” can be converted to ASCII code, enter the ASCII code, click “—->” can be converted to ASCII code. ” can be converted to get hexadecimal/decimal data.