tailieunhanh - excel by example a microsoft excel cookbook for electronics engineers phần 10

Kể từ khi người dùng có thể làm việc trên một trong hai tấm, tôi đặt các nút lệnh trên cả hai lá và sự kiện nhấp chuột của một trong hai chỉ đơn giản gọi thủ tục Tải về. Hình 16-13 cho thấy kết quả đầu ra trên một oscilloscope. | Example 16 Function Generator Interface If varReturnedData 1 Then it passes Else erroneous return but I am not sure what to do with it End If now for the data comInputModeBinary varWavedata bytWaveData placing array in variant varWavedata and then set the mode comInputModeText TransmitBuffer FUNC5 Chr 13 TransmitBuffer End Sub I decided that this procedure should only be run from a specific user button command as the detection of a user-induced change could be quite complex. Since the user could be working on either sheet I placed Command buttons on both sheets and the click event of either simply calls the Download procedure. Figure 16-13 shows the resulting output on an oscilloscope. Figure 16-13 Output waveform. Note the distortion introduced and the stepped output due to the fairly coarse granularity. 325 Excel by Example Setting the Amplitude Rather than using the approach of the DS345 Function Generator of defining the output as amplitude I chose to work with volts peak-to-peak since this means we don t have to consider the moving midpoint when we are working with a signal with the minimum fixed at 0V. I added two Text boxes and a Scroll Bar as in Figure 16-14. Any change in the scroll bar value is transmitted to the DS345. The scroll bar is actually set up in percent minimum of 0 and maximum of 100 because the output will change from 20 Vpp maximum for a signal about the time axis and 10 Vpp maximum for a signal from the time axis. The resultant voltage is also displayed in one of the text boxes the other acts as a heading . The code for the scroll bar change looks like this Private Sub scrVpp_Change Dim varVpp As Variant varVpp - 100 as a If Worksheets 2 .Range Style From Zero Then Worksheets 2 .Range vpp .Value varVpp 10 Else Worksheets 2 .Range vpp .Value varVpp 20 End If Str Worksheets 2 .Range vpp .Value V Call .

TỪ KHÓA LIÊN QUAN