Problem reading Serial Port C#.net 2.0 to get Weighing machine output

后端 未结 2 1655
甜味超标
甜味超标 2021-01-07 14:05

I\'m trying to read weight from Sartorius Weighing Scale model No BS2202S using the following code in C#.net 2.0 on a Windows XP machine:

public string rea         


        
2条回答
  •  [愿得一人]
    2021-01-07 14:37

    I know this is probably old now ... but for future reference ...

    Look at the handshaking. There is both hardware handshaking and software handshaking. Your problem could be either - so you need to try both.

    For hardware handshaking you can try:

            mySerialPort.DtrEnable = True
            mySerialPort.RtsEnable = True
    

    Note that

            mySerialPort.Handshake = Handshake.RequestToSend
    

    I do not think sets the DTR line which some serial devices might require

    Software handshaking is also known as XON/XOFF and can be set with

            mySerialPort.Handshake = Handshake.XOnXOff
    

    OR

            mySerialPort.Handshake = Handshake.RequestToSendXOnXOff
    

    You may still need to enable DTR

    When all else fails - dont forget to check all of these combinations of handshaking.

提交回复
热议问题