Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

problem with using the OUT command

Status
Not open for further replies.

JWV

New Member
Hi

I have a problem woth using the OUT command in Qbasic. The following code should give me the result 26. But it doesn't.

OUT &H378, 26
PRINT INP(&H378)

It gives 255. The same when using 888 as adres. Am I doing something wrong?

Greetings,

Jan

BTW: If this is the wrong forum for this question, I appologise.
 
JWV said:
Hi

I have a problem woth using the OUT command in Qbasic. The following code should give me the result 26. But it doesn't.

OUT &H378, 26
PRINT INP(&H378)

It gives 255. The same when using 888 as adres. Am I doing something wrong?

A printer port is basically an output only (in standard mode), so you probably can't read the value back. Check the voltages on the output pins, and see if they change.
 
Thanks for your quick reply!

I tried to check the voltage on the port with the following setup:

**broken link removed**

Both the LED shine, no matter what i tried. OUT &H378,0 ; OUT 888,1 did not change the status of the LEDs.

Did i use the correct pins? or am i doing something silly here?
 
JWV said:
Thanks for your quick reply!

I tried to check the voltage on the port with the following setup:

**broken link removed**

Both the LED shine, no matter what i tried. OUT &H378,0 ; OUT 888,1 did not change the status of the LEDs.

Did i use the correct pins? or am i doing something silly here?

I presume you are using the correct printer port adress?.

Also, what OS are you running?.
 
I am using DOS (version 6.something).

I'm not sure about the adress, but these numbers (&H378) appeared on almost every website dealing with controling the paralel port in Qbasic. So I assumed it was the correct adres.
There is only one paralel port in the machine, one gameport (i think), and one com port.

Is the adres machine specific? or is it always the same? If it is machine specific, is there a way to retrieve the adres of the paralel port?

Greetings,

JWV
 
JWV said:
I am using DOS (version 6.something).

I'm not sure about the adress, but these numbers (&H378) appeared on almost every website dealing with controling the paralel port in Qbasic. So I assumed it was the correct adres.
There is only one paralel port in the machine, one gameport (i think), and one com port.

The three standard parallel port addresses are:

$378
$278
$3BC

Is the adres machine specific? or is it always the same? If it is machine specific, is there a way to retrieve the adres of the paralel port?

There's a BIOS call you can use to find out the port addresses installed.
 
Thank you very much! It apears the adres of my parale port is &H3BC! Even the inp() is working as expected :D

Greetings,

JWV
 
During booting...

If booting is slow enough you could check easily what address is your port asigned to. Is one of the first screens you see if no OEM logo is displayed.

I forgot how to check that when in DOS.
 
The parallel port adresses are stored by the bios on adresses:

0000:0408 LPT1's Base Address
0000:040A LPT2's Base Address
0000:040C LPT3's Base Address

in dos you can see what's on these adresses with the 'debug' tool..
Type 'Debug' after the promt and a '-' will appear. Then type d 0000:0408 and it will show the content of that adress.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top