sending to parallel port

Questions about hardware, drivers and peripherals
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
bytefyre

sending to parallel port

Post by bytefyre »

my friend and I are trying to use qbasic(the program's called QB64) to control a relay board with the parallel port , we're wondering how we can make the .bas file talk to parallel port. here's the code for the program, "OUT 378/IRQ7" is instead of OUT 888, but is really just a guess:

Code: Select all

CLS                                 'Clears The Screen.'

OUT 378/IRQ7, count  
d = 2000                            'sets a variable to represent 2000 cycles'
var$ = INKEY$                       'sets a variable to accept keyboard input'
LOCATE 4, 1: PRINT "This is a Hexadecimal, Decimal, Binary decoder."
LOCATE 5, 1: PRINT "Press any key in hexadecimal form (0-9 and A-F) The program will decode into"
LOCATE 6, 1: PRINT "Binary and light up the circuit board!"
OUT 378/IRQ7, count
DO                                  'starts the program'
var$ = INKEY$                       'sets a variable to accept keyboard input'
FOR t = 1 TO d: NEXT t
IF var$ = "0" THEN GOSUB PRINT0     'if a key is pressed, each key will go different subroutines'
IF var$ = "1" THEN GOSUB PRINT1
IF var$ = "2" THEN GOSUB PRINT2
IF var$ = "3" THEN GOSUB PRINT3
IF var$ = "4" THEN GOSUB PRINT4
IF var$ = "5" THEN GOSUB PRINT5
IF var$ = "6" THEN GOSUB PRINT6
IF var$ = "7" THEN GOSUB PRINT7
IF var$ = "8" THEN GOSUB PRINT8
IF var$ = "9" THEN GOSUB PRINT9
IF var$ = "a" THEN GOSUB PRINTA
IF var$ = "b" THEN GOSUB PRINTB
IF var$ = "c" THEN GOSUB PRINTC
IF var$ = "d" THEN GOSUB PRINTD
IF var$ = "e" THEN GOSUB PRINTE
IF var$ = "f" THEN GOSUB PRINTF
IF var$ = "g" THEN GOSUB PRINTG
LOOP                                'repeats the process'
PRINT0:                             'start of a subroutine'
CLS                                 'clears screen'
PRINT "______________________"      'will appear on-screen'
PRINT "| HEX DECIMAL BINARY |"      'will appear on-screen'
PRINT "|  0     00      0   |"      'will appear on screen'

OUT 378/IRQ7, 0                          'outputs data to the DB-25, to light up the LEDs'

RETURN                              'awaits input'

PRINT1:				    'start of a subroutine'

CLS				    'clears screen'

PRINT "______________________"	    'will appear on-screen'

PRINT "| HEX DECIMAL BINARY |"	    'will appear on-screen'

PRINT "|  1     01      1   |"	    'will appear on-screen'

OUT 378/IRQ7, 1			    'outputs data to the DB-25, to light up the LEDs'

RETURN				    'awaits input'

PRINT2:

CLS

PRINT "______________________"

PRINT "| HEX DECIMAL BINARY |"

PRINT "|  2     02     10   |"

OUT 378/IRQ7, 2

RETURN

PRINT3:

CLS

PRINT "______________________"

PRINT "| HEX DECIMAL BINARY |"

PRINT "|  3     03     11   |"

OUT 378/IRQ7, 3

RETURN

PRINT4:

CLS

PRINT "______________________"

PRINT "| HEX DECIMAL BINARY |"

PRINT "|  4     04     100  |"

OUT 378/IRQ7, 4

RETURN

PRINT5:

CLS

PRINT "______________________"

PRINT "| HEX DECIMAL BINARY |"

PRINT "|  5     05     101  |"

OUT 378/IRQ7, 5

RETURN

PRINT6:

CLS

PRINT "______________________"

PRINT "| HEX DECIMAL BINARY |"

PRINT "|  6     06    110   |"

OUT 378/IRQ7, 6

RETURN

PRINT7:

CLS

PRINT "______________________"

PRINT "| HEX DECIMAL BINARY |"

PRINT "|  7     07     111  |"

OUT 378/IRQ7, 7

RETURN

PRINT8:

CLS

PRINT "______________________"

PRINT "| HEX DECIMAL BINARY |"

PRINT "|  8     08    1000  |"

OUT 378/IRQ7, 8

RETURN

PRINT9:

CLS

PRINT "______________________"

PRINT "| HEX DECIMAL BINARY |"

PRINT "|  9     09    1001  |"

OUT 378/IRQ7, 9

RETURN

PRINTA:

CLS

PRINT "______________________"

PRINT "| HEX DECIMAL BINARY |"

PRINT "|  A    10     1010  |"

OUT 378/IRQ7, 10

RETURN

PRINTB:

CLS

PRINT "______________________"

PRINT "| HEX DECIMAL BINARY |"

PRINT "|  B    11     1011  |"

OUT 378/IRQ7, 11

RETURN

PRINTC:

CLS

PRINT "______________________"

PRINT "| HEX DECIMAL BINARY |"

PRINT "|  C    12     1100  |"

OUT 378/IRQ7, 12

RETURN

PRINTD:

CLS

PRINT "______________________"

PRINT "| HEX DECIMAL BINARY |"

PRINT "|  D    13     1101  |"

OUT 378/IRQ7, 13

RETURN

PRINTE:

CLS

PRINT "______________________"

PRINT "| HEX DECIMAL BINARY |"

PRINT "|  E    14     1110  |"

OUT 378/IRQ7, 14

RETURN

PRINTF:

CLS

PRINT "______________________"

PRINT "| HEX DECIMAL BINARY |"

PRINT "|  F    15     1111  |"

OUT 378/IRQ7, 15

RETURN

PRINTG:

CLS

PRINT "You may only select valid characters(0-9 and A-F)." 'This will appear when an'

RETURN							   'invalid key is pressed'

CLS



Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
remoulder
Level 17
Level 17
Posts: 7621
Joined: Fri May 09, 2008 1:14 pm

Re: sending to parallel port

Post by remoulder »

Might be a better bet to post your question at http://www.qb64.net/forum/
[Edit] your original post and add [SOLVED] once your question is resolved.

“The people are my God” stressing the factor determining man’s destiny lies within man not in anything outside man, and thereby defining man as the dominator and remoulder of the world.
bytefyre

Re: sending to parallel port

Post by bytefyre »

remoulder wrote:Might be a better bet to post your question at http://www.qb64.net/forum/
probably would, thanks
bytefyre

Re: sending to parallel port

Post by bytefyre »

remoulder wrote:Might be a better bet to post your question at http://www.qb64.net/forum/
good idea, thanks
Locked

Return to “Hardware Support”