djp122 Posted March 7, 2014 Report Share Posted March 7, 2014 (edited) Hey everyone, EDIT: I answered my own question by reviewing the examples in the FSUIPC Client DLL for .NET zip file. I am trying to figure out how to continuously check an offset to see if it is at a current value or not. The variable I am looking to check is the COM1 radio, when it is transmitting and when it is receiving. It works as long as I press the update button on my form. I am trying to figure out how to continuously check it in the background with a backgroundworker. The end goal is to do something if the COM1 is transmitting or receiving. Such as, Streaming SkyBlue radio, but having it mute when I am talking or someone is transmitting over the radio. Figure I would give it a shot anyway. This is some of the code, but kind of stuck on how to implement the continuous variable check. Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load BackgroundWorker1.RunWorkerAsync() End Sub Private Sub btnUpdate_Click(sender As System.Object, e As System.EventArgs) Handles btnUpdate.Click FSUIPCConnection.Process() Dim COM1Recieve As Integer = COM1Rx.Value Dim COM1Transmit As Integer = COM1Tx.Value Me.lblRx.Text = COM1Recieve.ToString Me.lblTx.Text = COM1Transmit.ToString End Sub Private Sub BackgroundWorker1_DoWork(sender As System.Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork FSUIPCConnection.Process() Dim COM1Recieve As Integer = COM1Rx.Value Dim COM1Transmit As Integer = COM1Tx.Value Me.lblRx.Text = COM1Recieve.ToString Me.lblTx.Text = COM1Transmit.ToString ReadCom(COM1Recieve, COM1Transmit) End Sub Edited March 8, 2014 by djp122 Link to comment Share on other sites More sharing options...
friedrich Posted March 10, 2014 Report Share Posted March 10, 2014 1) download the latest download by Paul Henty 2) Read the complete VB.net example. FSUIPCClientExample_VB (Form1.vb) 3) Refer to the "Timer1_Tick" Section. You need the Timer Tick. Within this Timer Tick you declare for example: The Timer tick is reading data every 200 ms for example. Me.Timer1.Interval = 200 Me.Timer1.Enabled = True ecc..... ' COM2 frequency ' Shows decoding a DCD frequency to a string ' a. Convert to a string in Hexadecimal format Dim com2String As String = com2bcd.Value.ToString("X") ' b. Add the assumed '1' and insert the decimal point com2String = "1" & com2String.Substring(0, 2) & "." & com2String.Substring(2, 2) Me.txtCOM2.Text = com2String This is the way you get a continous update for all data you declare. You do not need any Button for it. You can read and Set all data. regards, Friedrich . Link to comment Share on other sites More sharing options...
Graham Pollitt Posted March 10, 2014 Report Share Posted March 10, 2014 3) Refer to the "Timer1_Tick" Section. You need the Timer Tick. Within this Timer Tick you declare for example: The Timer tick is reading data every 200 ms for example. Me.Timer1.Interval = 200 Me.Timer1.Enabled = True ecc..... . No you wouldn't set the interval nor enable the timer within the 'tick' routine as it would never start Set the interval in the form load section or at design time if the interval does not need to be changed and start the timer when the app is started Link to comment Share on other sites More sharing options...
friedrich Posted March 10, 2014 Report Share Posted March 10, 2014 No you wouldn't set the interval nor enable the timer within the 'tick' routine as it would never start Set the interval in the form load section or at design time if the interval does not need to be changed and start the timer when the app is started Yes you are right. I forgot to mention it separately. Anyhow the import thing is the Timer1_Tick section for our friend 'djp122'. regards, Friedrich Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now