[plug] display
Andrew McMeikan
andrew.mcmeikan at mitswa.com.au
Mon May 31 16:21:35 WST 1999
Hi all,
I recently got sick of turning the monitor on in my computer room
just to see if my gateway/server was fully shutdown or not, just so I
could turn it all off again. Having some vacuum fluorescent displays
lying around, I thought it would be a good status display. If anyone is
desperately after one, I'm sure I can take small donations in exchange :)
at the moment I have it using the parallel port, and feeding 5volts from
a separate supply. I have attached the code in case anyone can think of a
better way (ie. games port has power out, but does it have 3 outgoing TTL
lines?)
cya, Andrew...
END
/"\ /~~~~~~~\ If my email's seem to say
\ / | @ @ | something, you may be taking
X ASCII RIBBON CAMPAIGN | \_/ | it out of context. Please
/ \ AGAINST HTML MAIL \_______/ disregard anything obnoxious.
---Linux, the choice of a GNU generation---
-------------- next part --------------
/********************************************************
*vfd.c program to drive vacuum fluorescent display *
*(c) 31 May 1999 Andrew McMeikan GPL v2 *
*andrewm at engineer.com ; andrew.mcmeikan at mitswa.com.au *
*toggles lines on the parallel port *
*D0 is data *
*D1 is clock *
*D2 is reset line *
*this first version uses port at 0x378 *
*due to the use of outb macro you must compile with -O *
*if you want non-root use remember to chmod +s it *
********************************************************/
#define CLOCK 2
#define RESET 4
#define PORT 0x378
#include <unistd.h>
#include <asm/io.h>
void dochar( char);
int main (int argc, char *argv[])
{
int i;
if (argc!=2)
{
printf("%s:must specify text to display (max 16chars)\n",argv[0]);
printf("%s:eg. %s \"HELLO WORLD\"\n",argv[0],argv[0]);
return(1);
}
ioperm(PORT,1,255);
outb(RESET,PORT);
usleep(10);
outb(0,PORT);
usleep(10);
dochar(255); /* set display mode and brightness */
for (i=0;i!=16;i++)
dochar(' '); /* clear all the @ after reset */
for (i=0;(argv[1][i]!=0)&&(i!=16);i++)
dochar(argv[1][i]); /* display user string */
return(0); /* exit happy */
}
void dochar(char d) /* this function displays on char */
{
int i;
for (i=7;i>=0;i--) /* MSB first */
{
outb(CLOCK|((d>>i)&1),PORT);
outb((d>>i)&1,PORT); /* falling clock latches bit */
}
}
More information about the plug
mailing list