NAME

Device::Quasar3108 - Control Quasar Electronics Serial I/O Module

SYNOPSIS

use Device::Quasar3108;

my $io = new Device::Quasar3108( '/dev/ttyS0' );

# Turn all relays off
$io->relay_set( 0 );

# Turn relay 1 on
$io->relay_on( 1 );

# Get status of input 2
my $status = $io->input_status( 2 );

DESCRIPTION

Device::Quasar3108 is a perl module for controlling Quasar Electronics Serial Isolated I/O module (kit number 3108). The kit has eight relays and four opto-isolated inputs. http://www.quasarelectronics.com/3108.htm

It seems very similar (identical?) to Carl's Electronic Kits number CK1610: http://www.electronickits.com/kit/complete/elec/ck1610.htm

The perl module was tested on Debian Linux 3.1, but should work on most POSIX systems.

Relays are numbered 1 to 8 and inputs are numbers 1 to 4.

METHODS

$io = new Device::Quasar3108( $port, [$timeout] )

The new method opens and configures the serial port to talk to the Quasar 3108 serial module. It does not send any commands to the kit itself.

Use 'ping()' to ensure that you are communicating with the module correctly.

$io->relay_on( $relay_number )

Turns on the specified relay. Returns 1 if successful or 0 on failure.

$io->relay_on( $relay_number )

Turns off the specified relay. Returns 1 if successful or 0 on failure.

$io->relay_toggle( $relay_number )

Toggle the specified relay. Returns 1 if successful or 0 on failure.

$io->relay_flash( $relay_number, [$period] )

Turn the specified relay on then off again. The period the relay is turned on for is in seconds, the default is 0.25 seconds.

Returns 1 if successful or 0 on failure.

$io->relay_set( $value )

Set all the relays at once, using an 8-bit number. Returns 1 if successful or 0 on failure.

$io->relay_status( $relay_number )

Gets the current status (0/1) of the specified relay. Use relay number 0 to return the status of all the relays as an 8-bit hexadecimal number.

$io->input_status( $input_number )

Gets the current status (0/1) of the specified opto-coupled input. Use input number 0 to return the status of all the inputs as an 8-bit hexadecimal number (top nibble is always 0).

$io->version()

Returns the version number of the perl module.

$io->firmware_version()

Returns the firmware version string of the hardware.

$io->ping()

This method just sends a return character to the module to check to see if it is still there. If the module returns the command prompt correctly ('#'), then this function returns 1, otherwise it returns 0.

SEE ALSO

Device::Serial

http://www.quasarelectronics.com/3108.htm

BUGS

Please report any bugs or feature requests to bug-device-quasar3108@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you will automatically be notified of progress on your bug as I make changes.

AUTHOR

Nicholas J Humfrey, njh@ecs.soton.ac.uk

COPYRIGHT AND LICENSE

Copyright (C) 2005 Nicholas J Humfrey

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.005 or, at your option, any later version of Perl 5 you may have available.