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

后端 未结 2 1656
甜味超标
甜味超标 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.

    0 讨论(0)
  • 2021-01-07 14:37

    Since someone else will probably have trouble with this in the future, hand shaking is a selectable option.

    In most of the balances you will see the options for Software, Hardware 2 char, Hardware 1 char. The default setting for the Sartorius balances is Hardware 2 Char. I usually recommend changing to Software.

    Also if it stops working all together it can often be fixed by defaulting the unit using the 9 1 1 parameter. And then resetting the communication settings.

    An example of how to change the settings can be found on the manual on this page:

    http://www.dataweigh.com/products/sartorius/cpa-analytical-balances/

    0 讨论(0)
提交回复
热议问题