?
Solved

Simulating a microwave signal with variable frequency.

Posted on 2003-03-17
3
Medium Priority
?
194 Views
Last Modified: 2010-05-03
I am new to VB and am trying to work out how to simulate a microwave signal between 8-12GHz. I Know how to assign the frequency to a scroll bar on the form but i am stuck with simulating the actual signal. I have to display a section of a wave 70mm long and I am not sure how to do this either. If you have any code that can aid me with this it would be most helpful.

regards Nick
0
Comment
Question by:nickclaridge
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
supunr earned 180 total points
ID: 8156811
add a picture box to your project called picture1. and put this code to a button click event

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub Command1_Click()
    Dim i As Single
    Dim Frequency As Single
    Dim Period As Single
   
    Picture1.AutoRedraw = True
   
    Do
    For Frequency = 8 To 12 Step 0.1 ' GHz
   
        Picture1.Cls
        Picture1.Scale (-0.01, 1.5)-(5, -1.5)
        Picture1.Line (0, 0)-(10, 0)
        Picture1.Line (0, -1.5)-(0, 1.5)
       
        Picture1.CurrentX = 0
        Picture1.CurrentY = 0
       
        Period = 1# / Frequency
        For i = 0 To 5 Step 0.001
            Picture1.Line -(i, Sin(i / Period))
        Next i
        DoEvents
        Sleep 200
    Next Frequency
    DoEvents
    Loop
End Sub


you should be able to figure out the rest.  Hope this is useful.

Good Luck!
0
 

Author Comment

by:nickclaridge
ID: 8160419
This is very helpful. Thanks. However what modifications would I have to make in order to have the frequency no changing automatically but be dependant on the value corresponding to that of a scroll bar?
0
 

Author Comment

by:nickclaridge
ID: 8205080
Thanks for your help.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month13 days, 11 hours left to enroll

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question