Announcement

Collapse
No announcement yet.

Another 3rd party COM/PB9 question...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Another 3rd party COM/PB9 question...

    Hello,

    In an attempt to solve my own [closely related] problem, I followed the former post on this subject to its conclusion, but still couldn't get past the 'establish an rs232 connection' phase of my project.

    To begin, I used the COM browser [with default settings] to generate an include file, and then I attempted the following:

    'create an instance of ISMIComm
    STATIC commObject AS ISMIComm
    LET commObject = NEWCOM $PROGID_SMIENGINELib_SMIHost

    ISOBJECT returns TRUE, so I'm assuming I did something right.

    Now on to the next part. To set the baud rate and parity of the target comm port, and then open it, I've done the following:

    COMBOBOX GET TEXT CBHNDL, %IDC_BAUD TO setting
    commObject.BaudRate=VAL(setting)
    commObject.PARITY=%smi_none
    COMBOBOX GET TEXT CBHNDL, %IDC_COMPORT TO setting
    commObject.OpenPort(UCODE$(setting))

    HEX$(OBJRESULT) returns 80004005, which seems to suggest I've really screwed something up. Advice please?


    The include file:

    Code:
    ' Generated by: PowerBASIC COM Browser v.2.00.0058
    ' DateTime    : 10/28/2008 at 4:16 PM
    ' ------------------------------------------------
    ' Library Name: SMIENGINELib
    ' Library File: C:\WINDOWS\system32\SMIEngine.dll
    ' Description : SMIEngine 2.0 Type Library
    ' GUID : {BC26FBAC-00E1-11D4-B5D0-00600831E1F3}
    ' LCID : 0
    ' Version : 2.0
    
    ' Version Dependant ProgID's
    $PROGID_SMIENGINELib_SMIHost1 = "SMIEngine.SMIHost.1"
    $PROGID_SMIENGINELib_SMIScan1 = "SMIEngine.SMIScan.1"
    
    ' Version Independant ProgID's
    $PROGID_SMIENGINELib_SMIHost = "SMIEngine.SMIHost"
    $PROGID_SMIENGINELib_SMIScan = "SMIEngine.SMIScan"
    
    ' Class Indentifiers
    $CLSID_SMIENGINELib_SMIHost = GUID$("{BC26FBBA-00E1-11D4-B5D0-00600831E1F3}")
    $CLSID_SMIENGINELib_SMIMotor = GUID$("{D3A8EE8B-CAEF-40B6-8FD1-D43D498FE3A0}")
    $CLSID_SMIENGINELib_SMIScan = GUID$("{86DF7FB1-BE6A-40DB-85CC-DF71511EC21A}")
    
    ' Interface Indentifiers
    $IID_SMIENGINELib_ISMIComm = GUID$("{BC26FBB8-00E1-11D4-B5D0-00600831E1F3}")
    $IID_SMIENGINELib_ISMIMotor = GUID$("{0FBA614D-B688-4D74-9D8A-E592DA3F65D3}")
    $IID_SMIENGINELib_ISMICMotion = GUID$("{BC26FBB9-00E1-11D4-B5D0-00600831E1F3}")
    $IID_SMIENGINELib_ISMIPath = GUID$("{B998E60D-DB45-4B64-A149-CC7BD21311DE}")
    $IID_SMIENGINELib_ISMIScan = GUID$("{124D89B8-26B4-42A9-B988-C2A38D57CAED}")
    $IID_SMIENGINELib_ISMIErrors = GUID$("{D1B5EE00-2230-44E3-878A-55263DA82E3D}")
    
    ' Macros
    MACRO enum_parity = LONG
    MACRO enum_arcdirection = LONG
    
    ' __MIDL___MIDL_itf_SMIEngine_0000_0001 enumeration
    %smi_none = 0
    %smi_odd = 1
    %smi_even = 2
    %smi_mark = 3
    %smi_space = 4
    
    ' __MIDL___MIDL_itf_SMIEngine_0000_0002 enumeration
    %smi_counterclockwise = 0
    %smi_clockwise = 1
    
    
    ' Interface Name  : ISMIComm
    ' Description     : ISMIComm Interface
    ' ClassID         : $CLSID_SMIENGINELib_SMIHost
    ' ProgID          : $PROGID_SMIENGINELib_SMIHost
    ' Version ProgID  : $PROGID_SMIENGINELib_SMIHost1
    INTERFACE ISMIComm $IID_SMIENGINELib_ISMIComm 
        INHERIT IDISPATCH
    
        METHOD OpenPort <1> (BYREF PortName AS STRING)
        METHOD ClosePort <2> ()
        PROPERTY GET PortHandle <3> () AS LONG
        METHOD ClearBuffer <4> ()
        PROPERTY GET BytesAvailable <5> () AS LONG
        METHOD WriteCommand <6> (BYVAL COMMAND AS STRING)
        METHOD WriteString <7> (BYVAL PB_Data AS STRING)
        METHOD ReadResponse <8> () AS STRING
        METHOD ReadString <9> (BYVAL NoOfBytes AS LONG) AS STRING
        METHOD EstablishChain <10> ()
        METHOD AddressMotorChain <11> () AS LONG
        METHOD Wait <12> (BYVAL Time AS LONG)
        PROPERTY GET DefaultMotor <13> () AS LONG
        PROPERTY SET DefaultMotor <13> (BYVAL pVal AS LONG)
        PROPERTY GET Echo <14> () AS INTEGER
        PROPERTY SET Echo <14> (BYVAL pVal AS INTEGER)
        PROPERTY GET PARITY <15> () AS LONG
        PROPERTY SET PARITY <15> (BYVAL pVal AS LONG)
        PROPERTY GET BaudRate <16> () AS LONG
        PROPERTY SET BaudRate <16> (BYVAL pVal AS LONG)
        PROPERTY GET TIMEOUT <17> () AS LONG
        PROPERTY SET TIMEOUT <17> (BYVAL pVal AS LONG)
        PROPERTY GET CharDelay <18> () AS LONG
        PROPERTY SET CharDelay <18> (BYVAL pVal AS LONG)
        PROPERTY GET PortName <28> () AS STRING
        METHOD GetResponseOf <29> (BYVAL COMMAND AS STRING) AS STRING
        METHOD GetMotor <30> (BYVAL Address AS LONG) AS ISMIMotor
        PROPERTY GET MaxMotors <31> () AS LONG
        PROPERTY SET MaxMotors <31> (BYVAL pVal AS LONG)
        METHOD Download <32> (BYVAL Motor AS LONG, BYVAL FileName AS STRING)
        METHOD Upload <33> (BYVAL Motor AS LONG, BYVAL FileName AS STRING)
        METHOD ForceUpload <34> (BYVAL Motor AS LONG, BYVAL FileName AS STRING)
        PROPERTY GET IsRS485 <35> () AS LONG
        PROPERTY SET IsRS485 <35> (BYVAL pVal AS LONG)
        METHOD ClearEEPROM <36> (BYVAL Motor AS LONG)
        METHOD InitializeNotification <37> (BYVAL hWindow AS LONG, BYVAL message AS LONG)
        METHOD WriteCmd <38> (BYVAL COMMAND AS STRING)
        METHOD InitRS485 <39> (BYVAL NoOfMotors AS LONG, BYVAL MotorChannel AS LONG)
        PROPERTY GET TxMaxRetry <40> () AS LONG
        PROPERTY SET TxMaxRetry <40> (BYVAL pVal AS LONG)
        PROPERTY GET TxTimeoutMul <41> () AS LONG
        PROPERTY SET TxTimeoutMul <41> (BYVAL pVal AS LONG)
        PROPERTY GET TxTimeoutConst <42> () AS LONG
        PROPERTY SET TxTimeoutConst <42> (BYVAL pVal AS LONG)
        PROPERTY GET LogFlags <43> () AS LONG
        PROPERTY SET LogFlags <43> (BYVAL pVal AS LONG)
        PROPERTY GET LogFileName <44> () AS STRING
        PROPERTY SET LogFileName <44> (BYVAL pVal AS STRING)
    END INTERFACE
    
    ' Interface Name  : ISMIMotor
    ' Description     : ISMIMotor Interface
    ' ClassID         : $CLSID_SMIENGINELib_SMIMotor
    INTERFACE ISMIMotor $IID_SMIENGINELib_ISMIMotor 
        INHERIT IDISPATCH
    
        METHOD GetPosition <1> () AS LONG
        PROPERTY GET P <2> () AS LONG
        PROPERTY SET P <2> (BYVAL pVal AS LONG)
        PROPERTY GET V <3> () AS LONG
        PROPERTY SET V <3> (BYVAL pVal AS LONG)
        PROPERTY GET A <4> () AS LONG
        PROPERTY SET A <4> (BYVAL pVal AS LONG)
        METHOD GetSpeed <5> () AS LONG
        METHOD GetAcceleration <6> () AS LONG
        METHOD Go <7> ()
        METHOD WriteCommand <8> (BYVAL COMMAND AS STRING)
        METHOD GetResponseOf <9> (BYVAL COMMAND AS STRING) AS STRING
        METHOD SetPositionMode <10> ()
        METHOD SetVelocityMode <11> ()
        PROPERTY GET Version <12> () AS STRING
        PROPERTY GET SampleRate <13> () AS DOUBLE
        METHOD WaitForStop <14> ()
        METHOD STOP <15> (BYVAL Decelerate AS LONG)
        METHOD GOTO <16> (BYVAL Position AS LONG, BYVAL Velocity AS LONG, BYVAL Acceleration AS LONG)
        METHOD Download <17> (BYVAL FileName AS STRING)
        METHOD Upload <18> (BYVAL FileName AS STRING)
    END INTERFACE
    
    ' Interface Name  : ISMICMotion
    ' Description     : ISMICMotion Interface
    ' ClassID         : $CLSID_SMIENGINELib_SMIHost
    ' ProgID          : $PROGID_SMIENGINELib_SMIHost
    ' Version ProgID  : $PROGID_SMIENGINELib_SMIHost1
    INTERFACE ISMICMotion $IID_SMIENGINELib_ISMICMotion 
        INHERIT IDISPATCH
    
        METHOD Initialize <19> (BYVAL NoOfMotors AS LONG)
        METHOD WritePosition <20> (BYVAL Motor AS LONG, BYVAL POS AS LONG)
        METHOD WriteClock <21> (BYVAL Motor AS LONG, BYVAL Clock AS LONG)
        PROPERTY GET SlotsNeeded <22> (BYVAL Motor AS LONG) AS LONG
        PROPERTY GET CurrentClock <23> (BYVAL Motor AS LONG) AS LONG
        METHOD CheckStatus <24> (BYVAL Motor AS LONG) AS LONG
        PROPERTY GET TrajectorySlots <25> () AS LONG
        PROPERTY SET TrajectorySlots <25> (BYVAL pVal AS LONG)
        PROPERTY GET Buffered <26> () AS INTEGER
        PROPERTY SET Buffered <26> (BYVAL pVal AS INTEGER)
        PROPERTY GET SampleRate <27> (BYVAL nMotor AS LONG) AS DOUBLE
        PROPERTY GET PIDFactor <28> () AS LONG
        PROPERTY SET PIDFactor <28> (BYVAL pVal AS LONG)
        METHOD EndHostMode <29> ()
        METHOD Run <30> ()
        METHOD SyncMotors <31> ()
    END INTERFACE
    
    ' Interface Name  : ISMIPath
    ' Description     : ISMIPath Interface
    ' ClassID         : $CLSID_SMIENGINELib_SMIHost
    ' ProgID          : $PROGID_SMIENGINELib_SMIHost
    ' Version ProgID  : $PROGID_SMIENGINELib_SMIHost1
    INTERFACE ISMIPath $IID_SMIENGINELib_ISMIPath 
        INHERIT IDISPATCH
    
        PROPERTY GET EndSpeed <30> () AS DOUBLE
        PROPERTY SET EndSpeed <30> (BYVAL pVal AS DOUBLE)
        PROPERTY GET Acceleration <31> () AS DOUBLE
        PROPERTY SET Acceleration <31> (BYVAL pVal AS DOUBLE)
        PROPERTY GET StartPoint <32> (BYVAL Axis AS LONG) AS DOUBLE
        PROPERTY SET StartPoint <32> (BYVAL Axis AS LONG, BYVAL pVal AS DOUBLE)
        PROPERTY GET StartClock <33> () AS LONG
        PROPERTY SET StartClock <33> (BYVAL pVal AS LONG)
        PROPERTY GET SlowToEndSpeed <34> () AS INTEGER
        PROPERTY SET SlowToEndSpeed <34> (BYVAL pVal AS INTEGER)
        METHOD SetupTimeDelta <35> (BYVAL AveTimeDelta AS LONG, OPT BYVAL MinTimeDelta AS LONG, OPT BYVAL AllowedCount AS LONG, _
            OPT BYVAL PrecedeCount AS LONG)
        METHOD GeneratePath <36> (BYVAL MaxSpeed AS DOUBLE, BYVAL TotalLength AS DOUBLE) AS VARIANT
        METHOD GenerateLinePath <37> (BYVAL MaxSpeed AS DOUBLE, BYVAL Endpoint AS VARIANT) AS VARIANT
        METHOD GenerateArcPath <38> (BYVAL MaxSpeed AS DOUBLE, BYVAL Endpoint AS VARIANT, BYVAL Center AS VARIANT, BYVAL _
            ArcDirection AS LONG) AS VARIANT
        PROPERTY GET StartSpeed <39> () AS DOUBLE
        PROPERTY SET StartSpeed <39> (BYVAL pVal AS DOUBLE)
        PROPERTY GET TimeDelta <40> () AS LONG
        PROPERTY SET TimeDelta <40> (BYVAL pVal AS LONG)
        PROPERTY GET Plane <41> () AS LONG
        PROPERTY SET Plane <41> (BYVAL pVal AS LONG)
        METHOD CreatePath <42> (BYVAL MaxSpeed AS DOUBLE, BYVAL TotalLength AS DOUBLE) AS VARIANT
        METHOD CreateLinePath <43> (BYVAL MaxSpeed AS DOUBLE, BYVAL Endpoint AS VARIANT) AS VARIANT
        METHOD CreateArcPath <44> (BYVAL MaxSpeed AS DOUBLE, BYVAL Endpoint AS VARIANT, BYVAL Center AS VARIANT, BYVAL _
            ArcDirection AS LONG) AS VARIANT
    END INTERFACE
    
    ' Interface Name  : ISMIScan
    ' Description     : ISMIScan Interface
    ' ClassID         : $CLSID_SMIENGINELib_SMIScan
    ' ProgID          : $PROGID_SMIENGINELib_SMIScan
    ' Version ProgID  : $PROGID_SMIENGINELib_SMIScan1
    INTERFACE ISMIScan $IID_SMIENGINELib_ISMIScan 
        INHERIT IDISPATCH
    
        METHOD SCAN <1> (BYVAL Program AS STRING)
        METHOD ScanFile <2> (BYVAL FileName AS STRING)
        METHOD MakeSMX <3> (BYVAL FileName AS STRING) AS LONG
        METHOD MakeSMX2 <4> (BYVAL FileName AS STRING, BYVAL SMXFileName AS STRING) AS LONG
    END INTERFACE
    
    ' Interface Name  : ISMIErrors
    ' Description     : ISMIErrors Interface
    ' ClassID         : $CLSID_SMIENGINELib_SMIScan
    ' ProgID          : $PROGID_SMIENGINELib_SMIScan
    ' Version ProgID  : $PROGID_SMIENGINELib_SMIScan1
    INTERFACE ISMIErrors $IID_SMIENGINELib_ISMIErrors 
        INHERIT IDISPATCH
    
        PROPERTY GET NoOfWarnings <1> () AS LONG
        PROPERTY GET NoOfErrors <2> () AS LONG
        PROPERTY GET MaxErrors <3> () AS LONG
        PROPERTY SET MaxErrors <3> (BYVAL pVal AS LONG)
        PROPERTY GET MaxWarnings <4> () AS LONG
        PROPERTY SET MaxWarnings <4> (BYVAL pVal AS LONG)
        METHOD GoFirst <5> ()
        METHOD GoNext <6> ()
        PROPERTY GET Description <7> () AS STRING
        PROPERTY GET CODE <8> () AS LONG
        PROPERTY GET LINE <9> () AS LONG
        PROPERTY GET COLUMN <10> () AS LONG
        PROPERTY GET IsWarning <11> () AS LONG
    END INTERFACE
    Last edited by C.M. Rouleau; 29 Oct 2008, 09:14 AM.

  • #2
    The parameter for OpenPort is a BYREF string. Try using:

    setting = UCODE$(setting)
    commObject.OpenPort(setting)
    Forum: http://www.jose.it-berater.org/smfforum/index.php

    Comment


    • #3
      C.M.
      Could you also show your code wrapped in the [ C O D E ] [ / C O D E ] (Take out the spaces) so that it is more readable like below

      Code:
      ' Generated by: PowerBASIC COM Browser v.2.00.0058
      ' DateTime    : 10/28/2008 at 4:16 PM
      ' ------------------------------------------------
      ' Library Name: SMIENGINELib
      ' Library File: C:\WINDOWS\system32\SMIEngine.dll
      ' Description : SMIEngine 2.0 Type Library
      ' GUID : {BC26FBAC-00E1-11D4-B5D0-00600831E1F3}
      ' LCID : 0
      ' Version : 2.0
      
      ' Version Dependant ProgID's
      $PROGID_SMIENGINELib_SMIHost1 = "SMIEngine.SMIHost.1"
      $PROGID_SMIENGINELib_SMIScan1 = "SMIEngine.SMIScan.1"
      
      ' Version Independant ProgID's
      $PROGID_SMIENGINELib_SMIHost = "SMIEngine.SMIHost"
      $PROGID_SMIENGINELib_SMIScan = "SMIEngine.SMIScan"
      
      ' Class Indentifiers
      $CLSID_SMIENGINELib_SMIHost = GUID$("{BC26FBBA-00E1-11D4-B5D0-00600831E1F3}")
      $CLSID_SMIENGINELib_SMIMotor = GUID$("{D3A8EE8B-CAEF-40B6-8FD1-D43D498FE3A0}")
      $CLSID_SMIENGINELib_SMIScan = GUID$("{86DF7FB1-BE6A-40DB-85CC-DF71511EC21A}")
      
      ' Interface Indentifiers
      $IID_SMIENGINELib_ISMIComm = GUID$("{BC26FBB8-00E1-11D4-B5D0-00600831E1F3}")
      $IID_SMIENGINELib_ISMIMotor = GUID$("{0FBA614D-B688-4D74-9D8A-E592DA3F65D3}")
      $IID_SMIENGINELib_ISMICMotion = GUID$("{BC26FBB9-00E1-11D4-B5D0-00600831E1F3}")
      $IID_SMIENGINELib_ISMIPath = GUID$("{B998E60D-DB45-4B64-A149-CC7BD21311DE}")
      $IID_SMIENGINELib_ISMIScan = GUID$("{124D89B8-26B4-42A9-B988-C2A38D57CAED}")
      $IID_SMIENGINELib_ISMIErrors = GUID$("{D1B5EE00-2230-44E3-878A-55263DA82E3D}")
      
      ' Macros
      MACRO enum_parity = LONG
      MACRO enum_arcdirection = LONG
      
      ' __MIDL___MIDL_itf_SMIEngine_0000_0001 enumeration
      %smi_none = 0
      %smi_odd = 1
      %smi_even = 2
      %smi_mark = 3
      %smi_space = 4
      
      ' __MIDL___MIDL_itf_SMIEngine_0000_0002 enumeration
      %smi_counterclockwise = 0
      %smi_clockwise = 1
      
      
      ' Interface Name  : ISMIComm
      ' Description     : ISMIComm Interface
      ' ClassID         : $CLSID_SMIENGINELib_SMIHost
      ' ProgID          : $PROGID_SMIENGINELib_SMIHost
      ' Version ProgID  : $PROGID_SMIENGINELib_SMIHost1
      INTERFACE ISMIComm $IID_SMIENGINELib_ISMIComm 
          INHERIT IDISPATCH
      
          METHOD OpenPort <1> (BYREF PortName AS STRING)
          METHOD ClosePort <2> ()
          PROPERTY GET PortHandle <3> () AS LONG
          METHOD ClearBuffer <4> ()
          PROPERTY GET BytesAvailable <5> () AS LONG
          METHOD WriteCommand <6> (BYVAL COMMAND AS STRING)
          METHOD WriteString <7> (BYVAL PB_Data AS STRING)
          METHOD ReadResponse <8> () AS STRING
          METHOD ReadString <9> (BYVAL NoOfBytes AS LONG) AS STRING
          METHOD EstablishChain <10> ()
          METHOD AddressMotorChain <11> () AS LONG
          METHOD Wait <12> (BYVAL Time AS LONG)
          PROPERTY GET DefaultMotor <13> () AS LONG
          PROPERTY SET DefaultMotor <13> (BYVAL pVal AS LONG)
          PROPERTY GET Echo <14> () AS INTEGER
          PROPERTY SET Echo <14> (BYVAL pVal AS INTEGER)
          PROPERTY GET PARITY <15> () AS LONG
          PROPERTY SET PARITY <15> (BYVAL pVal AS LONG)
          PROPERTY GET BaudRate <16> () AS LONG
          PROPERTY SET BaudRate <16> (BYVAL pVal AS LONG)
          PROPERTY GET TIMEOUT <17> () AS LONG
          PROPERTY SET TIMEOUT <17> (BYVAL pVal AS LONG)
          PROPERTY GET CharDelay <18> () AS LONG
          PROPERTY SET CharDelay <18> (BYVAL pVal AS LONG)
          PROPERTY GET PortName <28> () AS STRING
          METHOD GetResponseOf <29> (BYVAL COMMAND AS STRING) AS STRING
          METHOD GetMotor <30> (BYVAL Address AS LONG) AS ISMIMotor
          PROPERTY GET MaxMotors <31> () AS LONG
          PROPERTY SET MaxMotors <31> (BYVAL pVal AS LONG)
          METHOD Download <32> (BYVAL Motor AS LONG, BYVAL FileName AS STRING)
          METHOD Upload <33> (BYVAL Motor AS LONG, BYVAL FileName AS STRING)
          METHOD ForceUpload <34> (BYVAL Motor AS LONG, BYVAL FileName AS STRING)
          PROPERTY GET IsRS485 <35> () AS LONG
          PROPERTY SET IsRS485 <35> (BYVAL pVal AS LONG)
          METHOD ClearEEPROM <36> (BYVAL Motor AS LONG)
          METHOD InitializeNotification <37> (BYVAL hWindow AS LONG, BYVAL message AS LONG)
          METHOD WriteCmd <38> (BYVAL COMMAND AS STRING)
          METHOD InitRS485 <39> (BYVAL NoOfMotors AS LONG, BYVAL MotorChannel AS LONG)
          PROPERTY GET TxMaxRetry <40> () AS LONG
          PROPERTY SET TxMaxRetry <40> (BYVAL pVal AS LONG)
          PROPERTY GET TxTimeoutMul <41> () AS LONG
          PROPERTY SET TxTimeoutMul <41> (BYVAL pVal AS LONG)
          PROPERTY GET TxTimeoutConst <42> () AS LONG
          PROPERTY SET TxTimeoutConst <42> (BYVAL pVal AS LONG)
          PROPERTY GET LogFlags <43> () AS LONG
          PROPERTY SET LogFlags <43> (BYVAL pVal AS LONG)
          PROPERTY GET LogFileName <44> () AS STRING
          PROPERTY SET LogFileName <44> (BYVAL pVal AS STRING)
      END INTERFACE
      
      ' Interface Name  : ISMIMotor
      ' Description     : ISMIMotor Interface
      ' ClassID         : $CLSID_SMIENGINELib_SMIMotor
      INTERFACE ISMIMotor $IID_SMIENGINELib_ISMIMotor 
          INHERIT IDISPATCH
      
          METHOD GetPosition <1> () AS LONG
          PROPERTY GET P <2> () AS LONG
          PROPERTY SET P <2> (BYVAL pVal AS LONG)
          PROPERTY GET V <3> () AS LONG
          PROPERTY SET V <3> (BYVAL pVal AS LONG)
          PROPERTY GET A <4> () AS LONG
          PROPERTY SET A <4> (BYVAL pVal AS LONG)
          METHOD GetSpeed <5> () AS LONG
          METHOD GetAcceleration <6> () AS LONG
          METHOD Go <7> ()
          METHOD WriteCommand <8> (BYVAL COMMAND AS STRING)
          METHOD GetResponseOf <9> (BYVAL COMMAND AS STRING) AS STRING
          METHOD SetPositionMode <10> ()
          METHOD SetVelocityMode <11> ()
          PROPERTY GET Version <12> () AS STRING
          PROPERTY GET SampleRate <13> () AS DOUBLE
          METHOD WaitForStop <14> ()
          METHOD STOP <15> (BYVAL Decelerate AS LONG)
          METHOD GOTO <16> (BYVAL Position AS LONG, BYVAL Velocity AS LONG, BYVAL Acceleration AS LONG)
          METHOD Download <17> (BYVAL FileName AS STRING)
          METHOD Upload <18> (BYVAL FileName AS STRING)
      END INTERFACE
      
      ' Interface Name  : ISMICMotion
      ' Description     : ISMICMotion Interface
      ' ClassID         : $CLSID_SMIENGINELib_SMIHost
      ' ProgID          : $PROGID_SMIENGINELib_SMIHost
      ' Version ProgID  : $PROGID_SMIENGINELib_SMIHost1
      INTERFACE ISMICMotion $IID_SMIENGINELib_ISMICMotion 
          INHERIT IDISPATCH
      
          METHOD Initialize <19> (BYVAL NoOfMotors AS LONG)
          METHOD WritePosition <20> (BYVAL Motor AS LONG, BYVAL POS AS LONG)
          METHOD WriteClock <21> (BYVAL Motor AS LONG, BYVAL Clock AS LONG)
          PROPERTY GET SlotsNeeded <22> (BYVAL Motor AS LONG) AS LONG
          PROPERTY GET CurrentClock <23> (BYVAL Motor AS LONG) AS LONG
          METHOD CheckStatus <24> (BYVAL Motor AS LONG) AS LONG
          PROPERTY GET TrajectorySlots <25> () AS LONG
          PROPERTY SET TrajectorySlots <25> (BYVAL pVal AS LONG)
          PROPERTY GET Buffered <26> () AS INTEGER
          PROPERTY SET Buffered <26> (BYVAL pVal AS INTEGER)
          PROPERTY GET SampleRate <27> (BYVAL nMotor AS LONG) AS DOUBLE
          PROPERTY GET PIDFactor <28> () AS LONG
          PROPERTY SET PIDFactor <28> (BYVAL pVal AS LONG)
          METHOD EndHostMode <29> ()
          METHOD Run <30> ()
          METHOD SyncMotors <31> ()
      END INTERFACE
      
      ' Interface Name  : ISMIPath
      ' Description     : ISMIPath Interface
      ' ClassID         : $CLSID_SMIENGINELib_SMIHost
      ' ProgID          : $PROGID_SMIENGINELib_SMIHost
      ' Version ProgID  : $PROGID_SMIENGINELib_SMIHost1
      INTERFACE ISMIPath $IID_SMIENGINELib_ISMIPath 
          INHERIT IDISPATCH
      
          PROPERTY GET EndSpeed <30> () AS DOUBLE
          PROPERTY SET EndSpeed <30> (BYVAL pVal AS DOUBLE)
          PROPERTY GET Acceleration <31> () AS DOUBLE
          PROPERTY SET Acceleration <31> (BYVAL pVal AS DOUBLE)
          PROPERTY GET StartPoint <32> (BYVAL Axis AS LONG) AS DOUBLE
          PROPERTY SET StartPoint <32> (BYVAL Axis AS LONG, BYVAL pVal AS DOUBLE)
          PROPERTY GET StartClock <33> () AS LONG
          PROPERTY SET StartClock <33> (BYVAL pVal AS LONG)
          PROPERTY GET SlowToEndSpeed <34> () AS INTEGER
          PROPERTY SET SlowToEndSpeed <34> (BYVAL pVal AS INTEGER)
      METHOD SetupTimeDelta <35> (BYVAL AveTimeDelta AS LONG, OPT BYVAL MinTimeDelta AS LONG, OPT BYVAL AllowedCount AS LONG, _
              OPT BYVAL PrecedeCount AS LONG)
          METHOD GeneratePath <36> (BYVAL MaxSpeed AS DOUBLE, BYVAL TotalLength AS DOUBLE) AS VARIANT
          METHOD GenerateLinePath <37> (BYVAL MaxSpeed AS DOUBLE, BYVAL Endpoint AS VARIANT) AS VARIANT
          METHOD GenerateArcPath <38> (BYVAL MaxSpeed AS DOUBLE, BYVAL Endpoint AS VARIANT, BYVAL Center AS VARIANT, BYVAL _
              ArcDirection AS LONG) AS VARIANT
          PROPERTY GET StartSpeed <39> () AS DOUBLE
          PROPERTY SET StartSpeed <39> (BYVAL pVal AS DOUBLE)
          PROPERTY GET TimeDelta <40> () AS LONG
          PROPERTY SET TimeDelta <40> (BYVAL pVal AS LONG)
          PROPERTY GET Plane <41> () AS LONG
          PROPERTY SET Plane <41> (BYVAL pVal AS LONG)
          METHOD CreatePath <42> (BYVAL MaxSpeed AS DOUBLE, BYVAL TotalLength AS DOUBLE) AS VARIANT
          METHOD CreateLinePath <43> (BYVAL MaxSpeed AS DOUBLE, BYVAL Endpoint AS VARIANT) AS VARIANT
          METHOD CreateArcPath <44> (BYVAL MaxSpeed AS DOUBLE, BYVAL Endpoint AS VARIANT, BYVAL Center AS VARIANT, BYVAL _
              ArcDirection AS LONG) AS VARIANT
      END INTERFACE
      
      ' Interface Name  : ISMIScan
      ' Description     : ISMIScan Interface
      ' ClassID         : $CLSID_SMIENGINELib_SMIScan
      ' ProgID          : $PROGID_SMIENGINELib_SMIScan
      ' Version ProgID  : $PROGID_SMIENGINELib_SMIScan1
      INTERFACE ISMIScan $IID_SMIENGINELib_ISMIScan 
          INHERIT IDISPATCH
      
          METHOD SCAN <1> (BYVAL Program AS STRING)
          METHOD ScanFile <2> (BYVAL FileName AS STRING)
          METHOD MakeSMX <3> (BYVAL FileName AS STRING) AS LONG
          METHOD MakeSMX2 <4> (BYVAL FileName AS STRING, BYVAL SMXFileName AS STRING) AS LONG
      END INTERFACE
      
      ' Interface Name  : ISMIErrors
      ' Description     : ISMIErrors Interface
      ' ClassID         : $CLSID_SMIENGINELib_SMIScan
      ' ProgID          : $PROGID_SMIENGINELib_SMIScan
      ' Version ProgID  : $PROGID_SMIENGINELib_SMIScan1
      INTERFACE ISMIErrors $IID_SMIENGINELib_ISMIErrors 
          INHERIT IDISPATCH
      
          PROPERTY GET NoOfWarnings <1> () AS LONG
          PROPERTY GET NoOfErrors <2> () AS LONG
          PROPERTY GET MaxErrors <3> () AS LONG
          PROPERTY SET MaxErrors <3> (BYVAL pVal AS LONG)
          PROPERTY GET MaxWarnings <4> () AS LONG
          PROPERTY SET MaxWarnings <4> (BYVAL pVal AS LONG)
          METHOD GoFirst <5> ()
          METHOD GoNext <6> ()
          PROPERTY GET Description <7> () AS STRING
          PROPERTY GET CODE <8> () AS LONG
          PROPERTY GET LINE <9> () AS LONG
          PROPERTY GET COLUMN <10> () AS LONG
          PROPERTY GET IsWarning <11> () AS LONG
      END INTERFACE
      Engineer's Motto: If it aint broke take it apart and fix it

      "If at 1st you don't succeed... call it version 1.0"

      "Half of Programming is coding"....."The other 90% is DEBUGGING"

      "Document my code????" .... "WHYYY??? do you think they call it CODE? "

      Comment


      • #4
        Sorry about not wrapping the code segment...

        Anywho, it appears that making the call as José has suggested has had little effect on the value that OBJRESULT returns. Not that I know what the heck I'm talking about, but does whatever I've presented thus far make me a candidate for using the 'generate dispatch interfaces only' flag in the COM browser? I only ask because things moved that way in the former topic.

        -CMR
        Last edited by C.M. Rouleau; 29 Oct 2008, 10:29 AM.

        Comment


        • #5
          More information...

          José,

          I just thought I'd throw this out there because the code below worked, and it was based on your TypeLib browser (and wrapper functions). Basically, this is what I'm trying to do in PB9, and it doesn't seem to be working out so far. I figure if I can get these few calls to work, I may be on my way to doing more with the library.


          'declare some things
          LOCAL hr AS LONG
          STATIC ppCommInterface AS DWORD
          LOCAL n AS LONG
          LOCAL Response AS STRING

          'create an instance of SMIHost
          hr = TB_CreateObject("SMIEngine.SMIHost.1", ppCommInterface)

          ...and then to open the port, I used the following:

          COMBOBOX GET TEXT CBHNDL, %IDC_BAUD TO setting$
          hr = SMIEngineISMIComm_put_BaudRate(ppCommInterface, VAL(setting$))
          hr = SMIEngineISMIComm_put_Parity(ppCommInterface, %smi_none)
          COMBOBOX GET TEXT CBHNDL, %IDC_COMPORT TO setting$
          hr = SMIEngineISMIComm_OpenPort(ppCommInterface, setting$)

          Comment


          • #6
            Can you post the wrapper function for SMIEngineISMIComm_OpenPort?

            My previous suggestion was based in what you had posted, but maybe (I'm just guessing) METHOD OpenPort <1> (BYREF PortName AS STRING) should be METHOD OpenPort <1> (BYVAL PortName AS STRING). I don't have SMIEngine.dll, so I can't inspect the type library using my tools.

            I also have a new browser for the new compilers:
            http://www.jose.it-berater.org/index.html

            It would be useful to know if my browser also resolves the parameter as BYREF STRING or BYVAL STRING.
            Forum: http://www.jose.it-berater.org/smfforum/index.php

            Comment


            • #7
              José,

              You are right- your [new] browser resolves the parameter as BYVAL, and - here's the best part - that small changed solved my problem. Man, you're good! So, why does the PB Browser get it wrong, and should I use the include generated by your new browser instead of PB9's?

              -CMR

              Comment


              • #8
                Some type libraries are difficult to deal with, either because they are buggy or because some attributes are missing. I will tell Steve Rossell about this problem.

                You can use the interface declarations generated by my browser or the ones generated by the PB COM Browser (changing manually the BYREF STRING parameter to BYVAL, of course), as you wish.
                Forum: http://www.jose.it-berater.org/smfforum/index.php

                Comment

                Working...
                X