Well, the FCS is computed from XOR'ing all the characters involved which is what's shown in your routine too.
However, the computed FCS result is a 8 bit binary number which need to be converted into two ASCII characters (00 to FF) to represent the number. An example routine is shown below as htoa2() function.
/*------------------------------------------------------------------------*/
/* convert the number "value" into a x-byte ASCII characters to */
/* represent the value in Hex code */
/*------------------------------------------------------------------------*/
int htoax(long value, unsigned char *string, unsigned char digit)
{
register int temp;
register unsigned char i;
for (i=0;i<digit;i++) { /* No of digit to represent variable */
temp = value % 16; /* compiler only supports 16-bit logical AND */
if (temp < 0) temp += 16;
if (temp < 10) string[digit-1-i]=temp+0x30;
else string[digit-1-i]=temp+0x37;
value = value>>4;
}
return(1);
}
/*-----------------------------------------------------------------------*/
int htoa4(unsigned int value, char *string)
{
htoax(value, string, 4);
}
/*-----------------------------------------------------------------------*/
int htoa2(unsigned char value, unsigned char *string)
{
htoax(value, string, 2);
}