Serial Communication with PCs

Last Modified: [last_modified]

Intro

The Cogwheel Nixie Driver board allows for serial communcations over USB and optionally Bluetooth. Future versions may include other methods, but these notes should apply to any abstraction which results in the board’s serial port being visible on a PC.

B7971x8 Perl Script

The following  Perl script was used to test the B7971 during development. It has been tested under Windows XP. Download it Here by saving the link.  Follow the instructions in the comments at the top to install Perl and get it running.

#! C:\perl\bin\perl.exe

#
# B7971x8.pl - Diagonstic Utility for communicating with Cogwheel Nixie System Driver board when configured
# to drive 8 B7971 tubes
#
# Usage:
#
#  perl B7971x8.pl
#
#  This will run the script. As shipped it will communicate on COM3, and run a list text in the
#  array $AllCmds. Commends preceded with a # are interpreted locally; #P means pause. #D means delay
#
# Known to work under Activestate Perl for Win32 5.10 or later. Download from
# http://www.activestate.com/activeperl/downloads Note, you will need to install the following
# two Perl modules:
use Time::HiRes  qw (usleep); # If you get a 'missing package' type "ppm install Time-HiRes"
use Win32::SerialPort;# If you get a 'missing package' type "ppm install Win32-SerialPort
# To do this, from the cmd prompt type 'ppm', the app should start, Click View->All Packages, then
# in the search box type Time::HiRes, then Click Action->Install, Then search on Win32-SerialPort,
# and also mark it for install. Then do a File->Run Marked Actions. Verify you can communicate
# with the Driver Board using a general purpose terminal emulator program (described in the documentation)
# You may need to adjust this port setting:
#
my $PortName = 'COM3';
my $PortObj = new Win32::SerialPort ($PortName) || die "Can't open $PortName: $^E\n";    # $quiet is optional

$PortObj->user_msg(ON);
$PortObj->databits(8);
$PortObj->baudrate(57600);
$PortObj->parity("none");
$PortObj->stopbits(1);
$PortObj->handshake("none");
$PortObj->buffers(4096, 4096);
$PortObj->write_settings || undef $PortObj;

$DelayTenths = 150;

$AllCmds=<write("\r");
sleep 2;

my @Cmds = split "\n", $AllCmds3;
my @Cmds = split "\n", $AllCmds2;
my @Cmds = split "\n", $AllCmds;

while(1)
{
 RunEm();
}
exit;

sub RunEm()
{

foreach $m (@Cmds)
{
 # Leading / in stream is a command to us and not the clock
 if (!($m =~ /^#/))
 {
 print "$m\n";
 $PortObj->write($m. "\r");
 }
 else
 {
 if ($m =~ /^#P/)
 {
 ($p1,$p2) = split $m,' ';
 print $p2;
 print  "(Pause:  ?)";
 $m = ;
 }
 elsif ($m =~ /^#D/)
 {
 ($p1,$DelayTenths) = split ' ',$m;
 print  "(Setting Delay to $DelayTenths)\n";
 }
 }
 $Dly = 25;
 $Dly = $DelayTenths if ($m =~ /^txt/);
 $Dly = $DelayTenths if ($m =~ /^txb/);
 foreach $x (1..$Dly)
 {
 usleep (10000);
 }
}
}

# ===

=cut
txt BUILT-IN
txt CHARSET:
txt ABCDEFGH
txt IJKLMNOP
txt QRSTUVWX
txt YZabcdef
txt ghijklmn
txt opqrstuv
txt qxyz0123
txt 456789!"
txt #$%&amp;amp;amp;amp;'()*
txt +,-./_;<
txt =>?@[\]^
=cut
.

 

This project is released under the Creative Commons Attribution Share-alike license CC-BY-SA.