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.

Robot control with Qbasic via parallellport

Status
Not open for further replies.

_Darth_

New Member
Ok for school i have to created a program in Qbasic to control a robot via PC. Now, i don't have any idea for that program, could someone help me out?

A link, document, ... doesn't matter, only something i could us!

Grtz
 

micro571

New Member
Parallel port control is extremely easy in QB.

The command is OUT Address, Value.

Find out the parallel port address. Most common is 888, 956 and 658 are also common.

OUT 888, 255

255 in binary is 1 1 1 1 1 1 1 1 ... which turns on all the parallel port pins. Hoped that helped.

-Micro571[/code]
 

nettron1000

New Member
Like as already bin noted, programing in Qbasic to use the parallel port is quite simple but you have to first find the port address that your particular computer uses.
Heres a short Qbasic progam you can use to find the address of the parallel port (LPT1).

DEF SEG = 0

PRINT PEEK (1032) + 256 * PEEK (1033)

When you RUN this program it should output 888 or 956 or 632.

BTW i found it ran only when the syntax checking option was disabled, not sure why, but it works.
 

toowie2uk

New Member
Qbasic stuff

Hi,

Programmnig in QBasic is fairly simple.

the OUT command is the simpliest to use. The parallel port usually risides at the following addresses:

&H378 - For the data outputs of the first port LPT1 (eightlines here)
&H37A - For the control outs of the first (4 lines here I think)

&H278 - For the data outputs of the second port LPT2
&H27A - For the control outs of the second

The command:
Out &H378, 1
Will make 5V appear on Data0 on the port

Out &H378, 0

Will take all outputs to 0V on the data lines

Out &H378, 4
Will make 5V appear on Data2 on the port

Basically - write values of 0,1,2,4,8,16,32,64,128, to control the lines - you can add them up to do more than one at once. (total for 8 lines = 255)

Java smells
 

toowie2uk

New Member
Qbasic stuff

Hi,

Programmnig in QBasic is fairly simple.

the OUT command is the simpliest to use. The parallel port usually risides at the following addresses:

&H378 - For the data outputs of the first port LPT1 (eightlines here)
&H37A - For the control outs of the first (4 lines here I think)

&H278 - For the data outputs of the second port LPT2
&H27A - For the control outs of the second

The command:
Out &H378, 1
Will make 5V appear on Data0 on the port

Out &H378, 0

Will take all outputs to 0V on the data lines

Out &H378, 4
Will make 5V appear on Data2 on the port

Basically - write values of 0,1,2,4,8,16,32,64,128, to control the lines - you can add them up to do more than one at once. (total for 8 lines = 255)

Java smells
 

saturn

New Member
Hi,

I have another project similiar to his project
and the program writtin in Visual Basic Language
i want to conver it to C or java
but i don't know how to write the parallel port address
Out &H378, 4 -----> how can i write it in java or C
:roll:

PLZ HeeeelPPP Meee :!:
 

mstechca

New Member
Go to https://www.cs.cmu.edu/~ralf/files.html
and download the entire interrupt list.

The last file (I think) contains all the ports and how to access each one.

an easy way to manipulate each bit is to use the following formula:

2 ^ n

where n is the bit number. 0 is the first bit, and 7 is the last.

So if you do:

out &H378, (2^0)+(2^1)

you have set bits 0 and 1, and the rest are cleared. Also, you are sending them to a port number equivalent to 378h.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Top