You almost certainly don't want to use strcpy, since you are probably sending binary data, and thus may want to copy a zero-byte character (which strcpy would use to mark end-of-string). The better alternative to strcpy would be memcpy (since you don't change byte order), as in
Code:
case MB_REG_READ:
memcpy(pucRegBuffer, &usRegHoldingBuf[iRegIndex], usNRegs * sizeof(USHORT));
break;
and similiar for the MB_REG_WRITE case.
As others have mentioned, the main probelm is that you are using strTeste uninitialized. Not only that, but strTeste is only a pointer, and doesn't point to any ModBus data. You could try something like:
Code:
UCHAR strTeste[5] = {'1', ...}; // reserve space for and initialize up to 10 UCHARS (bytes) of data
eMBRegHoldingCB(strTeste, 11, 1, MB_REG_WRITE);
Do take note that your eMBRegHoldingCB reads/writes 2 bytes at a time, but you say you only want to send one byte (ASCII character '1'), so you will be sending a second, garbage byte. Make sure that is ignored on the other end.