Not sure if I am suggesting the easiest way. Anyway, you can work it out. First convert the ASCII numbers to binary format in 4 bytes thus

31724529 = ((3*10) + (1*10) + (7*10) + ... + 9)

If this is what you want 01E413F1, 'you got it'

If you want to send this as hex digits, you need to pick one number at a time and send the nibbles. For example, E4 will be sent as 'E' and '4'. To do this, you split the E4 into 0E and 04. To make any number to printable hex, you need to check; if it is in 0..9, simply add 30H and you got the printable hex. However, if the number is between 0A to 0Fh, you add 37H to get the printable Hex digit.

Hope this sets you on the right track.

Jerson