Hi Paul,
Thanks, glad you're happy with it- I'm really excited about this new method of integrating ViewPort into all sorts of applications. While DDE is ancient, it's perfect for this purpose- it's simple and it works! Yes, the data in ViewPort is pure- arrays are from one sample(the conduit provides an indicator that tells when you should burst your samples into the array- similar to the vertical refresh signal from monitors) and values are atomic and use out of band markers. Lots of complex stuff behind the scenes that makes it trivial to share data from the Propeller with Windows applications. Sleeping is overrated, raising kids the right way takes time... ViewPort's DDE client and server are working well- will do a bit more testing/documentation/samples. Am working on Spinner/PropScope/book/ViewPort in parallel, but expect a new release end of this week (end of July).
Hanno
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ Download a free trial of ViewPort- the premier visual debugger for the Propeller
Includes full debugger, simulated instruments, fuzzy logic, and OpenCV for computer vision. Now a Parallax Product!
Here's the complete VB.NET code to do pretty much anything with programs running on a Propeller. You can load a spin file, list variables, get details for variables, retrieve values and change values- for single variables as well as arrays. Also, triggers and callbacks and a variety of formats... DLL source code will be open... Now I need to sleep- tomorrow some last testing and then it's baked!
Hanno
'vpClient Sample Application
'August 2009 v0.5 mydancebot.com
'This program demonstrates how to use the vpclient dll to interface with the ViewPort library.
'Your program needs to include the "vpclient.dll" as a reference.
'This program maps each vpclient function to a button to allow you to try out the full functionality.
'
'You typically start and stop each session by calling "connect" and "disconnect".
'During a session use: "execute" to perform commands- like telling ViewPort to load a spin file.
' Use "request" to retrieve data from ViewPort- like the value of a Spin variable or array.
' Use "poke" to send data to ViewPort, for example- changing a Spin variable to a new number.
' Use "startAdvise" to start an advise loop, the "advise" event will fire with your requested data
'
'Each function returns with a status string. If an error has occured, the status will start with an exclamation mark
'The "advise" and "request" functions require a "format". Use 1 to get numbers in scientific notation with units
' Use 2 to get raw integers. Use 4 to get raw bytes.
'View the "mainform_load" function to see what commands you can use
Imports vpClient
Public Class MainForm
Dim WithEvents vp As vpClient.Main
Private Sub connectB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles connectB.Click
statusT.Text = vp.connect()
End Sub
Private Sub disconnectB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles disconnectB.Click
statusT.Text = vp.disconnect()
End Sub
Private Sub executeB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles executeB.Click
statusT.Text = vp.execute(executeC.Text)
End Sub
Private Sub requestB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles requestB.Click
Dim format As Integer = Val(requestformat.Text)
Dim b As Byte() = Nothing
statusT.Text = vp.request(requestC.Text, format, b)
resultT.Text = vp.decode(b, format)
End Sub
Private Sub pokeB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pokeB.Click
statusT.Text = vp.poke(pokeC.Text, pokeDataT.Text)
End Sub
Private Sub startAdviseB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles startAdviseB.Click
statusT.Text = vp.startAdvise(adviseC.Text, Val(AdviseFormatT.Text))
End Sub
Private Sub stopAdvise_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles stopAdvise.Click
statusT.Text = vp.stopAdvise(adviseC.Text, Val(AdviseFormatT.Text))
End Sub
Private Sub doAdvise(ByVal b As Byte(), ByVal format As Integer) Handles vp.advise
AdviseT.Text = vp.decode(b, format)
End Sub
Private Sub MainForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
vp = New vpClient.Main(Me)
Dim file As String = Application.StartupPath + "\ddesample.spin"
executeC.Items.Add("connect disconnect".Split) 'connect/disconnect ViewPort to/from the Propeller
executeC.Items.Add("link(n,myserver|get!n)") 'when the dde server's value changes, ViewPort variable "n" will change
executeC.Items.Add("unlink unadvise".Split) 'clear all "links" or "advise" loops
executeC.Items.Add("load(" + file + ")") 'compile and load the file to the Propeller and connect
requestC.Items.Add("list") 'lists all variables available to poke/request/advise
requestC.Items.Add("detail(n)") 'provides details on variable "n"
requestC.Items.AddRange("n m n_m".Split) 'retrieves the value of 1 or more variable values
requestC.Items.AddRange("$spacer $update".Split) 'use these special variables to set the spacer between variables, and the update rate in milliseconds
pokeC.Items.AddRange("m n $spacer $update".Split) 'set the value of a single variable
adviseC.Items.AddRange("n m n_m rise_n_5000_n_m".Split) 'rise_n_5000_n_m sets a trigger which returns the value of "n" and "m"
'a trigger starts with "rise" or "fall" followed by the variable and the trigger value. Specify the result at the end
adviseC.SelectedIndex = 0
executeC.SelectedIndex = 0
requestC.SelectedIndex = 0
pokeC.SelectedIndex = 0
End Sub
End Class
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ Download a free trial of ViewPort- the premier visual debugger for the Propeller
Includes full debugger, simulated instruments, fuzzy logic, and OpenCV for computer vision. Now a Parallax Product!
Outstanding Hanno, Outstanding!
I am not a VB coder, but it should be easy to connect to your dll from my Delphi or LabView drivers. I will post the results.
1) Do you know if your .NET dll requires .NET compatible calling codes? I think my Delphi has a .NET variant, not LabView.
2) An option with ViewPort closes the Conduit if VP loses the focus. Is the DDE system still active in this case?
3) Does your VP code call the propellant dll to compile/load? Could this be made user selectable (eg bst, homespun) since these variants are starting to show some very interesting options etc.
See, sleep does have some practical aspects!
Cheers!
Paul Rowntree
Outstanding job! That is the code I wrote for handling DDE callback messages myself, after referring to code I wrote 10 years ago for an international bank.
Simple, reliable and fast. Yay!
This morning I whipped together a Python client for ViewPort- lots of fun, here it is:
#open the connection to ViewPort
import win32ui,dde,sys,time
ddeClient = dde.CreateServer()
ddeClient.Create("")
vp = dde.CreateConversation(ddeClient)
vp.ConnectTo("vp", "system")
#compile, load, and connect to a spin file
vp.Exec("load("+sys.path[noparse][[/noparse]0]+"\sample.spin)")
print "Spin file is sharing these:"+vp.Request("list")
#request and poke a variable
print "Variable m's value is:"+vp.Request("m")
vp.Poke("m","1234")
time.sleep(.1)
print "After a poke, its value is:"+vp.Request("m")
raw_input("Press Enter to exit")
Enjoy!
Hanno
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ Download a free trial of ViewPort- the premier visual debugger for the Propeller
Includes full debugger, simulated instruments, fuzzy logic, and OpenCV for computer vision. Now a Parallax Product!
On another thread http://forums.parallax.com/showthread.php?p=841655 heater and CRM requested that ViewPort include a web server to allow cross-network/cross platform api access. dMajo brought up the excellent point that DDE already supports a "network service", so in theory, ViewPort should already support DDE access by multiple clients, connecting from multiple machines in multiple languages. From quick googling, it looks like non-windows os's support DDE- including non-windows applications- including OpenOffice.
Hanno
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ Download a free trial of ViewPort- the premier visual debugger for the Propeller
Includes full debugger, simulated instruments, fuzzy logic, and OpenCV for computer vision. Now a Parallax Product!
My Google for "linux dde" only comes up with this:
"the problem with what you are trying to
do (and why you don't find it) is this : DDE and OLE and DCOM are
proprietary MS interfaces. The support for them exists only on MS
platforms (Windows)."
and then stuff about the Linux "Device Driver Environment".
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ Download a free trial of ViewPort- the premier visual debugger for the Propeller
Includes full debugger, simulated instruments, fuzzy logic, and OpenCV for computer vision. Now a Parallax Product!
Your second link there is a Tcl man page and says " This command allows an application to send Dynamic Data Exchange (DDE) command when running under
Microsoft Windows."
Not sure what the first one is about[noparse]:([/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
For what it is worth, I have searched for DDE support under Lazarus (Free Pascal Compiler) but no joy so far. I take this to mean that no-one has created a look-alike for the linux os. On my LabVIEW system the DDE support is buried under the 'Platform' set of vi's, which are supposed to be platform-specific.
Cheers!
Paul Rowntree
Comments
Thanks, glad you're happy with it- I'm really excited about this new method of integrating ViewPort into all sorts of applications. While DDE is ancient, it's perfect for this purpose- it's simple and it works! Yes, the data in ViewPort is pure- arrays are from one sample(the conduit provides an indicator that tells when you should burst your samples into the array- similar to the vertical refresh signal from monitors) and values are atomic and use out of band markers. Lots of complex stuff behind the scenes that makes it trivial to share data from the Propeller with Windows applications. Sleeping is overrated, raising kids the right way takes time... ViewPort's DDE client and server are working well- will do a bit more testing/documentation/samples. Am working on Spinner/PropScope/book/ViewPort in parallel, but expect a new release end of this week (end of July).
Hanno
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Download a free trial of ViewPort- the premier visual debugger for the Propeller
Includes full debugger, simulated instruments, fuzzy logic, and OpenCV for computer vision. Now a Parallax Product!
Hanno
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Download a free trial of ViewPort- the premier visual debugger for the Propeller
Includes full debugger, simulated instruments, fuzzy logic, and OpenCV for computer vision. Now a Parallax Product!
I am not a VB coder, but it should be easy to connect to your dll from my Delphi or LabView drivers. I will post the results.
1) Do you know if your .NET dll requires .NET compatible calling codes? I think my Delphi has a .NET variant, not LabView.
2) An option with ViewPort closes the Conduit if VP loses the focus. Is the DDE system still active in this case?
3) Does your VP code call the propellant dll to compile/load? Could this be made user selectable (eg bst, homespun) since these variants are starting to show some very interesting options etc.
See, sleep does have some practical aspects!
Cheers!
Paul Rowntree
Outstanding job! That is the code I wrote for handling DDE callback messages myself, after referring to code I wrote 10 years ago for an international bank.
Simple, reliable and fast. Yay!
Family First - everything else second.
Have a good one, Hanno.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
JMH
Beta of ViewPort v4.2 is here: mydancebot.com/viewport/beta.php
A video and link to download the sample clients is here: mydancebot.com/viewport/clients.php
This morning I whipped together a Python client for ViewPort- lots of fun, here it is:
Enjoy!
Hanno
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Download a free trial of ViewPort- the premier visual debugger for the Propeller
Includes full debugger, simulated instruments, fuzzy logic, and OpenCV for computer vision. Now a Parallax Product!
Hanno
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Download a free trial of ViewPort- the premier visual debugger for the Propeller
Includes full debugger, simulated instruments, fuzzy logic, and OpenCV for computer vision. Now a Parallax Product!
"the problem with what you are trying to
do (and why you don't find it) is this : DDE and OLE and DCOM are
proprietary MS interfaces. The support for them exists only on MS
platforms (Windows)."
and then stuff about the Linux "Device Driver Environment".
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
https://bugs.launchpad.net/ubuntu/+source/openoffice.org/+bug/49163
http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/mann/dde.ntcl.html
Hanno
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Download a free trial of ViewPort- the premier visual debugger for the Propeller
Includes full debugger, simulated instruments, fuzzy logic, and OpenCV for computer vision. Now a Parallax Product!
Microsoft Windows."
Not sure what the first one is about[noparse]:([/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
Cheers!
Paul Rowntree
It's an OLD technology, came out about the time of "drag and drop" - actually, that might be DDE based.
StoneKnives -> DDE -> COM ->DCOM ->.Net
(and not necessarily an "evolutionary" step forward [noparse]:)[/noparse])
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔