- Serial I/O Perl Script -

  

 

 

 

 

dc2.pl

 

This perl script demonstrates how to perform serial I/O under perl. This program itself is probably of little interest to the average HAL user since Lexicon Preamps are fairly rare. However, the key elements of the program, the ability to send and receive binary strings via the computer's RS232 ports, under control of HAL is probably useful in one form or another to a much wider audience. This technique can be used to control practically any device with a serial port. You do need to download the serialport.pm module from CPAN. Depending on how sophisticated your serial I/O becomes and what other Win32API stuff you already have loaded you may also require commport.pm

The script demonstrates a couple of important points. Use of the Win32::Serialport perl module is fairly easy and straightforward once you tie the port to a file handle as we demonstrate here. Another key element is packing bytes into a string to define a binary packet. And finally, breaking apart those packets into individual bytes and displaying them as one might on a datascope is extremely valuable debugging technique.

This software may be used freely as a starting point to build your own serial application. If you do build something even a little bit interesting, I would like to encourage you to submit the result to be shared for your fellow home automation enthusiasts.

 

 

 

 

 

 

 

 

 

Navigation

 

Serial I/O control of Lexicon DC2

Click to download Script Zip File

Perl Application Library

Main Menu