Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Does Perl support Uart or parallel port?

Status
Not open for further replies.

davyzhu

Advanced Member level 1
Joined
May 23, 2004
Messages
494
Helped
5
Reputation
10
Reaction score
2
Trophy points
1,298
Location
oriental
Activity points
4,436
perl uart

Hello all,

Has anyone use Perl or other Script Language to invoke Uart or parallel port? Does Perl has such libs, if has, how to invoke these libs?

BTW, for libs support, Perl, Python, and Ruby, which is better?

Regards,

DAVY
 

perl uart controller

Perl supports UART and parallel port


Code:
use Device::SerialPort;


$pass;
$out;

$port = new Device::SerialPort ( "/dev/ttyS0");
$port->baudrate(9600);
$port->databits(8);
$port->stopbits(1);
$port->parity("none");

$i=1;
while($i){
$pass = $port->write('S$');
$j=0;
while ( $j==0){
$out = $port->input;
if ( $out ne '' ){
$_ = $out;
        if ( m/S:/ ){
        $string = '';
        $string = $_ ;
        }#end string start
        elsif ( m/:$/ ){
                $string = $string + $out ;
                print $string;
                $j=1;
                $i='';
        }#deal with the end stuff
        else{
        $string = $string + $out ;
        }
        }#end if for read out

}#close while $j
}#close while $i

NAME

Device::parallelPort - Parallel Port Driver for Perl
SYNOPSIS

my $port = Device::parallelPort->new();
$port->set_bit(3,1);
print $port->get_bit(3) . "\n";
print ord($port->get_byte(0)) . "\n";
$port->set_byte(0, chr(255));

DESCRIPTION

A parallel port driver module. This module provides an API to all parallel ports, by providing the ability to write any number of drivers. Modules are available for linux (both directly and via parport), win32 and a simple script version.

NOTE - This actual module is a factory class only - it is used to automatically return the correct class and has not other intelligence / purpose.
DRIVER MODULES

NOTE - You MUST load one of the drivers for your operating system before this module will correctly work - they are in separate CPAN Modules.

L<Device::parallelPort::drv::linux> - Direct hardware access to a base address.
L<Device::parallelPort::drv::parport> - Linux access to /dev/parport drivers
L<Device::parallelPort::drv::script> - Run a script with parameters
L<Device::parallelPort::drv::dummy_byte> - Pretending byte driver for testing
L<Device::parallelPort::drv::dummy_bit> - Pretending bit driver for testing
L<Device::parallelPort::drv::win32> - Windows 32 DLL access driver

DEVICE MODULES

L<Device::parallelPort::printer> - An example that can talk to a printer
L<Device::parallelPort::JayCar> - Simple JayCar electronics latched, addressable controller
L<Device::parallelPort::SerialFlash> - SerialFlash of bits - useful for many driver chips
 

    davyzhu

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top