in reply to Re^3: Perl calling my.DLL for serial port work.
in thread Perl calling my.DLL for serial port work.

Thanks for the posting advice and help, (window XP enviroment) Here's the error message below:
C:\Perl\perlscripts>monks01.pl Can't locate Win32/API.pm in @INC (@INC contains: C:/Perl/site/lib C:/ +Perl/lib .) at C:\Perl\perlscripts\monks01.pl line 5. BEGIN failed--compilation aborted at C:\Perl\perlscripts\monks01.pl li +ne 5.
code to follow:
#! perl -w # use Win32; use Win32::API; my $SSC_OPEN = Win32::API->new( 'ssc-5', 'SSC_OPEN', '1', '2400', ); s +ub SSC_OPEN { $SSC_OPEN->Call(@_); }; # my $SSC_MOVE = Win32::API->new( 'ssc-5', 'SSC_MOVE', '1', '1', ); sub +SSC_MOVE { $SSC_MOVE->Call(@_); }; # my $SSC_CLOSE = Win32::API->new( 'ssc-5', 'SSC_CLOSE', '', '', ); sub +SSC_CLOSE { $SSC_CLOSE->Call(@_); };

Replies are listed 'Best First'.
Re^5: Perl calling my.DLL for serial port work.
by Corion (Patriarch) on Feb 03, 2008 at 17:09 UTC

    That means that the module Win32::API is not installed with your Perl. This is unlikely if you are using ActiveState Perl, but if you are using Strawberry Perl, you will have to install Win32::API via CPAN:

    cpan Win32::API

    Also, I recommend you read the documentation to Win32::API before modifying the code I posted. The code I posted was not intended for modification - you should have left it as is, and just called the code:

    SSC_OPEN( 1, 2400 );
      I'm using ActiveState and did some research and found that
      ppm install Win32-API
      will install the API. As for code mods: I made the assumption that the 'I' and 'II' were place holders to pass the needed info to the program. The OPEN needs to know com port and baud rate. SSC_OPEN(port,baudrate) . The MOVE needs notified of SERVO number and SERVO location. SSC_MOVE(servo,position) Thanks again.... getting closer :-)
        No, the I and II are literal instructions to Win32::API as to how to pass those parameters. Win32::API->new returns an object that can be used to call the DLL function. You should only do the my $SSC_MOVE = ...; sub SSC_MOVE { ... } once, and then call the defined SSC_MOVE sub as many times as you want with the actual values.