I want to read data from weighing scale data via RS232 and i try any more way
my weighing scale model yh-t7e datasheet
The output of the scale on the AccessPort program is this value .
The weight on the scales = 3.900 kg
in picture =009.300
baud rate 1200
When I use this code
string s = "";
int num8 = 0;
string RST = "";
while (this.serialPort1.BytesToRead > 0)
{
string data = serialPort1.ReadExisting();
if (data != null)
{
if (data.ToString() != "")
{
if (data.Length > 6)
{
RST = data.Substring(6, 1) + data.Substring(5, 1) + data.Substring(4, 1) + data.Substring(3, 1) + data.Substring(2, 1);
this.textBox4110.Text = RST.ToString();
}
}
}
}
output in my program
When I use the above code in the program Sometimes displays the weight number and sometimes does not. I have to open and close the program several times. And by changing the weight on the scale, its number does not change on the program and the display value is fixed.
and When I use this code
while (this.serialPort1.BytesToRead > 0)
{
int data = serialPort1.ReadByte();
this.textBox4110.Text = data.ToString();
}
in my program Displays the number 48
What should I do?
thanks regards