Thanks for the answer, but I just fixed that problem 🙂
So now I am able to send simple command to the encoder, and to get back its answer.
Only problem now is that sometimes I get a timeout error, even though the command is well executed and I got the right answer.
Any tips on how to fix that?
You can filter errors by error code…
Are you using the correct termination character when you configure the serial port?
Lynn said it looked like responses were terminated with a carriage return. If you don't set that in the Serial configure, it will use the default of line feed. Then you'd issue a command, and read some large number of bytes. You'd get a complete message, but it will timeout because it won't get the linefeed character. If you configure for carriage return, it won't timeout because the VISA read will return as soon as it sees the carriage return.
You're not, by any chance, using "Bytes at port" AND termination enabled at the same time, are you? It's one or the other (and in this case, termination is the way to go).
Of course everything is a guess because you are too shy to share your code. 😉