문제

I am trying to write data(prompts) to a m8300 barcode scanner, but I am having a few issues. The device is serial and I am getting data from it, by using a backgroundworker to pull the data from it for me. However, I can't seem to be able to find a way to write data to the device. I know the device is capable of doing it as it says so in the manual. However, I have the following code:

Private Sub Button5_Click(sender As System.Object, e As System.EventArgs) _
Handles Button5.Click

    SerialPort1.Write(Chr(18) & Chr(27) & "[2JSAY MY NAME" & vbCr)

End Sub

However, it does not work consistently.

Has anyone had experience with writing to a similar device?

도움이 되었습니까?

해결책

I must admit, I totally forgot about this one. It turns out that the chr 18 and 27 are command params for the device; so those 2 are needed only for commands, so i wasn't needed.

The issue I was having was with the communication protocol on the device, even though the directions required 2-way communication enabled on it, it turns out that it needed 1-way communication. I found that out when I reset the device to factory settings and sent out data to it and it worked without any issues.

Goes to show you, not to always believe in the manuals.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top