Motion Control Systems - A Complete Family of Motion ...
Note: Visual Basic Example for DDE Server and Excel
Product: DDE Server
Date: 12/10/95
Application Note
| |
While precautions have been taken in the preparation of this note, CTC and the author assume no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained herein.
| |
Rem COMPUTER TECHNOLOGY CORPORATION
Rem INTERACT DDE SERVER DEMONSTRATION JANUARY 1995
Rem VERSION 4.00
Sub WRITE_DATA()
PWSTATION = "PWSTATION\DVR\1:" 'SET THE STRING
ONE_UP = 1 'SET ADDRESS INCREMENT
ADDRESS_UP = 3 'SET THE CELL ADDRESS
CHAN_00 = DDEInitiate("INTERACT", "VALUE") 'Open DDE link
For THREE_WRITES = 1 To 3
PWR = PWSTATION & ONE_UP 'CONCAT ADDRESS STRING
DDEPoke CHAN_00, PWR, Cells(10, ADDRESS_UP) 'WRITE DATA VIA DDE
ONE_UP = ONE_UP + 5 'INCREMENT ADDRESS BY 5
ADDRESS_UP = ADDRESS_UP + 3 'INCREMENT CELL ADDRESS
Next THREE_WRITES
DDETerminate CHAN_00
End Sub
Sub CLEAR_DATA()
PWSTATION = "PWSTATION\DVR\1:" 'SET THE STRING
ONE_UP = 1 'SET ADDRESS INCREMENT
CHAN_00 = DDEInitiate("INTERACT", "VALUE")
For THREE_WRITES = 1 To 3
PWR = PWSTATION & ONE_UP 'CONCAT ADDRESS STRING
DDEPoke CHAN_00, PWR, Cells(43, 1) 'WRITE DATA VIA DDE
ONE_UP = ONE_UP + 5 'INCREMENT ADDRESS BY 5
Next THREE_WRITES
DDETerminate CHAN_00
End Sub
Sub SNAPSHOT()
Cells(43, 5) = 250
CHAN_00 = DDEInitiate("INTERACT", "VALUE")
Cells(13, 2) = DDERequest(CHAN_00, "PWSTATION\DVR\TIMER1%100")
Cells(43, 2) = DDERequest(CHAN_00, "PWSTATION\DVR\TIMER1%100")
Cells(20, 3) = Cells(43, 5) - Cells(43, 2)
Cells(23, 2) = DDERequest(CHAN_00, "PWSTATION\DVR\TIMER1")
Cells(22, 4) = DDERequest(CHAN_00, "PWSTATION\DVR\TIMER2")
Cells(21, 4) = DDERequest(CHAN_00, "PWSTATION\DVR\TIMER3")
Cells(43, 3) = DDERequest(CHAN_00, "PWSTATION\DVR\TIMER2%500")
Cells(43, 4) = DDERequest(CHAN_00, "PWSTATION\DVR\TIMER1%500")
Cells(20, 4) = Cells(43, 3) + Cells(43, 4)
DDETerminate CHAN_00
End Sub
Sub SEND_MSG()
ASCII_MSG = Application.InputBox(PROMPT:="ENTER ASCII MESSAGE:", Title:="Message Entry", Type:=2) 'Enter Messsage
If IsNull(ASCII_MSG) = True Then 'Test entry for NULL
MsgBox "ENTER A VALID ASCII MESSAGE.", vbExclamation, "Message Entry"
Else
If ASCII_MSG False Then 'Test for CANCEL Selection
Cells(8, 4) = ASCII_MSG 'Display last message entered
CHAN_00 = DDEInitiate("INTERACT", "TEXT")
DDEPoke CHAN_00, "PWSTATION\LINK\messagein:A", Cells(8, 4) 'Write Message
DDETerminate CHAN_00
End If
End If
End Sub
Sub AUTO_TREND()
CHAN_00 = DDEInitiate("INTERACT", "VALUE")
For NumberOfSamples = 1 To 20
Range(Cells(NumberOfSamples + 1, 1), Cells(NumberOfSamples + 1, 5)).Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Cells(1, 50) = DDERequest(CHAN_00, "PWSTATION\DVR\TIMER1")
Cells(1, 51) = DDERequest(CHAN_00, "PWSTATION\DVR\TIMER2")
Cells(1, 52) = DDERequest(CHAN_00, "PWSTATION\DVR\TIMER3")
VALUE1 = Cells(1, 50)
VALUE2 = Cells(1, 51)
VALUE3 = Cells(1, 52)
ZALUEA = (Cos(VALUE2) * 200) + 200
ZALUEB = (Sin(VALUE2) * 200) + 575
ZALUEC = ((Sin(VALUE2) * Cos(VALUE1)) * 200) + VALUE3
Cells(NumberOfSamples + 1, 1) = NumberOfSamples
Cells(NumberOfSamples + 1, 2) = ZALUEA
Cells(NumberOfSamples + 1, 3) = ZALUEB
Cells(NumberOfSamples + 1, 4) = ZALUEC
Cells(NumberOfSamples + 1, 5) = Time
DoEvents
Range(Cells(NumberOfSamples + 1, 1), Cells(NumberOfSamples + 1, 5)).Select
With Selection.Interior
.ColorIndex = 2
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
For hold = 1 To 500
Next hold
Next NumberOfSamples
DDETerminate CHAN_00
End Sub
Sub RECIPE1()
Cells(7, 2) = "DUROGOOP"
P_SCALE = 1
Cells(9, 5) = "RESIN 1"
Cells(10, 5) = "RESIN 2"
Cells(11, 5) = "RESIN 3"
Cells(12, 5) = "SECRETX"
Cells(13, 5) = "COLOR RED"
Cells(43, 7) = 220
Cells(44, 7) = 320
Cells(45, 7) = 100
Cells(46, 7) = 45
Cells(47, 7) = 10
End Sub
Sub RECIPE2()
Cells(7, 2) = "PLASTECH"
Cells(7, 8) = 100
Cells(9, 5) = "RESIN 1"
Cells(10, 5) = "RESIN 2X"
Cells(11, 5) = "RESIN 3Y"
Cells(12, 5) = "SECRETY"
Cells(13, 5) = "COLOR ORANGE"
Cells(43, 7) = 230
Cells(44, 7) = 350
Cells(45, 7) = 75
Cells(46, 7) = 12
Cells(47, 7) = 1
End Sub
Sub RECIPE3()
Cells(7, 2) = "SUPRARES"
Cells(7, 8) = 100
Cells(9, 5) = "RESIN 1"
Cells(10, 5) = "EPOXY A"
Cells(11, 5) = "RESIN 3X"
Cells(12, 5) = "SECRETZ"
Cells(13, 5) = "COLOR BLACK"
Cells(43, 7) = 250
Cells(44, 7) = 250
Cells(45, 7) = 140
Cells(46, 7) = 78
Cells(47, 7) = 3
End Sub
Sub PERCENT_SCALE()
Rem GET AND VALIDATE PERCENT ENTRY
TEMP = Cells(7, 8) 'SAVE CURRENT SCALE
P_SCALE = Application.InputBox(PROMPT:="ENTER THE PERCENT VALUE TO SCALE THE RECIPE VALUES:", Title:="Percent Scale", Type:=1)
If IsNumeric(P_SCALE) Then
If P_SCALE < 1 Or P_SCALE > 100 Then
If P_SCALE = False Then
P_SCALE = TEMP 'RESTORE ORIGINAL SCALE
Else
MsgBox "ENTER A VALUE BETWEEN 1 AND 100.", vbExclamation, Title:="Percent Scale"
P_SCALE = TEMP 'RESTORE ORIGINAL SCALE
End If
End If
Else
MsgBox "ENTRY MUST BE BETWEEN 1 AND 100."
P_SCALE = TEMP 'RESTORE ORIGINAL SCALE
End If
Cells(7, 8) = P_SCALE 'WRITE NEW SCALE
End Sub
Sub SEND_RECIPE()
CHAN_01 = DDEInitiate("INTERACT", "TEXT")
DDEPoke CHAN_01, "PWSTATION\LINK\RECIPE:A", Cells(7, 2) 'RECIPE NAME SENT
DDETerminate CHAN_01
PWSTATION = "PWSTATION\DVR\2:" 'SET THE STRING
ONE_UP = 1 'SET ADDRESS INCREMENT
ADDRESS_UP = 9 'SET THE CELL ADDRESS
CHAN_00 = DDEInitiate("INTERACT", "VALUE")
For FIVE_WRITES = 1 To 5
PWR = PWSTATION & ONE_UP 'CONCAT ADDRESS STRING
DDEPoke CHAN_00, PWR, Cells(ADDRESS_UP, 7) 'WRITE DATA
ONE_UP = ONE_UP + 1 'INCREMENT ADDRESS BY 1
ADDRESS_UP = ADDRESS_UP + 1 'INCREMENT CELL ADDRESS
Next FIVE_WRITES
DDETerminate CHAN_00
End Sub
Rem JAS 1/01/95
| |
[pic]
The Shortest Distance Between Man and Machine
50 W. TechneCenter Dr. w Milford, OH 45150
Phone (513) 831-5042 w Technical Support Phone: (513) 248-1714
Internet: w E-Mail: support@
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- control systems in the workplace
- inventory control systems tools examples
- inventory control systems for warehouse
- inventory control systems for manufacturing
- five parts of a complete sentence
- components of a complete sentence
- which of these is a complete sentence
- quality control systems examples
- definition of a complete sentence
- 5 parts of a complete sentence
- control systems engineer salary
- document control systems free examples