Announcement

Collapse
No announcement yet.

Ansteuerung eines Pins des Parallel / oder Seriell Ports

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ansteuerung eines Pins des Parallel / oder Seriell Ports

    Hi,<br>
    ich möchte ein Programm schreiben, mit dem ich Signale auf ein bestimmten Pin des Seriellen bzw Parallelen Ports senden und abfragen kann. Die Pinbelegung habe ich, und weiß auch welche Pins man dafür verwenden kann.<br>
    Ich weiß bloß nicht, wie ich nun diesen Pin mit einer Software ansprechen kann.<br>
    Codebeispiele würden mir wahrscheinlich weiterhelfen.

    Danke schon mal im Voraus,
    MfG Ingo

  • #2
    Beispiel funktioniert nur mit Win9x nich mit WinNT.

    #pragma inline

    Byte __fastcall inp(ULONG p);
    void __fastcall outp(ULONG p,Byte d);

    byte __fastcall inp(ULONG p)
    {
    Word x;

    x=(Word)p;

    asm {
    mov dx,x
    in al,dx
    }

    return _AL;
    }

    void __fastcall outp(ULONG p,Byte d)
    {
    Word x;

    x=(Word)p;

    asm {
    mov al,d
    mov dx,x
    out dx,al
    }
    }

    outp(pAdresse,Wert);
    Wert=inp(pAdresse)

    Comment


    • #3
      http://www.lezim.de/main/it/digit/4bitwerk/index.htm

      da ist es in ANSI C

      aber ist fast das gleiche was du brauchst

      Mfg Lezim G

      Comment


      • #4
        <p>
        Hmm...? Ich programmiere mit BC++B 5.0. Ich möchte damit eine Windows Anwendung schreiben, mit der ich dann einen kleinen Roboter steuern kann.
        <br>Die Befehle wie peek, inport ... usw. scheint BC++B 5.0 nicht zu kennen.
        <br>Und als Windows Anwendung denke ich müßte es mit CreatFile gehen, aber ich weiß nicht wie...
        <br>
        Mit dem Assembler Code, funktioniert das auch irgendwie nicht richtig, wenn ich die Datei compeliere, ohne die Funktionen aufzurufen, sagt er mir immer "Tasm Fehler: Extra characters on line"
        <br>
        <br>
        Wäre nett, wenn mir jemand ein kleines lauffähiges Beispiel mit Quellcode schicken könnte... An : <a href="mailto:[email protected]">[email protected]</a>
        </p&gt

        Comment


        • #5
          Hallo

          Test doch die Komponenten von Erik Salja

          ca. 30 Dollar incl. Source in Delphi
          (Kompilier- und Lauffähig unter BCB 5!!!)

          Hab Adresse momentan nicht da!

          [email protected]

          Comment


          • #6
            Hab neulich auch gehört, dass es eine ActiveX Komponente für sowas geben soll, hab sie auch gefunden (Mscomm32.ocx), aber wenn ich versuche die Componente zu importieren, will BCB diese immer compelieren und spuckt dabei aber einen Fehler aus.
            <br>
            Mache ich da was verkehrt, oder wie kann man ActiveX Komponenten verwenden???
            <br>
            MfG Ingo
            <br>
            PS: Wenn ich mir eine Komponente kaufen wollen würde, hätte ich das schon längst getan. Nur denke ich mir,so schwer kann das doch nicht sein, sich selber dafür etwas zu schreiben. ?:-

            Comment


            • #7
              <body bgcolor=#FFFFFF text=#000000>
              <code>
              <font color=#5A5A5A><i>//Das&nbsp;obige&nbsp;Beispiel&nbsp;sollte&nbsp;aber &nbsp;funktionieren.</i></font><br>
              <br>
              <br>
              <font color=#008000>#include&nbsp;<vcl.h></font><br>
              <font color=#008000>#pragma&nbsp;hdrstop</font><br>
              <br>
              <font color=#008000>#include&nbsp;"Unit1.h"</font><br>
              <br>
              <font color=#008000>#pragma&nbsp;inline</font><br>
              <br>
              <br>
              Byte&nbsp;<font color=#000000><b>__fastcall</b></font>&nbsp;inp(ULONG&nbsp;p);<br>
              <font color=#000000><b>void</b></font>&nbsp;<font color=#000000><b>__fastcall</b></font>&nbsp;outp(ULONG&nbsp;p,Byte&nbsp;d);<br>
              <br>
              <font color=#5A5A5A><i>//---------------------------------------------------------------------------</i></font><br>
              <font color=#008000>#pragma&nbsp;package(smart_init)</font><br>
              <font color=#008000>#pragma&nbsp;resource&nbsp;"*.dfm"</font><br>
              TForm1&nbsp;*Form1;<br>
              <font color=#5A5A5A><i>//---------------------------------------------------------------------------</i></font><br>
              <font color=#000000><b>__fastcall</b></font>&nbsp;TForm1::TForm1(TComponent*&nbsp;Owner)< br>
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:& nbsp;TForm(Owner)<br>
              {<br>
              }<br>
              <br>
              byte&nbsp;<font color=#000000><b>__fastcall</b></font>&nbsp;inp(ULONG&nbsp;p)<br>
              {<br>
              &nbsp;Word&nbsp;x;<br>
              <br>
              &nbsp;x=(Word)p;<br>
              &nbsp;<font color=#000000><b>asm</b></font><br>
              &nbsp;{<br>
              &nbsp;&nbsp;mov&nbsp;dx,x<br>
              &nbsp;&nbsp;in&nbsp;al,dx<br>
              &nbsp;}<br>
              <br>
              &nbsp;<font color=#000000><b>return</b></font>&nbsp;_AL;<br>
              }<br>
              <br>
              <font color=#000000><b>void</b></font>&nbsp;<font color=#000000><b>__fastcall</b></font>&nbsp;outp(ULONG&nbsp;p,Byte&nbsp;d)<br>
              {<br>
              &nbsp;Word&nbsp;x;<br>
              <br>
              &nbsp;x=(Word)p;<br>
              &nbsp;<font color=#000000><b>asm</b></font><br>
              &nbsp;{<br>
              &nbsp;&nbsp;mov&nbsp;al,d<br>
              &nbsp;&nbsp;mov&nbsp;dx,x<br>
              &nbsp;&nbsp;out&nbsp;dx,al<br>
              &nbsp;}<br>
              }<br>
              <br>
              <font color=#000000><b>void</b></font>&nbsp;<font color=#000000><b>__fastcall</b></font>&nbsp;TForm1::Button1Click(TObject&nbsp;*Send er)<br>
              {<br>
              &nbsp;Byte&nbsp;Wert;<br>
              &nbsp;Word&nbsp;pAdresse;<br>
              <br>
              &nbsp;Wert=<font color=#0000A0><b>0x</b></font>AA;<br>
              &nbsp;pAdresse=<font color=#0000A0><b>0x378</b></font>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<f ont color=#5A5A5A><i>//&nbsp;LPT1</i></font><br>
              &nbsp;outp(pAdresse,Wert);&nbsp;&nbsp;<font color=#5A5A5A><i>//&nbsp;Port&nbsp;schreiben</i></font><br>
              &nbsp;Wert=inp(pAdresse);&nbsp;&nbsp;&nbsp;<fon t color=#5A5A5A><i>//&nbsp;Port&nbsp;lesen</i></font><br>
              &nbsp;Label1->Caption=Wert;<br>
              }<br>
              <font color=#5A5A5A><i>//---------------------------------------------------------------------------</i></font><br>
              </code>
              </body&gt

              Comment


              • #8
                Hallo,

                Unter http://www.sstnet.com/ gibt es 'Windows 95/NT Port I/O Driver' für Win9x u. WinNT zum downloaden, nicht immer sofort bezahlen

                Comment

                Working...
                X