Avatar billede poull Nybegynder
11. september 2001 - 12:13 Der er 23 kommentarer og
1 løsning

Læse parallelport

Jeg er interesseret i at kunne læse fra parallelporten.

Det behøver kun at du i 98/Me men det gør ikke noget hvis det også gør i NT/2000

Har kigget på andre spm på eksperten, men der er der kun lidt asm.

Er der nogen der har en anden løsning og gerne i form af en komponent
Avatar billede poull Nybegynder
11. september 2001 - 12:23 #1
Må gerne være noget med simple muligheder, hvor man kan få at vide hvornår et af benene modtager et signal
Avatar billede seider Nybegynder
11. september 2001 - 12:26 #2
der findes noget i standard komponenten io så hvis du benytter den burde der være hjælp med ctrl+mellemrum til at læse porten.

eller skal du prøve at gå på www.delphi.com, der er en guide til precis dette problem
Avatar billede poull Nybegynder
11. september 2001 - 13:22 #3
Øh hvilken standardkomponent ? (bruger D5)

Tjekker lige det på www.delphi.com
Avatar billede poull Nybegynder
11. september 2001 - 13:28 #4
Kan ikke lige finde det jeg søger på delphi.com, men jeg har heller ikke lige så meget tid til at kigge hele siden igennem.

Så hvis du fandt et link dertil så :)
Avatar billede cyberlsn Nybegynder
11. september 2001 - 14:20 #5
Jeg er ikke sikker, men jeg tror ikke Delphi er så godt til det. Prøv at bruge C++.

Ellers så prøv at slå API op i Online Hjælpen.

Avatar billede poull Nybegynder
11. september 2001 - 14:57 #6
Kender ikke til C++, så det skulle gerne være i Delphi.
Avatar billede poull Nybegynder
11. september 2001 - 14:58 #7
Faktisk må det også gerne være serielporten hvis det er nemmere
Avatar billede chiba1 Nybegynder
11. september 2001 - 15:01 #8
prøv denne side http://ee.cleversoul.com/parallel_port.html
har brugt den i et projekt om lcd display til winamp :)
Avatar billede poull Nybegynder
11. september 2001 - 15:06 #9
Det er lige præcis det jeg skal bruge, men bare ikke i C kode.

Avatar billede poull Nybegynder
11. september 2001 - 15:08 #10
Hvis der ikke er andre muligheder må det også godt være asm eller ActiveX eller sådan noget :)
Avatar billede chiba1 Nybegynder
11. september 2001 - 15:09 #11
kik længere ned af siden der er der masser af guf til vb delphi c++ asm osv.

Other Parallel Port Information
IOPORT.OCX - Visual Basic Parallel Port Drivers
Avatar billede poull Nybegynder
11. september 2001 - 15:10 #12
Tjekker lige igen :)
Avatar billede poull Nybegynder
11. september 2001 - 15:14 #13
Har ikke lige tid nu til at tjekke helt i bund men regner med at kunen svare vidre i aften
Avatar billede cyberlsn Nybegynder
11. september 2001 - 16:42 #14
Jammen hvis du skal arbejde med porte, må og skal
det gøres i C++.

- og en kommentar:
Jeg lærte C++ programmering på bare 1 måned ved at læse en bog om C++. På den måde lærte jeg også
meget bedre Pascal at kende.
Du kan downloade en gratis C++ compiler på
www.bloodshed.net
Her er også kildekoden til C++ compileren (er lavet i Delphi).

Al Windows-programmering foregår i C++.
Selv API-kaldene i dine Delphi-programmer.

Lær evt. C++ i SDK-mappen i Delphi-mappen.

CyberLSN

Avatar billede poull Nybegynder
12. september 2001 - 10:52 #15
Jo jeg kunen da godt give mig til at lære C++ og jeg tror gerne på at det egner sig til at arbejde med porte, men det er i et mindre skoleprojekt jeg skal og det er lidt stort at skulle til

Vil stadig helst have lidt delphikode
Avatar billede poull Nybegynder
12. september 2001 - 11:30 #16
Jeg har været ved at kigge på http://ee.cleversoul.com/parallel_port.html

men det er komponenter der skriver/læser bogstaver og det skal jeg ikke bruge. Jeg skal bruge noget hvor jeg direkte kan få at vide om der er strøm eller ej på et ben.
Avatar billede jekk Nybegynder
12. september 2001 - 14:58 #17
Varian Async32 Component - noget freeware, som jeg engang har hentet på nettet, men kan desværre ikke huske hvor.

det kan en hulens masse, så måske det ikke osse kan dække dit behov.

har brugt det med stor succes i f.m. læsning på com-port af magnetkort-data...

jeg har en zip-fil på under 60 Kb, som jeg kan eftersende, hvis det har din interesse...
Avatar billede cyberlsn Nybegynder
12. september 2001 - 16:56 #18
I såfald skal du kode ASSEMBLER.
Jeg kender ikke lige ASM-koderne til det, men du kan sikkert finde nogle ældre bøger på biblioteket som handler om ASM.

Avatar billede poull Nybegynder
13. september 2001 - 11:53 #19
jekk>>
kan jeg med det du har læse direkte om der er strøm på et ben på porten, for sig lige til for så skriver jeg en mail adr.

cyberlsn>>
Har kigget lidt efter noget asm, for jeg havd en gang noget der duede men det har jeg mistet så hvis du finder det, ville de være fint
Avatar billede jekk Nybegynder
13. september 2001 - 13:15 #20
poull>>
jeg har plukket lidt i den medfølgende dokumentation, måske kan det give dig en idé om mulighederne -

ligefrem det at teste på et enkelt ben kan jeg ikke umiddelbart se - måske skal det kombineres med noget specialkode....

held og lykke med din søgen.

-------------------------------------------------


evBREAK  - A break was detected on input.
evCTS    - The CTS (clear-to-send) signal changed state.
evDSR    - The DSR (data-set-ready) signal changed state.
evERROR  - A line-status error occurred. Line-status errors
            are CE_FRAME, CE_OVERRUN, and CE_RXPARITY.
evRING    - A ring indicator was detected.
evRLSD    - The RLSD (receive-line-signal-detect) signal changed state.
evRXCHAR  - A character was received and placed in the input buffer.
evRXFLAG  - The event character was received and placed in the input buffer.
            The event character is specified in the device\'s DCB structure,
            which is applied to a serial port by using the SetCommState function.
evTXEMPTY - The last character in the output buffer was sent.
Available provider subtypes:
PST_FAX            FAX device
PST_LAT            LAT protocol
PST_MODEM          Modem device
PST_NETWORK_BRIDGE Unspecified network bridge
PST_PARALLELPORT  Parallel port
PST_RS232          RS-232 serial port
PST_RS422          RS-422 port
PST_RS423          RS-423 port
PST_RS449          RS-449 port
PST_SCANNER        Scanner device
PST_TCPIP_TELNET  TCP/IP Telnet® protocol
PST_UNSPECIFIED    Unspecified
PST_X25            X.25 standards

-------------------------------------------------
Avatar billede poull Nybegynder
14. september 2001 - 09:38 #21
jekk>> hvor i documentationen har du fundet det for det kan være jeg kan hente lidt der.
Avatar billede jekk Nybegynder
14. september 2001 - 10:35 #22
poull>>
Her følger HELE dokumentationen:
--------------------------------------------
******************************************************************************
                      VARIAN ASYNC32 COMPONENT v1.25
              (c) VARIAN SOFTWARE SERVICES NL 1996-1997
                          ALL RIGHTS RESERVED
******************************************************************************


TCOMM EXCEPTIONS
================
type
  ECommError = class(Exception)
    ErrorCode: Integer;
  end;

An ECommError exception contains an additional errorcode wich includes an
windows system error result. This value is set to -1 when the error is
handled by the component itself and no extra errorcode is available.

PUBLISHED PROPERTIES
====================

DeviceName

property DeviceName: string;

Name of communication device, Com1, Com2, Lpt1 etc. Can only be
set when the port is not assigned (closed).

MonitorEvents

TCommEventState = (evBreak, evCTS, evDSR, evError, evRing,
  evRlsd, evRxChar, evRxFlag, evTxEmpty);
TCommEventType = set of TCommEventState;

property MonitorEvents: TCommEventType;

Enable or disable certain system events.

evBREAK  - A break was detected on input.
evCTS    - The CTS (clear-to-send) signal changed state.
evDSR    - The DSR (data-set-ready) signal changed state.
evERROR  - A line-status error occurred. Line-status errors
            are CE_FRAME, CE_OVERRUN, and CE_RXPARITY.
evRING    - A ring indicator was detected.
evRLSD    - The RLSD (receive-line-signal-detect) signal changed state.
evRXCHAR  - A character was received and placed in the input buffer.
evRXFLAG  - The event character was received and placed in the input buffer.
            The event character is specified in the device\'s DCB structure,
            which is applied to a serial port by using the SetCommState function.
evTXEMPTY - The last character in the output buffer was sent.

Baudrate

TBaudRate = (cbr110, cbr300, cbr600, cbr1200, cbr2400, cbr4800, cbr9600,
  cbr14400, cbr19200, cbr38400, cbr56000, cbr57600, cbr115200, cbr128000, cbr256000);

property BaudRate: TBaudRate;

Parity

TParity = (paNone, paOdd, paEven, paMark, paSpace);

property Parity: TParity;

Stopbits

TStopbits = (sb10, sb15, sb20);

property Stopbits: TStopbits;

Databits

TDatabits=(da4, da5, da6, da7, da8);

property Databits: TDatabits;

ReadBufSize

property ReadBufSize: Integer;

Specifies the recommended size, in bytes, of the device\'s internal input buffer.

WriteBufSize

property WriteBufSize: Integer;

Specifies the recommended size, in bytes, of the device\'s internal output buffer.

CharsTimeout

property CharsTimeout: Integer;

Specifies the maximum time, in milliseconds, allowed to elapse between
the arrival of two characters on the communications line. During a Read
operation, the time period begins when the first character is received.
If the interval between the arrival of any two characters exceeds this
amount, the Read operation is completed and any buffered data is returned.
A value of zero indicates that interval time-outs are not used.

Options

TCommOption = (coParityCheck, coDsrSensitivity, coIgnoreXOff,
  coErrorChar, coNullStrip);
TCommOptions = set of TCommOption;

property Options: TCommOptions;

coParityCheck:
Specifies whether parity checking is enabled. If this member is TRUE,
parity checking is performed and errors are reported.

coDsrSensitivity:
Specifies whether the communications driver is sensitive to the state
of the DSR signal. If this member is TRUE, the driver ignores any bytes
received, unless the DSR modem input line is high.

coIgnoreXoff:
Specifies whether transmission stops when the input buffer is full and the
driver has transmitted the XoffChar character. If this member is TRUE,
transmission continues after the input buffer has come within XoffLim bytes
of being full and the driver has transmitted the XoffChar character to stop
receiving bytes. If this member is FALSE, transmission does not continue until
the input buffer is within XonLim bytes of being empty and the driver has
transmitted the XonChar character to resume reception.

coErrorChar:
Specifies whether bytes received with parity errors are replaced with the
character specified by the ErrorChar member. If this member is TRUE and
the fParity member is TRUE, replacement occurs.

coNullStrip:
Specifies whether null bytes are discarded. If this member is TRUE,
null bytes are discarded when received.

EventChars

XonChar
property XonChar: char;
Specifies the value of the XON character for both transmission and reception

XoffChar
property XoffChar: char;
Specifies the value of the XOFF character for both transmission and reception.

FlowControl

TFlowControl = (fcNone, fcCTS, fcDTR, fcSoftware, fcDefault);

property FlowControl: TFlowControl;

fcNone                No flowcontrol
fsCTS                Rts/Cts flowcontrol
fsDTR                Specifies the DTR (data-terminal-ready) flow control.
fsSoftware            Xon/Xoff flowcontrol
fcDefault            Use system settings


METHODS AND PUBLIC PROPERTIES
=============================

Enabled

function Enabled: Boolean;

Describes the component/device state, true=Open, false=Closed

Open

procedure Open;

Opens the communications device and does all the needed configurations.
Open must be called in order to access the comport. If an invalid
device handle is requested, one of the following errorcodes is returned.

2      File not found.
3      Invalid file name.
4      Too many open files.
5      Access denied.
100    EOF.
101    Disk full.
106    Invalid input.

Close

procedure Close;

Close the communications device.

Write

function Write(const Buf; Count: Integer): Integer;

Buf is any variable, Count is an expression of type Integer. Write writes Count
or fewer bytes to the com port from memory, starting at the first byte occupied
by Buf. The actual number of bytes written (less than or equal to Count) is
returned in it\'s Result. If a write operations fails it returns -1.

Read

function Read(var Buf; Count: Integer): Integer;

Buf is any variable, Count is an expression of type Integer. Read reades Count
or fewer bytes from the com port. The actual number of bytes read
(less than or equal to Count) is returned in it\'s Result. If a read operations
fails it returns -1. Never try to read bytes manually by specifying the
count parameter yourself. Use the Count parameter returned in \"RxCharEvent\".

InQueCount

function InQueCount: Integer;

Number of bytes in the ReadBuffer.

OutQueCount

function OutQueCount: Integer;

Number of bytes in the WriteBuffer. When all bytes are sent, an OnTxEmpty
event is triggerd.

PurgeIn

procedure PurgeIn;

Remove all pending characters from the inputbuffer (read).

PurgeOut

procedure PurgeOut;

Remove all pending characters from the outputbuffer (write).

SetDTRState

procedure SetDTRState(State: Boolean);

False - Clears the DTR (data-terminal-ready) signal.
True  - Sends the DTR (data-terminal-ready) signal.

SetRTSState

procedure SetRTSState(State: Boolean);

False - Clears the RTS (request-to-send) signal.
True  - Sends the RTS (request-to-send) signal.

SetBreakState

procedure SetBREAKState(State: Boolean);

False - Restores character transmission and places the transmission line
        in a nonbreak state.
True  - Suspends character transmission and places the transmission line in
        a break state. Note that this extended function does not flush data
        that has not been transmitted.

SetXONState

procedure SetXONState(State: Boolean);

False - Causes transmission to act as if an XOFF character has been received.
True  - Causes transmission to act as if an XON character has been received.

CTS

property CTS: Boolean;

True - The CTS (clear-to-send) signal is on.

DSR

property DSR: Boolean;

True - The DSR (data-set-ready) signal is on.

RING

property RING: Boolean;

True - The ring indicator signal is on.

RLSD

property RLSD: Boolean;

True - The RLSD (receive-line-signal-detect) signal is on.

Handle

property Handle: THandle;

Reference to the internal devicehandle (Readonly property)

ProviderSubtype

property ProviderSubtype: Integer;

Device Id. Use the added GetProviderSubTypeName function in order
to get a string representation of the type of device currently
opened.

Available provider subtypes:
PST_FAX            FAX device
PST_LAT            LAT protocol
PST_MODEM          Modem device
PST_NETWORK_BRIDGE Unspecified network bridge
PST_PARALLELPORT  Parallel port
PST_RS232          RS-232 serial port
PST_RS422          RS-422 port
PST_RS423          RS-423 port
PST_RS449          RS-449 port
PST_SCANNER        Scanner device
PST_TCPIP_TELNET  TCP/IP Telnet® protocol
PST_UNSPECIFIED    Unspecified
PST_X25            X.25 standards


EVENTS
======

OnBreak

property OnBreak: TNotifyEvent;

A break was detected on input.

OnCTS

property OnCTS: TNotifyEvent;

The CTS (clear-to-send) signal changed state.

OnDSR

property OnDSR: TNotifyEvent;

The DSR (data-set-ready) signal changed state.

OnRing

property OnRing: TNotifyEvent;

A ring indicator was detected.

OnRLSD

property OnRLSD: TNotifyEvent;

The RLSD (receive-line-signal-detect) signal changed state.

OnError

TCommErrorEvent = procedure(Sender: TObject; Errors: Integer) of object;
property OnError: TCommErrorEvent;

A line-status error occurred.

CE_BREAK      The hardware detected a break condition.
CE_DNS        Windows 95 only: A parallel device is not selected.
CE_FRAME      The hardware detected a framing error.
CE_IOE        An I/O error occurred during communications with the device.
CE_MODE        The requested mode is not supported, or the hFile parameter
              is invalid. If this value is specified, it is the only valid error.
CE_OOP        Windows 95 only: A parallel device signaled that it is out of paper.
CE_OVERRUN    A character-buffer overrun has occurred. The next character is lost.
CE_PTO        Windows 95 only: A time-out occurred on a parallel device.
CE_RXOVER      An input buffer overflow has occurred. There is either no
              room in the input buffer, or a character was received after
              the end-of-file (EOF) character.
CE_RXPARITY    The hardware detected a parity error.
CE_TXFULL      The application tried to transmit a character, but the output
              buffer was full.

OnRxChar

TCommRxCharEvent = procedure(Sender: TObject; Count: Integer) of object;
property OnRxChar: TCommRxCharEvent;

A character was received and placed in the input buffer. Count defines
the number of bytes received.

OnRxFlag

property OnRxFlag: TNotifyEvent;

The event character was received and placed in the input buffer.
The event character is specified in the device\'s DCB structure,
which is applied to a serial port by using the SetCommState function.

OnTxEmpty

property OnTxEmpty: TNotifyEvent;

The last character in the output buffer was sent.

------------------------------------------------
Avatar billede poull Nybegynder
05. oktober 2001 - 11:30 #23
Jeg lukker snart da jeg ikke har fået et svar til delphi.
Avatar billede poull Nybegynder
13. oktober 2001 - 19:21 #24
jeg har ikke fået det til at du, hvilket betød at jeg måtte lave det i java, for der kunne jeg godt.
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester