RE: [CAD_CAM_EDM_DRO] Windows Step/Dir driver for coordinate measurements
Posted by
Carol & Jerry Jankura
on 2002-11-19 06:51:06 UTC
Bryan, Chuck:
What operating system are you using? If it's one of the Win 9x releases, you
should be able to write a simple set of procedures and functions in
assembler to get the job done.
I'm not sure if VB supports an 'asm' statment or not, but here's some Delphi
Code that handles Port I/O for either 8 or 16 bit ports:
unit BASICIO;
interface
Function InPort(PortVal : Word) : Byte; Pascal;
Function InPortW(PortVal : Word) : Word; Pascal;
Procedure Outport(PortVal : Word; Value : Byte); Pascal;
Procedure OutportW(PortVal : Word; Value : Word); Pascal;
implementation
Function InPort(PortVal : Word) : Byte; Pascal;
asm
mov dx, PortVal
in al, dx
mov ah, 0
end;
Function InPortW(PortVal : Word) : Word; Pascal;
asm
Mov DX, PortVal
In ax, dx
end;
Procedure Outport(PortVal : Word; Value : Byte); Pascal;
asm Mov dx, PortVal
Mov al, Value
Out dx, al
end;
Procedure OutportW(PortVal : Word; Value : Word); Pascal;
asm Mov dx, PortVal
Mov ax, Value
Out dx, ax
end;
end.
This code has been tested and works with Borland's Delphi-6 personal edition
with Windows 98-SE. The keys are:
1. Use the Processor's IN and OUT assembly language statements to perform
the I/0
2. Port number should be in DX register prior to in or out
3. with output, data to be written is in AL for 8 bit data or AX for 16 bit
data
3. with input, data is returned in AL for 8 bit data and AX for 15 bit data.
The Win 9x series of gui's protects the I/O, but freely grants access to a
program during fiitsrst I/O access attempt. This means that the first time
you access a port, there may be a slight delay as the processor grants
access rights to your program; after that, there's no delay.
As I understand it, the OS's based on the NT model will not grant I/O access
rights to a calling program, and require that you write a driver.
Has anyone written a simple driver that they'd be willing to share source
code for?
Hope this helps.
Jerry
|Looks interesting but (as I understand it) it requires their
|interface card.
|
|I don't require the high level commands that their interface card supports,
|although it would work in my application. I'd like to find a software only
|driver/dll. Freeware would be nice but not required :-)
What operating system are you using? If it's one of the Win 9x releases, you
should be able to write a simple set of procedures and functions in
assembler to get the job done.
I'm not sure if VB supports an 'asm' statment or not, but here's some Delphi
Code that handles Port I/O for either 8 or 16 bit ports:
unit BASICIO;
interface
Function InPort(PortVal : Word) : Byte; Pascal;
Function InPortW(PortVal : Word) : Word; Pascal;
Procedure Outport(PortVal : Word; Value : Byte); Pascal;
Procedure OutportW(PortVal : Word; Value : Word); Pascal;
implementation
Function InPort(PortVal : Word) : Byte; Pascal;
asm
mov dx, PortVal
in al, dx
mov ah, 0
end;
Function InPortW(PortVal : Word) : Word; Pascal;
asm
Mov DX, PortVal
In ax, dx
end;
Procedure Outport(PortVal : Word; Value : Byte); Pascal;
asm Mov dx, PortVal
Mov al, Value
Out dx, al
end;
Procedure OutportW(PortVal : Word; Value : Word); Pascal;
asm Mov dx, PortVal
Mov ax, Value
Out dx, ax
end;
end.
This code has been tested and works with Borland's Delphi-6 personal edition
with Windows 98-SE. The keys are:
1. Use the Processor's IN and OUT assembly language statements to perform
the I/0
2. Port number should be in DX register prior to in or out
3. with output, data to be written is in AL for 8 bit data or AX for 16 bit
data
3. with input, data is returned in AL for 8 bit data and AX for 15 bit data.
The Win 9x series of gui's protects the I/O, but freely grants access to a
program during fiitsrst I/O access attempt. This means that the first time
you access a port, there may be a slight delay as the processor grants
access rights to your program; after that, there's no delay.
As I understand it, the OS's based on the NT model will not grant I/O access
rights to a calling program, and require that you write a driver.
Has anyone written a simple driver that they'd be willing to share source
code for?
Hope this helps.
Jerry
|Looks interesting but (as I understand it) it requires their
|interface card.
|
|I don't require the high level commands that their interface card supports,
|although it would work in my application. I'd like to find a software only
|driver/dll. Freeware would be nice but not required :-)
Discussion Thread
Egroupscdh (E-mail)
2002-11-18 19:13:32 UTC
Windows Step/Dir driver for coordinate measurements
Bryan Mumford
2002-11-18 19:27:00 UTC
Re: [CAD_CAM_EDM_DRO] Windows Step/Dir driver for coordinate measurements
Egroupscdh (E-mail)
2002-11-18 21:18:11 UTC
RE: [CAD_CAM_EDM_DRO] Windows Step/Dir driver for coordinate measurements
glee@i...
2002-11-18 21:30:42 UTC
Re: [CAD_CAM_EDM_DRO] Windows Step/Dir driver for coordinate measurements
Bryan Mumford
2002-11-18 21:58:48 UTC
RE: [CAD_CAM_EDM_DRO] Windows Step/Dir driver for coordinate measurements
Tim Goldstein
2002-11-18 22:06:41 UTC
RE: [CAD_CAM_EDM_DRO] Windows Step/Dir driver for coordinate measurements
jeffalanp
2002-11-18 22:09:55 UTC
Re: Windows Step/Dir driver for coordinate measurements
Carol & Jerry Jankura
2002-11-19 06:51:06 UTC
RE: [CAD_CAM_EDM_DRO] Windows Step/Dir driver for coordinate measurements
Egroupscdh (E-mail)
2002-11-20 09:04:47 UTC
RE: [CAD_CAM_EDM_DRO] Windows Step/Dir driver for coordinate measurements