I finally solved the puzzle. The black box is less dark now. I modified the demo1.plx with all my knowledge accumulated from the payless, relentless and endless internet search. Input from the test board can be displayed on the LCD monitor and stored in a file.
My next step is to write a program to capture the input via the test board or keyboard with the choice by the user and store the chosen data in a file. I do not have a clue to do it at this stage.
I attach the file below for people who are interested. Thank-you my Ubuntu friends.
Code:
#!/usr/bin/perl
use lib './blib/lib','../blib/lib'; # can run from here or distribution base
######################### We start with some black magic to print on failure.
BEGIN { $| = 1; print "demo1.plx loaded "; }
END {print "not OK 1\n" unless $loaded;}
use Device::SerialPort 0.05;
$loaded = 1;
print "O Kay 1\n";
######################### End of black magic.
use strict;
my $PORT = "/dev/ttyS0";
my $pass;
my $fail;
my $in;
my $title1;
my $inputval;
my $title4;
my $title2;
my $title3;
# 2: Constructor and Basic Values
my $ob = Device::SerialPort->new ($PORT) || die "Can't open $PORT: $!";
$ob->baudrate(4800) || die "fail setting baudrate";
$ob->parity("none") || die "fail setting parity";
$ob->databits(8) || die "fail setting databits";
$ob->stopbits(1) || die "fail setting stopbits";
$ob->handshake("none") || die "fail setting handshake";
$ob->write_settings || die "no settings";
# 3: Prints Prompts to Port and Main Screen
$title1= "\r\n\r\n++++++++++++++++++++++++++++++++++++++++++\r\n";
$title2= "Simple Serial Terminal with echo to STDOUT\r\n\r\n";
$title3= "type CONTROL-Z on serial terminal to quit\r\n";
$title4="\r\n....Bye\r\n";
print $title1, $title2, $title3;
$ob->error_msg(1); # use built-in error messages
$ob->user_msg(1);
$in = 1;
while ($in) {
if (($inputval= $ob->input) ne "") {
$inputval =~ s/\cM/\r\n/;
#$ob->write($loc);
print STDOUT $inputval;
open LOG, ">>test.log" || die "$!\n";
open(DEV, "<$PORT")
|| die "Cannot open $PORT: $_";
select(LOG), $| = 1; # set nonbufferd mode
#
print LOG $inputval;
}
if ($inputval =~ /\cZ/) { $in--; }
if ($ob->reset_error) { $in--;}
}
close(LOG);
print $title4;
sleep 1;
undef $ob;
Bookmarks