PDA

View Full Version : gestire la LPT sotto windows xp


laser820
31-01-2002, 21:59
ho fatto un programma in delphi per la gestione della porta parallela. Per inviare i bit ai pin della stessa ho utilizzato una procedure assembler molto semplice:

var i:word;
begin
asm
mov ax,i
mov dx,378h
out dx,ax
end;
end.

in cui " i " è il valore da dare alla porta parallela.
L'unico problema è che sotto win 98 e win Me il programma funziona correttamente, sotto win 2000 e Xp viene segnalato un errore "priviliged istruction"
cosa posso fare?
ho pensato alla possibilità di utilizzare le api di windows, ma non le conosco così a fondo!!!

cionci
01-02-2002, 01:40
Per NT, 2k e XP devi usare le API di Windows...l'utente non può accedere direttamente alle routine hardware.

laser820
01-02-2002, 18:56
sì ma quali sono le funzioni api da utilizzare? è questo che vorrei sapere!:confused:

cionci
01-02-2002, 22:29
CreateFile, ReadFile, WriteFile, CloseHandle

Da MSDN :
Communications Resources

The CreateFile function can create a handle to a communications resource, such as the serial port COM1. For communications resources, the dwCreationDisposition parameter must be OPEN_EXISTING, and the hTemplate parameter must be NULL. Read, write, or read-write access can be specified, and the handle can be opened for overlapped I/O. For more information about communications, see Communications.