Re: [CAD_CAM_EDM_DRO] Simple Parallel Port controller
Posted by
Alan Marconett KM6VV
on 2001-09-01 11:56:24 UTC
HI Scott,
Where are you starting from? Do you have some familiarity with BASIC or
'C'? Do you have a "program" to run from?
Check out the "parallel port" on the internet. Several doc's on how to
control stuff from a parallel port.
Basically, and I'm working from memory as the "low level" details that I
use to run steppers and other devices from parallel ports is "buried" in
the #defines and EQU's of the code.
1) The parallel port is basically 3 addresses in a block I.E., 378h,
379h & 37Ah. There are three port addresses stored at 40:8. 378h, 278h
and 3BCh. 3BCh is not a good choice.
2) The first of the three addresses is DATA, the second is STATUS, the
third is COMMAND.
3) Bits for the 4 output command lines are defined in the COMMAND
register, along with a "direction" bit, and a IRQ enable bit.
4) Pick a control line. STROBE is pin 1, it is "Inverted", and is
assigned to bit 0 of the COMMAND port.
#define SPP_STROBE 0x01 /* I nStrobe 1 (pin 1) */
#define SPP_AUTOFD 0x02 /* I nAutoFd 14 (pin 14) */
#define SPP_INIT 0x04 /* I nInit 16 (pin 16) */
#define SPP_SLC_IN 0x08 /* I nSelectIn 17 (pin 17) */
#define SPP_IRQE 0x10 /* I IRQ enab */
#define SPP_LISTEN 0x20 /* ? direction */
5) Do a "write" of a byte of data to the command port, with bit 0 "hi"
to make the line go low, and vice-versa. Simplest way, put a meter on
pin 1 of the parallel port connector, return to pin 18 (18-25 gnd), and
"toggle" that bit on and off to see the effect. DDT er, Debug is a DOS
program that will allow you to do just that. Or do it in BASIC, PASCAL,
or 'C' (my favorite).
6) Some sample .ASM code that gets a "current byte", clears out bits for
a
4-phase driver, puts in new bits from a table, outputs the COMMAND, and
saves the byte as the current byte.
mov al, byte ptr LPTcmd // full byte
and al, NOT Z_NIBBLE // clear nibble
or al, es:ZTable[bx] // new nibble = ZTable[index]
mov byte ptr LPTcmd, al // save nibble
out dx, al //
7) 'C' code would do an outp(ADDR, data), BASIC and PASCAL have similar
output commands.
HTH
Alan KM6VV
Scott Riddle wrote:
Where are you starting from? Do you have some familiarity with BASIC or
'C'? Do you have a "program" to run from?
Check out the "parallel port" on the internet. Several doc's on how to
control stuff from a parallel port.
Basically, and I'm working from memory as the "low level" details that I
use to run steppers and other devices from parallel ports is "buried" in
the #defines and EQU's of the code.
1) The parallel port is basically 3 addresses in a block I.E., 378h,
379h & 37Ah. There are three port addresses stored at 40:8. 378h, 278h
and 3BCh. 3BCh is not a good choice.
2) The first of the three addresses is DATA, the second is STATUS, the
third is COMMAND.
3) Bits for the 4 output command lines are defined in the COMMAND
register, along with a "direction" bit, and a IRQ enable bit.
4) Pick a control line. STROBE is pin 1, it is "Inverted", and is
assigned to bit 0 of the COMMAND port.
#define SPP_STROBE 0x01 /* I nStrobe 1 (pin 1) */
#define SPP_AUTOFD 0x02 /* I nAutoFd 14 (pin 14) */
#define SPP_INIT 0x04 /* I nInit 16 (pin 16) */
#define SPP_SLC_IN 0x08 /* I nSelectIn 17 (pin 17) */
#define SPP_IRQE 0x10 /* I IRQ enab */
#define SPP_LISTEN 0x20 /* ? direction */
5) Do a "write" of a byte of data to the command port, with bit 0 "hi"
to make the line go low, and vice-versa. Simplest way, put a meter on
pin 1 of the parallel port connector, return to pin 18 (18-25 gnd), and
"toggle" that bit on and off to see the effect. DDT er, Debug is a DOS
program that will allow you to do just that. Or do it in BASIC, PASCAL,
or 'C' (my favorite).
6) Some sample .ASM code that gets a "current byte", clears out bits for
a
4-phase driver, puts in new bits from a table, outputs the COMMAND, and
saves the byte as the current byte.
mov al, byte ptr LPTcmd // full byte
and al, NOT Z_NIBBLE // clear nibble
or al, es:ZTable[bx] // new nibble = ZTable[index]
mov byte ptr LPTcmd, al // save nibble
out dx, al //
7) 'C' code would do an outp(ADDR, data), BASIC and PASCAL have similar
output commands.
HTH
Alan KM6VV
Scott Riddle wrote:
>
> I am looking for some help to use my parallel port to turn off and on a
> small relay switch. The device I want to control will shut off automatically
> after 1 cycle but it needs a 1 second ON switch to activate it. What I am
> doing is turning a small motor on and it will turn one revolution and then
> stop when the cam lobe on the pulley hits the switch lever to stop it. I
> need the computer to turn the relay on to start the motor moving. The motor
> is just a plain motor 12V not a stepper or servo. I will have the final
> drive slowed way down with a pulley so the switch cycle will take 3-4
> seconds. I have seen some simple controller boards for small servo motors
> for about $50 but All I need is a Off and ON switch. I would appreciate any
> help.
>
> Thanks
> Scott
>
> Scott Riddle
> sariddle@...
Discussion Thread
Scott Riddle
2001-09-01 08:47:13 UTC
Simple Parallel Port controller
Eric Keller
2001-09-01 09:23:36 UTC
Re: [CAD_CAM_EDM_DRO] Simple Parallel Port controller
Jon Elson
2001-09-01 10:29:44 UTC
Re: [CAD_CAM_EDM_DRO] Simple Parallel Port controller
Alan Marconett KM6VV
2001-09-01 11:56:24 UTC
Re: [CAD_CAM_EDM_DRO] Simple Parallel Port controller
JanRwl@A...
2001-09-01 13:18:24 UTC
Re: [CAD_CAM_EDM_DRO] Simple Parallel Port controller
wayne_j_hill@y...
2001-09-01 17:50:16 UTC
Re: Simple Parallel Port controller
sariddle@l...
2001-09-02 08:27:36 UTC
Re: Simple Parallel Port controller
sariddle@l...
2001-09-02 08:30:16 UTC
Re: Simple Parallel Port controller
sariddle@l...
2001-09-02 08:32:42 UTC
Re: Simple Parallel Port controller
JanRwl@A...
2001-09-02 12:35:19 UTC
Re: [CAD_CAM_EDM_DRO] Re: Simple Parallel Port controller
JanRwl@A...
2001-09-02 12:44:53 UTC
Re: [CAD_CAM_EDM_DRO] Re: Simple Parallel Port controller