Hello.
I have a problem sending a string to a serial port.
I am using the MScomm to control a motor .
to get a full status form the motor I need to send the strng "R01 99" and a CR LF.
when I use MSComm1.Output = "R01 99" & vbCRLF I get the full status from the motor
but when I use MSComm1.Output = "R01 " & str$(99) & vbCRLF i get a response that if
the str$(99) is sent as 0.
if I print the str$(99) I see 99.

can somebody help ?

Thanks
Meir Mark.

The Str function returns a leading space for the sign of number. Could that be messing you up? Sinec the leading space is there, you could use "R01" & str$(99)

I found the problem using Microsoft help and replace the str$(99) to Format(99)
thank you very much.

Meir Mark

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.