Ascii to decimal

ASCII code is how to convert to decimal

1, the English alphabet is character-based, ASCII decimal, so only need to convert the character-based to decimal, in the output function to force the conversion of the type.

2, the weight of each bit from left to right is 16 to the nth power, n is the bit number from left to right, starting from 0. Convert to decimal that is, multiply all the values corresponding to the value with the nth power of 16 and then add it.

3, if it is said to be the character ‘2’, direct 2-0 can get the decimal 2. If you directly use the ASCII code value of 50, you can inti; charc=0i=50-(int)c, the same can get the decimal 2.

How to convert ASCII and decimal each other

1, the English alphabet is character-based, ASCII decimal, so only need to convert character-based to decimal, in the output function when the type of forced conversion.

2, ASCII is expressed in hexadecimal, so it is decimal to hexadecimal; for example, 1610 decimal to be converted to hexadecimal; the process is as follows: 1610/16 = 10010 (A); 100/16 = 64; 6/16 = 06; so, 1610 (decimal) = 64A (hexadecimal).

3, in fact, ascII code is very easy to get, the book will generally have that table, corresponding to you can read the binary code corresponding to the character you need, when you write out the 8-bit binary code, we can be converted to BCD code, the specific method is: 8, 4, 2, 1.

4,) ASCII to decimal that is, by the binary to decimal method, according to the power to expand the sum.

5, the ASCII code represents the decimal number converted to binary number decimal number can be expressed as follows: Dn × 10n + Dn-1 × 10n-1 + + D0 × 100 = Di × 10i which Di represents the decimal number 30.

How to convert ASCII to decimal



///Converts integer values in VW2 to 8 ASCII characters starting from VB10

///using the format 16#0B




VW1000, VB197, 16#00

Note: Because the conversion he is taking up 8 bytes so start with 197

Conversion is complete with VW197-VW199 being 0

VW200 onwards is the result you want.

Conversion of ascii code to decimal (BCD)

In (1) air, when CX is odd, the lowest address ASCII code, i.e., the first ASCII code, is converted according to the non-combined BCD code format, i.e., a byte is stored only in the BCD code of the first one. So just mask off the high four bits of AL, and then use the STOSB instruction to store AL into DI.

First of all, the ASCII code into decimal, want to go directly to the BCD can not BCD code has 8422421, etc. Generally more than 8421-type what does it mean, for example (8421): for example, 8 (BCD)=1000 that is, 8X1 + 4X0 + 2X0 +1X0 = 8 (2421): 8 (BCD)=1110 reason are the same.

ASCII numbers converted to BCD code value is very simple, directly minus 30H can be.