Solved

# Simulating a microwave signal with variable frequency.

Posted on 2003-03-17
Medium Priority
196 Views
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
Question by:nickclaridge
• 2

LVL 11

Accepted Solution

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

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

ID: 8205080
0

## Featured Post

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
###### Suggested Courses
Course of the Month12 days, 17 hours left to enroll