ECIO 40 and comms
Posted: Sat Apr 24, 2010 8:14 am
I have set up an analog port to read as int ( 0-1024). I am trying to send the hex value of any given point through the com port.
The issue is when my VB2008 program reads the byte it comes back with 4 series of 0 - 255.
The ECIO is outputting hex values and the conversion is done in VB.
ie. turn pot from min to max. When 255 is reached the value returns to 0 and starts again to 255
The input routine in VB is as follows
TextBox1.AppendText(SerialPort1.ReadByte().ToString("x3"))
TextBox2.Text = Microsoft.VisualBasic.Right(TextBox1.Text, 3)
ana0.Text = Convert.ToInt32(Microsoft.VisualBasic.Mid(TextBox2.Text, 1, 3), 16)
Analogview.Analog2.AdvancedThermometer1.Value = ana0.Text
Any ideas would be helpful
Cheers Ian.
The issue is when my VB2008 program reads the byte it comes back with 4 series of 0 - 255.
The ECIO is outputting hex values and the conversion is done in VB.
ie. turn pot from min to max. When 255 is reached the value returns to 0 and starts again to 255
The input routine in VB is as follows
TextBox1.AppendText(SerialPort1.ReadByte().ToString("x3"))
TextBox2.Text = Microsoft.VisualBasic.Right(TextBox1.Text, 3)
ana0.Text = Convert.ToInt32(Microsoft.VisualBasic.Mid(TextBox2.Text, 1, 3), 16)
Analogview.Analog2.AdvancedThermometer1.Value = ana0.Text
Any ideas would be helpful
Cheers Ian.