D
Original erstellt von broesel:
**Hallo,
Wie kann ich mit hilfe von C++ Daten an die Parallele Schnittstelle senden, es wird kein Drucker angesteuert. Sondern eine selbst entworfene Schaltung. Die Funktion sollte System übergreifend sein, weil ich das Programm hinterher Windows und Unix Benutzen möchte.
Danke Im vorraus**
Wenn du unter Linux (vielleicht gehts auch mit UNIX?) programmierst, könnte ich dir die PARAPIN Bibliothek ans Herz legen:
parapin -- a Parallel Port Pin Programming Library for Linux
http://www.circlemud.org/~jelson/software/parapin/
Anwendungsbeispiel:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "parapin.h"
int main(int argc, char *argv[])
{
int pin_sequence[] = { 1, 2, 3, 4, 5, 6, 7, 8, 17, 14, 16, 9, -1};
int i;
int prev = 0;
char buf[240];
if (pin_init_user(LPT1) < 0)
exit(0);
pin_output_mode(LP_DATA_PINS | LP_SWITCHABLE_PINS);
i = -1;
while (1) {
if (pin_sequence[++i] == -1)
i = 0;
printf("setting pin %d\n", pin_sequence[i]);
set_pin(LP_PIN[pin_sequence[i]] | prev);
printf("Hit return...\n");
fgets(buf, 5, stdin);
printf("clearing pin %d\n", pin_sequence[i]);
clear_pin(LP_PIN[pin_sequence[i]] | prev);
/* prev = LP_PIN[pin_sequence[i]]; */
} while (0);
}