Number 123 to string '123' :
How many subctract 100 from 123 ? 1 time, ok '0'+1='1'=0x31(hex of ascii code)
Now i have 123-100=23
How many subctract 10 from 23 ? 2 time, ok '0'+2='2'=0x32(hex of ascii code)
Now i have 23-20=3
How many subctract 1 from 3 ? 3 time, ok '0'+3='3'=0x33(hex of ascii code)
'1'+'2'+'3'='123'
String '123' to number 123 :
unsigned char number=0;
Take the most righ digit '3'=0x33(hex of ascii code) and subctract 0x30 and you have 3
number+=3;
Now take the digit '2'=0x32(hex of ascii code) and subctract 0x30 and you have 2
number+=2*10;
Now take the digit '1'=0x31(hex of ascii code) and subctract 0x30 and you have 1
number+=1*100;
3+20+100=123