K8056 from PIC via RS232

I wrote two simple programs, one in DevCpp and one in vb-excel in order to command the relay card and both work fine. With the PIC I can also communicate with PC via rs232 and Hyperterminal.
But I’m not able to make the K8056 work from PIC! (I use a P18F4550)
For example, the string with asci codes: 13 1 83 49 110 set the relay 1.
in c18 I used the code:

void strToUSART(unsigned char * T) {
	//send T string to USART, byte byte , without ending NUL
	int Tlen,i,asc;
	Tlen=strlen(T);
	for (i=0;i<Tlen;i++) {
		asc=(int)T[i];
		// tests TXIF waiting until  TXREG is empty
		while(~PIR1bits.TXIF);
		WriteUSART(T[i]);
	}
}

testing the routine with Simulator looks as the bytes are going properly, but nothing happens.
I also tried with <usart.h> library functions putsUSART e putrsUSART, but with no success.

where am I wrong?

As I don’t know C, I cannot tell if your code is correct.
Anyway, if you have a scope, compare the signal that comes from the PIC uart with a known-good signal (with an identical string).
Most likely, the levels are inverted…

thanks for the ready replay.
I tried to invert the signal, but without result. At present I don’t have a scope, but I 'll look for it.
If I send a string from the PIC to PC in Hyperterminal it looks right.

void strToUSART(unsigned char * T)
{
    size_t i=0;

    for (; i<strlen(T); i++) {

        while(~PIR1bits.TXIF);

        WriteUSART((char)T[i]);
   }
}

Just to make sure you know: ~PIR1bits.TXIF means ‘invert all bits in TXIF and then check if the value is not 0’. It does not mean ‘loop until TXIF is 0’, rather quite the opposite.

I solved!
The code was correct, the issue was a stupid matter of wiring.
While from PC’s UART (male) TX pin is the number 3, from my protoboard (female) is 4. That’s all.
If anyone needs the code I’ll send it.

Regards
Paolo