Quantcast
Viewing all articles
Browse latest Browse all 27072

Updating Text in TextBox from SerialPort_DataReceived continuously has display errors

Hi all,

I am new to this forum and hoping i can get some help ASAP with some error i am receiving...

Okay what i am doing is making a Tachometer that continuously updates its readings of speed which is calculated by a PIC16F which the data is sent to the GUI and displayed in a TextBox. I am using Proteus ISIS to help debug my coding which i thus know all is correct except when the GUI displays the data in the TextBox. As it starts the readings are displayed for example as 5,000.00 then to 4,750.00 then to 4,500.00 then to 250.00 (Where did "4," disappear to?) then to 3,750.00 then to 3,500.00 etc. So every now and then the displayed data is not complete which i cannot understand why? I have tried to Clear() the TextBox before displaying the next reading but still does not help.

Here is my code below:


Dim k, s As Double

Private Sub SerialPort2_DataReceived1(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort2.DataReceived

s = Val(SerialPort2.ReadExisting()) * k

TextBox1.Text = Format(s, "Standard")

End Sub



Any help will be greatly appreciated, thanks.

Viewing all articles
Browse latest Browse all 27072


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>