VBA PCL's(programmable Logic controllers

Discussion in 'AutoCAD' started by Paul Richardson, Oct 19, 2004.

  1. Hi All,

    Has anyone driven a PLC from VBa? If so, do you have
    any sample code? I am using an OPC/DDE server(dll's)
    from KEP Direct and driving a D-260 PLC.

    Y'all have fun at AU this year. Don't feel bad because I cannot
    go :-(

    Cheers,
    Paul
     
    Paul Richardson, Oct 19, 2004
    #1
  2. Paul Richardson

    Tim Riley Guest

    On Tue, 19 Oct 2004 05:50:04 -0400, Paul Richardson wrote:

    I've never tried but you might be able to find some useful information at
    http://www.opcfoundation.org/ .

    ~Tim Riley
     
    Tim Riley, Oct 19, 2004
    #2
  3. Great Site...Thanks Tim.
     
    Paul Richardson, Oct 20, 2004
    #3
  4. Paul Richardson

    Tim Riley Guest

    Please keep me posted on what you come up with. We do a lot of PLC work and
    I'd be interested in your results.

    ~Tim Riley
     
    Tim Riley, Oct 20, 2004
    #4
  5. Tim,

    I am using KEPDirect as a server to connect between
    the computer and the PLC's. KEP comes with dll's to interface
    from VBa and C++. Not a lot of samples but got excel vba
    sending data from my pc to the pcl last night. Still haven't gotten
    the kinks out. Hopefully by the end of the day. If you want the
    vb code I'll send it when it's up right.

    Have you done any work with OMGA Stop...I need to remove
    their PLC from it's Positioning System and drive it myself. By
    it I mean the the ARM and Stop of the Positioning System. The
    drivers seem to be unique to OMGA. I have it attached to a
    chopsaw that's cutting Logs

    Thanks,
    Paul
     
    Paul Richardson, Oct 20, 2004
    #5
  6. Paul,
    As a non-architectural, fairly non-mechanical person, it's been interesting
    following your posts over the past year or two that I've been in this group.
    IIRC, you've covered everything from
    -- designers sending CAD info to a master DB over the web
    -- optimizing a cut-list of logs given arbitrary wall and roof shapes
    -- and now, automatically cutting logs (presumably, based on the above
    BoM)

    I'm looking forward to seeing a website sometime soon where I can put in
    dimensions for my own log home, push a button, and have the labeled, cut
    logs show up at my house a couple weeks later.

    Let us know when you're there :)

    James
     
    James Belshan, Oct 20, 2004
    #6
  7. Getting close James...Thanks for the interest...
    Yes all of my posts have been for the same project.
    A lot of learning on the fly and no sleep..
    I want the Plans to be sent back to the customer
    instantaneously..or so limited by fiberoptic
    friction...)

    Program runs Full Log home automation from
    simple AutoCAD input to a sorted pile of logs
    stacked in containers for easy assembly on site.
    Everything is predrilled, and barcoded for
    inventory control. Crayon printer lables logs
    for assemblers. New assembly line has one
    operator for 7 new machines. Old line had
    one for each.

    My Thanks to Everybody here...Truly...Your help
    has been invaluable...

    Paul
     
    Paul Richardson, Oct 20, 2004
    #7
  8. Tim,

    I got it finished..Well working properly..I used stright VB
    with OfficeTools. Added an excel sheet component to a form.
    User selects a row in spreadsheet hits send and an array of data
    in the row (or single cell) is sent to PLC.

    I used KepServerEX http://www.kepware.com/Products/products_download.html
    Download comes with samples in vb and c++...open source
    for the server which is nice...The code below is base on
    VB samples...Downloading will help.

    gl..Paul

    Basic Idea Semi Pseudo...

    'Connect to Server...
    '*******
    'Define channels to open'Var Array
    OPCItemIDs(1) = "ChopInt.ChopPLC.LData.NewDataString"
    '*******
    'Set value to write and send via OPCItemWriteButton Function
    Dim intRowNum As Integer
    Dim strCellName As String
    'Find Row of active Cell
    intRowNum = Spreadsheet1.ActiveCell.Row
    'Send Cell value through proper channel
    dblClm1 = Spreadsheet1.Cells(intRowNum, 1)
    varWrite(1) = dblClm1'could also send whole array
    '0 is channel, varWrite is value to write...
    Call OPCItemWriteButton(0, varWrite(1))
    '*******

    '*******Write Funciton
    Private Function OPCItemWriteButton _
    (Index As Integer, inValue As Variant)

    Dim SyncItemValues(1) As Variant
    Dim SyncItemServerHandles(1) As Long
    Dim SyncItemServerErrors() As Long

    SyncItemServerHandles(1) = ItemServerHandles(Index + 1)

    ' Load the value to be written

    SyncItemValues(1) = Val(inValue)

    ' Invoke the SyncWrite operation.
    ConnectedGroup.SyncWrite ItemCount, _
    SyncItemServerHandles, _
    SyncItemValues, SyncItemServerErrors

    End Function
    '*****
     
    Paul Richardson, Oct 25, 2004
    #8
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.