Page 1 of 1

qbasic help

Posted: Wed Jan 01, 2003 10:17 pm
by Guest
I need help about controlling the printer port or com1.
I don't find any tutorial that explain it.
Any help will be useful
Thanx

Re: qbasic help

Posted: Fri Jan 10, 2003 2:13 am
by Guest
For controlling the printer port, you will want to use the OUT command. There are 8 data bits on the port.

Values are assigned to each pin.
1 = 1
2 = 2
3 = 4
4 = 8
5 = 16
6 = 32
7 = 64
8 = 128

To get Value% you must add the values assigned to each pin.

eg, if you want pins 1 and 5 to be on Value% would be 17

if Value% is 255, all the pins are on.

$H378 is the port number for LPT1

                       Port      Value%
Example OUT &H378, 255


Printer port Pinout(Short)

1 = Strobe
2 = Data1(output)
3 = Data2(output)
4 = Data3(output)
5 = Data4(output)
6 = Data5(output)
7 = Data6(output)
8 = Data7(output)
9 = Data8(output)

22 = Ground
23 = Ground
24 = Ground
25 = Ground