11/20/2004

Zoomkat's simple parallel port stuff.

If using the below files on windows NT/2K/XP, then you will need to run 
userport (google search for userport.zip) to get access to the parallel 
port. If running on windows 98, then rem out the date and time lines 
using :: (the win98 command.com doesn't do dates and times). 
The in.com and out.com applications, and the in.bat file format below 
were developed by Herbert Kleebauer. The outcom.bat generates the 
out.com application, and the incom.bat file generates the in.com 
application. Copy, paste in notepad, save as a .bat file, then double 
click to run and generate the .com files. The in.com, out.com, in.bat, 
and lpt-status.bat files below go into the apache cgi-bin folder. The 
files are linked to in the format http://127.0.0.1/cgi-bin/lpt-in.bat, 
which should produce a status page in the brouser. 

================================================================

:: outcom.bat
:: commandline use format is out.com ff 378
:: note the byte is in hex format like ff
@echo off
echo Bj@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=>out.com
echo 0DxFP,0Xx.t0P,=XtGsB4o@$?PIyU!WvX0GwUY Wv;ovBX2Gv0ExGIuht6>>out.com
echo ?@}IIHpkg~K=H?H_CgRNWH?wpBmNEFQNS@CbwH@S?pkoECIQ{_K?\qoCve>>out.com
echo {Sx{X?{Eu@Pq`Dkfk?a@o{A@CoCEFr@B@K~Tj~@CeK??BB0x>>out.com

=================================================================

:: incom.bat
:: commandline use format is like in.com 0 379 (status pin 0)
@echo off
echo Bj@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=>in.com
echo 0DxFP,0Xx.t0P,=XtGsB4o@$?PIyU WwX0GwUY Wv;ovBX2Gv0ExGIuht6>>in.com
echo ?@}IIHpkg~K=H?U_PgRN@k?k?GzBNEr@NWbMs?Qm`LKLFQp{@PEKH@`Qpk>>in.com
echo w@CI?J_KE@qo{Oe{\O{Xv@EuxCq`{SfkP?@oko@CaBEFANO@PrTj@{Pe~r>>in.com
echo ?B@K?B?K0x>>in.com

==================================================================

:: lpt-status.bat
:: link to this file like http://127.0.0.1/cgi-bin/lpt-status.bat
@Echo OFF
Echo Content-type: text/html
Echo.
Echo ^
Echo ^
Echo ^Parallel Port Pin Status^
Echo ^
Echo ^
Echo ^Parallel Port Pin Status^
echo Today's date is ^%date%^
echo Current time is %time%^
echo Your IP address is %REMOTE_ADDR%^
Echo Initiating command now:^
Echo ///////////////^

out.com B7 378 :: this line sets the data lines
echo ^
echo Group A^
call in.bat :: this line reads the status lines

out.com fA 378 
echo ^
echo Group B^
call in.bat 

out.com B7 378
echo ^
echo Group C^
call in.bat

out.com cA 378
echo ^
echo Group D^
call in.bat

out.com B9 378
echo ^
echo Group E^
call in.bat

out.com d2 378
echo ^
echo Group F^
call in.bat

out.com e7 378
echo ^
echo Group G^
call in.bat

out.com 2a 378
echo ^
echo Group H^
call in.bat

echo ^
Echo ^///////////////^
Echo Did it work?^
Echo ^
Echo ^


==================================================================

::in.bat
@echo off
in.com 0 379
if not errorlevel 1 echo 0=off
if     errorlevel 1 echo 0=on

in.com 1 379
if not errorlevel 1 echo 1=off
if     errorlevel 1 echo 1=on

in.com 2 379
if not errorlevel 1 echo 2=off
if     errorlevel 1 echo 2=on

in.com 3 379
if not errorlevel 1 echo 3=off
if     errorlevel 1 echo 3=on

in.com 4 379
if not errorlevel 1 echo 4=off
if     errorlevel 1 echo 4=on

in.com 5 379
if not errorlevel 1 echo 5=off
if     errorlevel 1 echo 5=on

in.com 6 379
if not errorlevel 1 echo 6=off
if     errorlevel 1 echo 6=on

in.com 7 379
if not errorlevel 1 echo 7=off
if     errorlevel 1 echo 7=on

========================================================
========================================================

::Herbert's origional bat file with @echo off and pause added
@echo off
in.com 7 379
if not errorlevel 1 echo busy=0
if     errorlevel 1 echo busy=1
in.com 6 379
if not errorlevel 1 echo ack=0
if     errorlevel 1 echo ack=1
in.com 5 379
if not errorlevel 1 echo pe=0
if     errorlevel 1 echo pe=1
in.com 4 379
if not errorlevel 1 echo slct=0
if     errorlevel 1 echo slct=1
in.com 3 379
if not errorlevel 1 echo error=0
if     errorlevel 1 echo error=1
in.com 2 379
if not errorlevel 1 echo NUL=0
if     errorlevel 1 echo NUL=1
in.com 1 379
if not errorlevel 1 echo NUL=0
if     errorlevel 1 echo NUL=1
in.com 0 379
if not errorlevel 1 echo NUL=0
if     errorlevel 1 echo NUL=1
pause

==================================================
==================================================

Debug batch files for writing/reading parallel port lines. The below 
debug-lpt.bat, lptin.bat, and lptout.bat batch files go in the apache 
cgi-bin folder and are linked to like 
http://127.0.0.1/cgi-bin/debug-lpt.bat. The debug output can also be 
sent to a file if desired for evaluation by another program 
(like debug < debug.in > save.txt). I think batch files can evaluate 
the output hex value, but I haven't gotten that far yet.

========================================================

:: debug-lpt.bat
@Echo OFF
Echo Content-type: text/html
Echo.
Echo ^
Echo ^
Echo ^Parallel Port Pin Status^
Echo ^
Echo ^
Echo ^Parallel Port Pin Status^
echo Today's date is ^%date%^
echo Current time is %time%^
echo Your IP address is %REMOTE_ADDR%^
Echo Initiating command now:^
Echo ///////////////^
echo ^
call lptout.bat 01 :: this line sets the desired data line
call lptinp.bat 379 :: this line reads the status lines
call lptout.bat 02
call lptinp.bat 379
call lptout.bat 04
call lptinp.bat 379
call lptout.bat 08
call lptinp.bat 379
call lptout.bat 10
call lptinp.bat 379
call lptout.bat 20
call lptinp.bat 379
call lptout.bat 40
call lptinp.bat 379
call lptout.bat 80
call lptinp.bat 379
call lptout.bat 00
Echo ^///////////////^
Echo Did it work?^
Echo ^
Echo ^

=========================================================

:: lptin.bat
@echo off
echo i %1 > debug.in
echo q >> debug.in
debug < debug.in 
del debug.in >nul
Echo ^

==========================================================

:: lptout.bat
@echo off
echo o 378 %1 >debug.out
echo q >> debug.out
debug < debug.out >nul
del debug.out >nul

==========================================================

    Source: geocities.com/zoomkat/files

               ( geocities.com/zoomkat)